我正在尝试构建一个交叉编译的 CMake 项目,但找不到编译器。这是我看到的消息:
-- Architecture = arm
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- The C compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 10.3.1
CMake Error at CMakeLists.txt:7 (project):
The CMAKE_C_COMPILER:
arm-none-eabi-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.
如前一条消息所说,如果我的编译器在
PATH
中,应该可以找到:
或编译器名称(如果它在 PATH 中)。
我用的编译器(arm-gcc)确实在
PATH
。如果我添加指令message(FATAL_ERROR "++++++++++++++ $ENV{PATH}")
我得到:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/opt/gcc-arm-none-eabi-10.3-2021.10/bin
最后一个路径,
/opt/gcc-arm-none-eabi-10.3-2021.10/bin
,包含一个arm-gcc编译器:
$ls -l /opt/gcc-arm-none-eabi-10.3-2021.10/bin
total 62496
...
-rwxr-xr-x 2 1001 1001 1301072 Oct 18 2021 arm-none-eabi-g++
-rwxr-xr-x 2 1001 1001 1296976 Oct 18 2021 arm-none-eabi-gcc
...
cmake
怎么没找到?我做错了什么?
• CMakeLists.txt:56 (include) 中的 CMake 错误:include 找不到加载文件:gmxVersionInfo
• 如何在不禁用增量编译的情况下在 CMake 中使变量成为全局变量?
• target_link_libraries 不工作 CMake [重复]
• 如何在使用 cmake --install 时只复制特定文件?
• 带 $<CONFIG> 的 CMake 生成器表达式在 Windows 和 Linux 上的计算方式不同
• 在 CMake DLL 中使用通过 MSYS2 Clang64 静态编译的库
• CMake 不会在共享库中为 Q_NAMESPACE 运行 moc
• 如何在 CMake 中添加 OpenCV 存储库作为子目录?
• 为什么 macOS M2 上的 cmake 找不到 OpenMP?
• C:\src lutter in lutter.bat doctor --verbose Error: Unable to find git in your PATH