Hello,

I have compiled a GCC plugin successfully, but I get error when linking:

$ make
/opt/imo/bin/g++ -g -fplugin=../libimo/libimo.so -o test main.cpp
cc1plus: error: Cannot load plugin ../libimo/libimo.so
../libimo/libimo.so: undefined symbol: _ZN11NodeFactory10CreateNodeEN4BEEV4KindERKNS0_7ASTNodeES4_RKSt6vectorIS2_SaIS2_EE
make: *** [default] Error 1

I know that the plugin works fine for other Ubuntu users, so I don't understand what could be the cause of this error on my system. I read on the Internet that "undefined symbol" error means that the linker can not find the line where a specific object was defined in the code.
Is there a way to trace down where the error starts from? Something like a logfile or a backtrace for linker errors?

Thanks!

.so is the usual extension type of plugins (at least in this case):
<plugin_name.so>

The folder where the plugin is located is also correct.

Any clue of how to trace back a linker error?

I don't know of any tools but it seems from the error that it cannot find the definition of some function called NodeFactory::CreateNode . Can you think of any reason why that could be?

NodeFactory does not exist anywhere in the C++ code of the plugin, it is only used after the plugin is built (in the actual <plugin.so> file):

libimo$ grep NodeFactory *.*
Binary file libimo.so matches

I have also no problems to build the plugin - the error above appears when I try to link / test the plugin on some input file. The error is always identical, regardless of the input file.
I also could not find any tools for linker errors online. Maybe it is possible to create something like a build log file that shows the steps of building/linking the plugin. Anyone know how to do that?

This article has been dead for over six months. Start a new discussion instead.