gcc CMAKE_C_COMPILER不是现有编译器工具的完整路径

qcuzuvrc  于 2023-04-30  发布在  其他
关注(0)|答案(5)|浏览(344)

我最近探索了distcc,但不能让它工作。所以我

sudo apt-get remove distcc

在那之后,我得到错误

==> Processing catkin package: 'gencpp'
==> Building with env: '/opt/ros/kinetic/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/pi/ros_catkin_ws/build_isolated/gencpp'
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    /usr/local/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 "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:2 (project):
  The CMAKE_CXX_COMPILER:

    /usr/local/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.

-- Configuring incomplete, errors occurred!
See also "/home/pi/ros_catkin_ws/build_isolated/gencpp/CMakeFiles/CMakeOutput.log".
See also "/home/pi/ros_catkin_ws/build_isolated/gencpp/CMakeFiles/CMakeError.log".
Makefile:304: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
<== Failed to process package 'gencpp': 
  Command '['/opt/ros/kinetic/env.sh', 'make', 'cmake_check_build_system']' returned non-zero exit status 2

Reproduce this error by running:
==> cd /home/pi/ros_catkin_ws/build_isolated/gencpp && /opt/ros/kinetic/env.sh make cmake_check_build_system

Command failed, exiting.

我已经做了

sudo apt-get install build_essential
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade
export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++

但仍然得到相同的错误。
如何解决此错误?我已经尝试重置符号链接并删除导出

zi8p0yeb

zi8p0yeb1#

我认为你应该取消设置CCCXX,或者至少使用系统编译器,像这样(去掉/local):

export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
xcitsw88

xcitsw882#

我在安装openCV 4时遇到了类似的错误。2.0与CUDA 10。2在ubuntu 18上。04.我通过(相应更改gcc/g++版本)进行了修正

sudo apt install gcc-6 g++-6
gzszwxb4

gzszwxb43#

你需要检查你的gcc和g++的位置,并做一个软链接,因为我使用CentOS

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils

安装gcc所以我需要做以下工作,以避免同样的错误,你

sudo ln -s /opt/rh/devtoolset-8/root/usr/bin/gcc /usr/bin/cc
sudo ln -s /opt/rh/devtoolset-8/root/usr/bin/g++ /usr/bin/c++
qnzebej0

qnzebej04#

以上所有的建议并没有解决我在Ubuntu 18的问题。04,它为我工作使用:

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-7 70

在我已经有了:

sudo update-alternatives --install /usr/bin/c++ g++ /usr/bin/g++-7 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70
2cmtqfgy

2cmtqfgy5#

我在用cuda优化编译opencv时遇到了这个问题。编译器发出这个消息The CMAKE_C_COMPILER: /usr/bin/gcc-6 is not a full path to an existing compiler tool.see the output of cmake这个消息实际上很清楚,因为它只是告诉它没有找到gcc-6的指示位置,在这个例子中是/usr/bin/gcc-6。为了验证这一点,我导航到/usr/bin/文件夹,并运行命令ls gcc*来查看所有可用的gcc GNU C编译器。The image below shows what I got.可以看出,它们不是gcc-6,而是gcc-9。因此,我只需要指出相关路径-D CMAKE_C_COMPILER=/usr/bin/gcc-9和每一个思考工作找到。

相关问题