在公司环境编译工具时,提示不支持c++17,需要更新GCC版本至7.3.1版本。

[root@lolicp ~]# make data_exporter
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found SWIG: /usr/bin/swig (found version "2.0.10") 
-- Found Python3: /usr/bin/python3.6 (found version "3.6.8") found components: Interpreter Development 
-- Found Python: /usr/bin/python3.6 (found version "") Found include /usr/include/python3.6m
-- Found python module: setuptools (found version "39.2.0")
-- Found python module: wheel (found version "0.37.1")
-- Found Java: /usr/bin/java (found version "1.8.0.402") found components: Development 
-- Found Java: /usr/bin/java (found version "1.8.0_402")
-- Found JNI: /usr/lib/jvm/java/jre/lib/amd64/libjawt.so  
-- Found JNI: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /root/rtidb_tool/rtidb-feat-export_data
Scanning dependencies of target rtidb_sdk
[  0%] Building CXX object src/sdk/CMakeFiles/rtidb_sdk.dir/cluster_sdk.cc.o
c++: error: unrecognized command line option ‘-std=c++17’
make[3]: *** [src/sdk/CMakeFiles/rtidb_sdk.dir/cluster_sdk.cc.o] Error 1
make[2]: *** [src/sdk/CMakeFiles/rtidb_sdk.dir/all] Error 2
make[1]: *** [src/CMakeFiles/data_exporter.dir/rule] Error 2
make: *** [data_exporter] Error 2

更新步骤

安装gcc

GCC升级到 7以上版本(修改 7 更换其他版本)

yum install centos-release-scl
yum install devtoolset-7-gcc*
移动默认环境
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
mv /usr/bin/g++ /usr/bin/g++-4.8.5
mv /usr/bin/c++ /usr/bin/c++-4.8.5
更新默认环境
ln -s /opt/rh/devtoolset-7/root/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-7/root/bin/g++ /usr/bin/g++
ln -s /opt/rh/devtoolset-7/root/bin/c++ /usr/bin/c++
END

本文标题:centos7环境编译时报错不支持-std=c++17

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202420663.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2024 年 02 月 20 日
如果觉得我的文章对你有用,请随意赞赏