Undefined reference to `std :: __ cxx11 :: basic_string in Boost on Travis CI

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

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

I was able to get it to work only if I compiled Boost on Travis CI (download, compilation), but, unfortunately, the compilation time is long (11-18 minutes), and the log file is simply huge.

Thinking how to solve this problem, I thought about how to compile boost on my machine, archive it, upload it to some web server and just upload and copy the corresponding files to / usr / local / [include / lib].

Here is the compiler that 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 storage). In the comments, I did just that with boost compilation.

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 these errors and found that there might be an incorrect configuration of some C ++ 11 ABIs and macros. I did not understand the explanation very well, and I have no idea how to make it work.

I would appreciate if you would point me to the right direction to solve this problem.

+7
source share
2 answers

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

, , g++/gcc, , 6... iirc 1.

+8

, ISO C++ , . g++ yourfiles.cc -std=C++11

0

Source: https://habr.com/ru/post/1661355/


All Articles