简体   繁体   中英

Compilation error in boost iostreams when building from source

I am trying to build from source a Linux binary, that relies on Boost iostreams. Boost is also built from source on my machine. I get the following error message, which appears to be a compilation error in Boost:

g++  -g -O2   -o mkdssp src/dssp.o src/iocif.o src/mas.o src/mkdssp.o src/primitives-3d.o src/structure.o src/utils.o -lboost_date_time-mt -lboost_filesystem -lboost_iostreams-mt -lboost_program_options-mt -lboost_regex-mt -lboost_system -lboost_thread -lpthread  
src/mkdssp.o: In function `boost::iostreams::detail::bzip2_decompressor_impl<std::allocator<char> >::~bzip2_decompressor_impl()':
/usr/local/include/boost/iostreams/filter/bzip2.hpp:361: undefined reference to `boost::iostreams::detail::bzip2_base::end(bool, std::nothrow_t)'
src/mkdssp.o: In function `boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >::~bzip2_compressor_impl()':
/usr/local/include/boost/iostreams/filter/bzip2.hpp:321: undefined reference to `boost::iostreams::detail::bzip2_base::end(bool, std::nothrow_t)'

I have seen similar posts elsewhere, but no recipes of a workaround. Note that I don't have sudo on my machine, so doing rpm install this or yum install that is not really an option for me; i guess what I am looking for is instructions on how to rebuild boost.

My versions:

  • Boost 1.69.0
  • bzip2-1.0.6 (also built from source)
  • CentOS 7
  • Linux 3.10.0-862.14.4.el7.x86_64

Thanks in advance

You need to add -L<boost-libs-dir> -Wl,-rpath=<boost-libs-dir> to your linker command lines. <boost-libs-dir> is where the boost libraries you built reside, eg /usr/local/lib since your boost headers are in /usr/local/include .

If you didn't specify --layout=system when building boost, then you also need to specify the version numbers in the library names, eg -lboost_thread-gcc-mt-1_61 or something like that. Read Boost Library Naming for full details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM