Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined reference to `std::__cxx11::basic_string in Boost on Travis CI

I am trying to get a C+++ project which uses Boost on GitHub to compile correctly on Travis CI.

First I tried the packages and PPAs on ubuntu, but they were too old(I need at least Boost 1.61).

I got it to work only if I compiled Boost on Travis CI(download, compile), but, unfortunately, the compile time is big (11-18 mins) and the log file is just huge.

Thinking how to get over this issues, I thinked about compiling boost on my machine, zipping, uploading to some web server and just downloading and copying on /usr/local/[include/lib] the corresponding files.

Here is the compiler I used on my machine. I compiled boost using

./bootstrap.sh --prefix=/home/andrei/boostabc
/usr/bin/time ./b2 install link=static

Here is the travis file (and repository). In comments is the way I did it with compiling boost.

The problem is that I get a lot of errors:

/usr/local/lib/libboost_filesystem.a(operations.o): In function `(anonymous namespace)::dir_itr_first(void*&, void*&, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::filesystem::file_status&, boost::filesystem::file_status&) [clone .isra.46] [clone .constprop.56]':
operations.cpp:(.text+0xa8): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

I googled this errors and I found there might be a misconfig about some C++11 ABI and a macro. I didn't understand very well the explanation and I do not have any idea how to get it working.

I would be grateful if you could point me in the right direction of solving this.

like image 893
Andrei Damian Avatar asked Nov 20 '16 15:11

Andrei Damian


1 Answers

You should try the adding -D_GLIBCXX_USE_CXX11_ABI=0 to the command line used to compile it, and see if this gets rid of the problem.

I think its quite possible that one or other of the g++/gcc you are calling is not version 6 ... otherwise this would be set to 1 by default iirc.

This is documented here

like image 96
jheriko Avatar answered Sep 23 '22 02:09

jheriko