[pkg-boost-devel] Bug#602959: btag: FTBFS with binutils-gold because of missing symbol 'boost::system::get_system_category()'

Fernando Lemos fernandotcl at gmail.com
Tue Nov 9 23:37:43 UTC 2010


Hi Fabrice,

2010/11/9 Fabrice Coutadeur <fabricesp at ubuntu.com>:
[...]
> In Ubuntu, we've applied the attached patch to fix the FTBFS, by doing the
> following:
>
>  *  debian/rules: added -lboost_system to LDFLAGS to force a fix link with
>     libboost. This fixes a FTBFS with binutils-gold.
>
> We thought you might be interested in doing the same.

I don't plan to do anything about this for the time being. The reason
for the FTBFS (as reported by others[2]) is that boost::filesystem
uses boost::system in its internal headers (in inline methods invoked
by the boost::filesystem::path constructor, for instance). A
boost::filesystem user is not supposed to know in advance that
boost::filesystem requires linkage against boost::system as this is an
implementation detail that could change in the future.

btag does not use boost::system at all, and therefore it would not
make any sense to think this is a problem btag must solve. I see a few
possibilities for this being solved the right way:

1. It might be possible to change booost::filesystem to make those
methods that rely on boost::system (I think it's just
boost::system::error_code) not inline anymore. This would work fine,
but it might not be viable as C++ templates must be inlined. I don't
see this happening, good luck convincing the Boost team that the way
gold works is the right way.

2. gold could revert to the traditional ld behavior. I don't see this
happening either.

3. CMake ships with a module to find the Boost modules, and that's
what btag uses. That module could be changed to include the system
module if the filesystem module is requested, but I'm not sure the
CMake devs would want that. If this is "fixed" in pkg-config, I guess
it could be "fixed" in CMake too.

4. If -Wl,--as-needed worked with gold, I could add it to the linker
flags. It doesn't seem to work, though:

/usr/bin/cmake -E cmake_link_script CMakeFiles/btag.dir/link.txt --verbose=1
/usr/bin/c++    -Wall -Werror -Wl,--as-needed
CMakeFiles/btag.dir/src/BasicStringFilter.cpp.o
CMakeFiles/btag.dir/src/EnglishTitleLocalizationHandler.cpp.o
CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o
CMakeFiles/btag.dir/src/main.cpp.o
CMakeFiles/btag.dir/src/RenamingFilter.cpp.o
CMakeFiles/btag.dir/src/SimpleCapitalizationFilter.cpp.o
CMakeFiles/btag.dir/src/SpanishTitleLocalizationHandler.cpp.o
CMakeFiles/btag.dir/src/StandardConsole.cpp.o
CMakeFiles/btag.dir/src/TitleCapitalizationFilter.cpp.o
CMakeFiles/btag.dir/src/TitleLocalizationHandler.cpp.o  -o btag
-rdynamic -lboost_filesystem-mt -ltag
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function __static_initialization_and_destruction_0(int,
int):InteractiveTagger.cpp(.text+0x51d0): error: undefined reference
to 'boost::system::get_system_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function __static_initialization_and_destruction_0(int,
int):InteractiveTagger.cpp(.text+0x51dc): error: undefined reference
to 'boost::system::get_generic_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function __static_initialization_and_destruction_0(int,
int):InteractiveTagger.cpp(.text+0x51e8): error: undefined reference
to 'boost::system::get_generic_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function __static_initialization_and_destruction_0(int,
int):InteractiveTagger.cpp(.text+0x51f4): error: undefined reference
to 'boost::system::get_generic_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function __static_initialization_and_destruction_0(int,
int):InteractiveTagger.cpp(.text+0x5200): error: undefined reference
to 'boost::system::get_system_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/InteractiveTagger.cpp.o: in
function boost::system::error_code::error_code():InteractiveTagger.cpp(.text._ZN5boost6system10error_codeC1Ev+0x17):
error: undefined reference to 'boost::system::get_system_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/main.cpp.o: in function
__static_initialization_and_destruction_0(int,
int):main.cpp(.text+0xeb2): error: undefined reference to
'boost::system::get_system_category()'
/usr/bin/ld: CMakeFiles/btag.dir/src/main.cpp.o: in function
__static_initialization_and_destruction_0(int,
int):main.cpp(.text+0xebe): error: undefined reference to
'boost::system::get_generic_category()'
collect2: ld returned 1 exit status

That said, I don't want to create problems for derivatives. If the
benefits of having this patch in Debian outweigh the maintenance
burden of keeping track of whatever libraries the inlined methods of
boost::filesystem rely on, please let me know and I'll try to contact
my sponsor to get a "fixed" package uploaded.

By the way, I believe a better way to patch the build system would be
adding "system" to the list of modules required in CMakeLists.txt, as
well as adding libboost-system-dev to Build-Depends.

I'm CC'ing the CMake and Boost maintainers in case they have any suggestions.

[1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593876

Regards,



More information about the pkg-boost-devel mailing list