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!

It says:

Cannot load plugin ../libimo/libimo.so

. So is the file in that directory?

.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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.