Here's the issue: the code I'm using uses a big library which links against boost. When I compile with static linking, everything works fine. However, when I try dynamic linking I get a bunch of undefined reference errors. The first thought was obviously "I am not linking the boost program_options" library, but I looked, and it is there in the linking command (and it comes after the library that needs it). Among the different errors, though, this stood out:
undefined reference to `_ZN5boost15program_options3argB5cxx11E
In my daily experience, linking errors are usually of the form "undefined reference to somefunction(...)". So I went to the installation folder of my boost library and used readelf
to see what symbols I have in the library libboost_program.so
. And in fact, that symbol does not appear. Instead, the closest I found is _ZN5boost15program_options3argE
.
Google-ing a little bit, I found out that the extra part B5cxx11
is a new addition to the name mangling since C++11. It appears that boost (at least version 1.59.0) does not yet support this new name mangling.
So my question is: Is this a known issue? What workaround are there? And why does this issue not show up with static linking?
Edit: In case someone stumbles on this question in the future, I just tried boost 1.60.0, and the symbols contain the string B5cxx11
. I believe (read: hope) this will solve the issue. As a double check, though, I am going to recompile again boost 1.59.0 to see if this is due to something I changed in my environment (although I doubt it).