Question: Undefined References From Boost When Installing Bam-Readcount
1
gravatar for sally.boyd
5.4 years ago by
sally.boyd10
sally.boyd10 wrote:

I am trying to install bam-readcount in a centralized location for our cluster, which means downloading "source" and building in a non-standard location. I built cmake 2.18.12.2 and boost 1.55.0. Then following the instructions did: cmake <path to="" source="">, make deps and make.

I had to dig down and find the actual c++ statement (actually gcc), and add in the paths to the boost libraries, include, etc. and the build is down to what appears to be 4 errors (one very long). I'm not sure if my version of boost has changed some things since 1.40, or if I'm just missing some libraries. I'm getting:

/scratch/rists/hpcapps/x86_64/boost/1.55.0/lib/libboost_program_options.a(options_description.o): In function boost::program_options::options_description::print(std::basic_ostream<char, std::char_traits<char> >&) const': options_description.cpp:(.text+0x2a8b): undefined reference to std::basic_ostream<char, std::char_traits<char=""> >& std::__ostream_insert<char, std::char_traits<char="">

(std::basic_ostream<char, std::char_traits<char=""> >&, char const*, long)' ...

/scratch/rists/hpcapps/x86_64/boost/1.55.0/lib/libboost_program_options.a(options_description.o):options_description.cpp:(.text+0x2fc4): more undefined references to `std::basic_ostream<char, std::char_traits<char=""> >& std::__ostream_insert<char, std::char_traits<char=""> >(std::basic_ostream<char, std::char_traits<char=""> >&, char const*, long)' follow

/scratch/rists/hpcapps/x86_64/boost/1.55.0/lib/libboost_program_options.so: undefined reference to `std::basic_ostream<char, std::char_traits<char=""> >& std::__ostream_insert<char, std::char_traits<char=""> >(std::basic_ostream<char, std::char_traits<char=""> >&, char const*, long)@GLIBCXX_3.4.9'

/scratch/rists/hpcapps/x86_64/boost/1.55.0/lib/libboost_program_options.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'

I am open to suggestions here -- I'm hoping I can just add some additional libraries to the c++ statement.

Regards,

Sally Boyd

• 4.0k views
ADD COMMENTlink written 5.4 years ago by sally.boyd10
2

Are you compiling with gcc rather than g++? That's a frequent cause of things like undefined reference to std::basic_ostream. You might also just add -lstdc++, which ends up doing much of the same thing, but it's better to directly call g++.

ADD REPLYlink modified 5.4 years ago • written 5.4 years ago by Devon Ryan90k

It was using /usr/bin/c++. Changed it to g++ (no path) and that worked! Thanks so much!

ADD REPLYlink written 5.4 years ago by sally.boyd10

I am having the exact problem! Could you please explain in detail what you did? How did you change it to g++?

ADD REPLYlink written 5.4 years ago by tayebwajb90

@dpryan79 I am having the same problem. I have pasted the error messages I am getting here. Please look at them and let me know how I should install bam-readcount successfully on my system. Thanks!

ADD REPLYlink modified 5.4 years ago by Devon Ryan90k • written 5.4 years ago by tayebwajb90

Try just setting the CXX environment variable to g++. That might solve the problem. Make sure to wipe the build tree first (i.e. start with nothing compiled).

ADD REPLYlink written 5.4 years ago by Devon Ryan90k

That didn't work for me. What finally worked was disabling auto-linking by adding to CMakeLists.txt

add_definitions(-DBOOST_ALL_NO_LIB)

and linking to the boost program options library by adding the line

link_libraries(${Boost_PROGRAM_OPTIONS_LIBRARY})
ADD REPLYlink modified 5.4 years ago • written 5.4 years ago by tayebwajb90
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1615 users visited in the last hour