centos7編譯Ceph14中g++版本和pthread問題

錯誤現象:

CMake Error at CMakeLists.txt:39 (message):
  GCC 7+ required due to C++17 requirements


-- Configuring incomplete, errors occurred!
See also "/opt/ceph/ceph_curse/build/CMakeFiles/CMakeOutput.log".
See also "/opt/ceph/ceph_curse/build/CMakeFiles/CMakeError.log".
+ exit 1

及"/opt/ceph/ceph_curse/build/CMakeFiles/CMakeError.log".

Run Build Command(s):/usr/bin/gmake cmTC_49c58/fast
/usr/bin/gmake -f CMakeFiles/cmTC_49c58.dir/build.make CMakeFiles/cmTC_49c58.dir/build
gmake[1]: Entering directory `/opt/ceph/ceph_curse/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_49c58.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_49c58.dir/CheckFunctionExists.c.o   -c /usr/share/cmake3/Modules/CheckFunctionExists.c
Linking C executable cmTC_49c58
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/cmTC_49c58.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_49c58.dir/CheckFunctionExists.c.o  -o cmTC_49c58 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_49c58] Error 1
gmake[1]: Leaving directory `/opt/ceph/ceph_curse/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_49c58/fast] Error 2

解決辦法:

首次執行

yum install centos-release-scl
yum install devtoolset-7
scl enable devtoolset-7 bash

每次登錄使用g++編譯需要執行

scl enable devtoolset-7 bash

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章