Hi,

I have an application where I want to statically link both babeltrace2 library including the built in plugins as well as lttng ctl library. I couldn’t find much documentation regarding that. I know you can configure babeltrace with —enable-built-in-plugins but that seems to just link the eventual binary tool with the plugins.
 
I tried to statically link the individual plugin archives (ctf, text, utils) using —whole-archive but I am getting an error message saying some of the functions have multiple definitions in liblttng-ctl archive. E.g., 

“babeltrace-plugin-ctf.a (libctf_parser_la-lexer.o) : in function ‘yyrestart’: lexer.c:1875: multiple definition of ‘yyrestart’ liblttng-ctl.a (libfilter_la-filter-lexer.o):filter-lexer.c:(.text+0x17e5): first defined here.

Without —whole-archive the build succeeds (I am using cmake) but the plugins are missing in my app (when trying to use bt_plugin_find with static).

I am using lttng-tools stable-2.12 and babeltrace2 stable-2.0 from GitHub.

What do I need to do to properly link lttng-ctl, babeltrace2 and the built in plugins?

Thanks,
Eqbal