其他分享
首页 > 其他分享> > c-在Travis CI上的Boost中对`std :: __ cxx11 :: basic_string的未定义引用

c-在Travis CI上的Boost中对`std :: __ cxx11 :: basic_string的未定义引用

作者:互联网

我正在尝试获得一个C项目,该项目在GitHub上使用Boost来在Travis CI上正确编译.

首先,我在ubuntu上尝试了软件包和PPA,但是它们太旧了(我至少需要Boost 1.61).

仅当我在Travis CI上编译Boost(下载,编译)时,我才能使它工作(但不幸的是,编译时间很大(11-18分钟),并且日志文件非常大.

在思考如何解决此问题时,我考虑过在计算机上编译boost,压缩,上传到某些Web服务器,以及只是在/usr/local/[include / lib]上下载并复制相应的文件.

Here是我在计算机上使用的编译器.我使用编译了boost

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

Here是travis文件(和存储库).在注释中,这是我使用boost进行编译的方式.

问题是我遇到很多错误:

/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&)'

我搜索了errors,发现某些C 11 ABI和宏可能配置错误.我对这个解释不太了解,我也不知道如何使它生效.

如果您能指出正确的解决方向,我将不胜感激.

解决方法:

您应该尝试将-D_GLIBCXX_USE_CXX11_ABI = 0添加到用于编译它的命令行中,然后看是否能解决该问题.

我认为您正在调用的g / gcc中的一个或另一个不是版本6很有可能,否则默认iirc会将其设置为1.

This is documented here

标签:c,c11,travis-ci,gcc,boost
来源: https://codeday.me/bug/20191010/1888099.html