gpt4 book ai didi

cmake - 我该如何修复 "The CMAKE_C_COMPILER is not a full path and was not found in the PATH"?

转载 作者:行者123 更新时间:2023-12-05 06:28:09 26 4
gpt4 key购买 nike

我读了Using a Mac to cross-compile Linux binaries并从中运行一些命令。当我在 macOS 上运行 cargo build 时,我收到以下错误:

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

x86_64-unknown-linux-gnu-gcc

is not a full path and was not found in the PATH.

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.

我该如何解决?

我尝试设置 CC 环境变量但没有成功:

$ which gcc
/usr/bin/gcc
$ export CC="/usr/bin/gcc"
$ cargo build

$ xcrun -find cc
/Library/Developer/CommandLineTools/usr/bin/cc
$ export CC="/Library/Developer/CommandLineTools/usr/bin/cc"
$ echo $CC
/Library/Developer/CommandLineTools/usr/bin/cc

然后我收到了同样的错误。

最佳答案

我通过运行以下命令解决了这个问题:

$ export TARGET_CC=x86_64-linux-musl-gcc
$ echo $TARGET_CC
x86_64-linux-musl-gcc
$ which x86_64-linux-musl-gcc
/usr/local/bin/x86_64-linux-musl-gcc
$ export CC="/usr/local/bin/x86_64-linux-musl-gcc"
$ echo $CC
/usr/local/bin/x86_64-linux-musl-gcc
$ cargo build

关于cmake - 我该如何修复 "The CMAKE_C_COMPILER is not a full path and was not found in the PATH"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54633860/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com