boost build issue with -Wl,--as-needed or binutils-gold

Bug #685904 reported by Andreas Metzler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Enblend
Fix Released
Medium
Christoph Spiel

Bug Description

Hello,

programs including the boost_filesystem headers also should be linked against *both* boost_filesystem headers and boost system, since boost_system functions are invoked directly via inline functions in the boost_filesystem headers. The autoconf setup of enblend-enfuse does not do this.

enblend 4.0 will therefore fail to build from source if binutils-gold is used or LDFLAGS="-Wl,--as-needed" is set:
----------------------------------------------------------------
i686-linux-gnu-g++ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I../../include -DVIGRA_STATIC_LIB -pthread -I/usr/include/OpenEXR -Wall -g -O2 -fopenmp -Wl,-Bsymbolic-functions -o enblend enblend-enblend.o enblend-gpu.o enblend-error_message.o enblend-filenameparse.o enblend-filespec.o enblend-self_test.o enblend-tiff_message.o vigra_impex/libvigra_impex.a -lGLEW -lGLU -lGL -lm -lglut -lGLU -lGL -lm -lboost_filesystem -pthread -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -lxmi -llcms -ltiff -lpng -ljpeg -lz
enblend-filenameparse.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()'
/usr/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()'
collect2: ld returned 1 exit status
make[5]: *** [enblend] Error 1
-----------------------------------------------

hg head behaves slightly differently, the autoconf test fails and the build falls back to Boost's generic filename parsing. The cmake setup already checks for both libraries afaict.

FWIW Ubuntu linux has recently enabled LDFLAGS="-Wl,--as-needed" by default.

Works-for-me patch attached.

Revision history for this message
Andreas Metzler (k-launchpad-downhill-at-eu-org) wrote :

The file asneeded.diff was added: suggested path for hg head

Christoph Spiel (cspiel)
Changed in enblend:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Christoph Spiel (cspiel)
tmodes (tmodes)
Changed in enblend:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.