c++linkerclang++gold-linker

"Symbol from plugin" in linker error


So, I did something dumb and got myself a linker error:

CMakeFiles/pipeline.dir/src/pipeline/pipelineElements/tracker/ObjectTracker.cpp.o (symbol from plugin): In function `ObjectTracker::process(long)':
(.text+0x0): multiple definition of `BackgroundSubtract::OptionTypes<(BackgroundSubtractOptionID)0>::type PipelineConfiguration::getOption<BackgroundSubtract, (BackgroundSubtractOptionID)0>(BackgroundSubtract const&) const'
CMakeFiles/pipeline.dir/src/pipeline/pipelineElements/RegionFinder.cpp.o (symbol from plugin):(.text+0x0): first defined here
CMakeFiles/pipeline.dir/src/pipeline/pipelineElements/tracker/ObjectTracker.cpp.o (symbol from plugin): In function `ObjectTracker::process(long)':

I'm curious about what the "symbol from plugin" part means? I've never seen that before in my various adventures with linker errors. What's a "plugin" in this context?


Solution

  • This is referring to a linker plugin that improves optimization quality; probably the build is using the flag -fuse-linker-plugin.

    When supported by the linker, the linker plugin (see -fuse-linker-plugin) passes information to the compiler about used and externally visible symbols.

    [...]

    This information specifies what symbols can be accessed externally (by non-LTO object or during dynamic linking).

    http://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Optimize-Options.html