我正在尝试在CentOS7中构建CentOS7 1.75。
gcc和C++被更新为9.3.1版和c++14版,分别使用以下shell脚本。
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版本添加到引导程序中,但它也不起作用。
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功能的编译器。
发布于 2021-03-07 13:59:17
额外的"script_update_c++.sh“安装gcc 4.8到/usr/bin。我想这可能是干扰。
试一试
hash -r
which gcc
gcc --version(也是哪个g++)来找出你的路径是什么。
如果它报告GCC 4.8,那么很可能您只是在子subshells中执行脚本,而不是外包它们。那不管用是因为
source scl_source enable devtoolset-9为当前shell设置环境变量。所以,要么自己发布,要么通过源代码来运行脚本。
https://stackoverflow.com/questions/66513839
复制相似问题