• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

已解决centos下CMAKE编译报gcc版本冲突

武飞扬头像
qq_29707567
帮助1

学新通

CMake Error at CMakeLists.txt:39 (project):
  The CMAKE_C_COMPILER:

    /usr/bin/c

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:39 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/c

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:39 (project):
  The CMAKE_ASM_COMPILER:

    /usr/bin/cc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

解决方法:

方法1、在gcc安装之前先卸载历史版本,避免2个版本并存的问题

#先卸载

$yum remove gcc -y

$yum erase gcc

#安装

$ sudo yum install centos-release-scl -y

$ sudo yum install devtoolset-7-gcc* -y

$ scl enable devtoolset-7 bash    #Run for each time or add this line into the ~/.bashrc file

$ which gcc

$ gcc --version

######1、查找系统中的gcc文件,并逐个目录检查相关版本 gcc --version,找到低版本目录,并替换低版本的执行文件路径、建立新版本的软连接

$find / -name gcc #
/opt/rh/devtoolset-7/root/usr/libexec/gcc
/opt/rh/devtoolset-7/root/usr/lib/gcc
/opt/rh/devtoolset-7/root/usr/bin/gcc  #7.3.1-5

/usr/libexec/gcc
/usr/lib/gcc
/usr/bin/gcc #4.8.5

解决办法:
$mv /usr/bin/gcc /usr/bin/gcc4.8.5
$ln -s /opt/rh/devtoolset-7/root/usr/bin/gcc /usr/bin/gcc
 

同理:还需要处理c 、g 、cc的

结果:按照这种方式处理后还有些问题,后来改成了方式1来处理,基本解决了,不再报错

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhiacaki
系列文章
更多 icon
同类精品
更多 icon
继续加载