Bug 750940 - Static libboost_filesystem errors
Summary: Static libboost_filesystem errors
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: boost
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Petr Machata
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-02 21:43 UTC by Andrew Case
Modified: 2015-05-05 01:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-03 09:03:37 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Andrew Case 2011-11-02 21:43:13 UTC
Description of problem:
Try compiling using the static libboost_filesystem.a and it bombs.

Version-Release number of selected component (if applicable):
boost-static-1.41.0-11.el6_1.2.x86_64

How reproducible:
Every time.

  
Actual results:
$ /usr/bin/gcc /home/test/tmp/test.o /home/test/dbg/libbdt.so.0.1 -m64 -O0 -fno-inline -pedantic -fPIC -DPIC  -L/home/test/dbg -L/usr/lib64 -Wl,-Bstatic -lboost_filesystem -lboost_program_options -lboost_date_time -lboost_iostreams  -lm -lstdc++ -Wl,-Bdynamic -lz -lbdt -o /home/test/tmp/cow
/home/test/test.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()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `boost::filesystem::detail::create_directory_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text+0x6d0): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `boost::filesystem::detail::space_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text+0x7f3): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0x9f5): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa01): undefined reference to `boost::system::get_generic_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa0d): undefined reference to `boost::system::get_generic_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa19): undefined reference to `boost::system::get_generic_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa25): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa3b): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `global constructors keyed to _ZN5boost10filesystem6detail6throwsE':
(.text+0xa51): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `boost::filesystem::detail::rename_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text+0xd62): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o): In function `boost::filesystem::detail::remove_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text+0xfbb): undefined reference to `boost::system::get_system_category()'
/usr/lib64/libboost_filesystem.a(operations.cpp.o):(.text._ZN5boost10filesystem24basic_directory_iteratorINS0_10basic_pathISsNS0_11path_traitsEEEE9incrementEv[boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >::increment()]+0x47): more undefined references to `boost::system::get_system_category()' follow
collect2: ld returned 1 exit status


Expected results:
Same as if I run it with dynamic libraries which is 
$ /usr/bin/gcc /home/test/tmp/test.o /home/test/dbg/libbdt.so.0.1 -m64 -O0 -fno-inline -pedantic -fPIC -DPIC  -L/home/test/dbg -L/usr/lib64 -Wl,-Bdynamic -lboost_filesystem -lboost_program_options -lboost_date_time -lboost_iostreams  -lm -lstdc++ -Wl,-Bdynamic -lz -lbdt -o /home/test/tmp/cow
$ echo $?
$ 0

Additional info:
$ rpm -qa boost* | sort
boost-1.41.0-11.el6_1.2.x86_64
boost-date-time-1.41.0-11.el6_1.2.x86_64
boost-devel-1.41.0-11.el6_1.2.x86_64
boost-doc-1.41.0-11.el6_1.2.x86_64
boost-filesystem-1.41.0-11.el6_1.2.x86_64
boost-graph-1.41.0-11.el6_1.2.x86_64
boost-graph-mpich2-1.41.0-11.el6_1.2.x86_64
boost-graph-openmpi-1.41.0-11.el6_1.2.x86_64
boost-iostreams-1.41.0-11.el6_1.2.x86_64
boost-math-1.41.0-11.el6_1.2.x86_64
boost-mpich2-1.41.0-11.el6_1.2.x86_64
boost-mpich2-devel-1.41.0-11.el6_1.2.x86_64
boost-mpich2-python-1.41.0-11.el6_1.2.x86_64
boost-openmpi-1.41.0-11.el6_1.2.x86_64
boost-openmpi-devel-1.41.0-11.el6_1.2.x86_64
boost-openmpi-python-1.41.0-11.el6_1.2.x86_64
boost-program-options-1.41.0-11.el6_1.2.x86_64
boost-python-1.41.0-11.el6_1.2.x86_64
boost-regex-1.41.0-11.el6_1.2.x86_64
boost-serialization-1.41.0-11.el6_1.2.x86_64
boost-signals-1.41.0-11.el6_1.2.x86_64
boost-static-1.41.0-11.el6_1.2.x86_64
boost-system-1.41.0-11.el6_1.2.x86_64
boost-test-1.41.0-11.el6_1.2.x86_64
boost-thread-1.41.0-11.el6_1.2.x86_64
boost-wave-1.41.0-11.el6_1.2.x86_64

Comment 1 Andrew Case 2011-11-02 21:46:41 UTC
Note: 
I can link just fine with the static version of all the other boost libraries mentioned in this compile line except libboost_filesystem.  filesystem is the only one that causes this problem.

Comment 2 Andrew Case 2011-11-02 21:51:14 UTC
Includes are from the same version of boost as the static library:

$ rpm -qf /usr/include/boost/system/error_code.hpp 
boost-devel-1.41.0-11.el6_1.2.x86_64
$ rpm -qf /usr/lib64/libboost_filesystem.a
boost-static-1.41.0-11.el6_1.2.x86_64

Comment 4 RHEL Program Management 2011-11-02 22:08:51 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 5 Petr Machata 2011-11-02 22:22:17 UTC
Broken references to anything boost::system:: should be taken care of by including -lboost_system on the command line.  For DSO's this is done automatically, but for static archives you need to do it yourself.

Comment 6 Andrew Case 2011-11-02 23:01:05 UTC
Yep.  Thanks!


Note You need to log in before you can comment on or make changes to this bug.