51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

centos7环境编译时报错不支持-std=c++17

在公司环境编译工具时,提示不支持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++
赞(1)
未经允许不得转载:工具盒子 » centos7环境编译时报错不支持-std=c++17