Hi,
I'm developing a c-program tool with clang, and trying the
PrintFunctionNames plugin. However, running a command loading plugin
libraries doesn't seem to find plugins:
$ clang -cc1 -load path/to/libPrintFunctionNames.so -plugin help
clang -cc1 plugins:
Actually, on my different machine, the same thing does work and I can
see a list of function names with the plugin. But on another machine
clang seems to silently fails to load the plugin library. Could
anybody please tell me how to diagnose the problem?
Thanks,
Naoya
I have come across the same problem recently. I think it's caused by the
plugin shared library using its own instance of the plugin registry instead
of the one from the clang binary. The way I fixed (or worked around) it on
my system was by changing autoconf/ExportMap.map (and rebuilding clang) as
follows:
{
global: main;
__progname;
environ;
_ZN4llvm8RegistryIN5clang14FrontendActionENS_14RegistryTraitsIS2_EEE4HeadE;
local: *;
};
Christof
Just to verify though, shouldn't the following command print out the
builtin plugins? Curently, on trunk, I'm seeing no plugins listed.
$ clang -cc1 -plugin help
Thanks.
I'm developing a c-program tool with clang, and trying the
PrintFunctionNames plugin. However, running a command loading plugin
libraries doesn't seem to find plugins:
$ clang -cc1 -load path/to/libPrintFunctionNames.so -plugin help
clang -cc1 plugins:
I have come across the same problem recently. I think it's caused by the
plugin shared library using its own instance of the plugin registry instead
of the one from the clang binary. The way I fixed (or worked around) it on
my system was by changing autoconf/ExportMap.map (and rebuilding clang) as
follows:
Just to verify though, shouldn't the following command print out the
builtin plugins? Curently, on trunk, I'm seeing no plugins listed.
$ clang -cc1 -plugin help
That only prints the loaded plugins. There is no automatic plugin
loading, so unless you specify -load, nothing will be loaded.
- Daniel
I'm developing a c-program tool with clang, and trying the
PrintFunctionNames plugin. However, running a command loading plugin
libraries doesn't seem to find plugins:
$ clang -cc1 -load path/to/libPrintFunctionNames.so -plugin help
clang -cc1 plugins:
I have come across the same problem recently. I think it's caused by the
plugin shared library using its own instance of the plugin registry instead
of the one from the clang binary. The way I fixed (or worked around) it on
my system was by changing autoconf/ExportMap.map (and rebuilding clang) as
follows:
{
global: main;
__progname;
environ;
_ZN4llvm8RegistryIN5clang14FrontendActionENS_14RegistryTraitsIS2_EEE4HeadE;
local: \*;
};
Yes, unfortunately the plugin mechanism is currently limited &
confusing because of how we handle symbol exports. I'm tempted to just
remove the current example and recommend people follow the
clang-interpreter example instead, until someone takes the plugin
mechanism and really makes it robust & usable. Any objections?
- Daniel
Thanks Christof. Changing ExportMap.map as you told does solve my problem.
I personally like the plugin mechanism. It's much simpler for AST
analysis and also seems much faster to compile a plugin library than
to compile and link clang executables like clang-interpreter.
Thanks,
Naoya