【发布时间】:2021-06-05 09:23:07
【问题描述】:
我正在尝试在 CentOS7 中构建boost 1.75。
gcc 和 C++ 分别使用以下 shell 脚本更新到版本 9.3.1 和 c++14。
script_update_gcc.sh
sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-9-gcc*
source scl_source enable devtoolset-9
gcc --version
# gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
script_update_c++.sh
sudo yum -y install centos-release-scl-rh
sudo yum-config-manager --enable centos-release-scl-rh
sudo yum -y install devtoolset-9
source scl_source enable devtoolset-9
我用来从源代码构建boost 的脚本如下。
wget https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz
tar -xzf boost_1_75_*
cd boost_1_75_*
sudo ./bootstrap.sh --prefix=/opt/boost
sudo ./b2 install --prefix=/opt/boost --with=all
但是,我收到以下错误消息
A C++11 capable compiler is required for building the B2 engine.
Toolset 'cxx' does not appear to support C++11.
** Note, the C++11 capable compiler is _only_ required for building the B2
** engine. The B2 build system allows for using any C++ level and any other
** supported language and resource in your projects.
You can specify the toolset as the argument, i.e.:
./build.sh gcc
Toolsets supported by this script are:
acc, clang, como, gcc, intel-darwin, intel-linux, kcc, kylix, mipspro,
pathscale, pgi, qcc, sun, sunpro, tru64cxx, vacpp
我尝试了./build.sh gcc,但文件没有在源文件夹中存在。我还尝试将gcc 版本添加到也不起作用的boostrap。
sudo ./bootstrap.sh --prefix=/opt/boost --with-toolset=gcc-9.3.1
作为我最后的手段,我尝试了clang,但它也没有帮助,并给了我与上面完全相同的错误:
./bootstrap.sh toolset=clang cxxflags="-stdlib=libc++ -std=c++11" linkflags="-stdlib=libc++"
有人可以帮我吗?我已经将c++ 和gcc 更新到了最新版本,我不知道为什么boost 抱怨没有支持c++11 的编译器。
【问题讨论】:
标签: c++ c++11 gcc boost centos7