The CMAKE_C_COMPILER: aarch64-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.
时间: 2023-10-22 15:14:30 浏览: 909
这个错误信息提示你的 CMake 找不到 aarch64-linux-gnu-gcc 编译器,可能是因为该编译器没有安装或者没有在 PATH 环境变量中设置。你可以尝试以下几种方法来解决这个问题:
1. 安装适当的编译器。你可以在命令行中运行 "which aarch64-linux-gnu-gcc" 来查看该编译器是否已经安装。
2. 设置 PATH 环境变量。你可以在命令行中运行 "export PATH=$PATH:/path/to/your/compiler" 来将编译器所在的路径添加到 PATH 环境变量中。
3. 设置 CMake 编译器路径。你可以在 CMakeLists.txt 文件中添加以下代码来指定编译器路径:
```
set(CMAKE_C_COMPILER /path/to/your/compiler)
```
请注意,这些方法中的任何一种都可能需要根据你的具体情况进行调整。
相关问题
使用aarch64-linux-gnu-gcc的cmakelist怎么写
在CMakeLists.txt文件中,如果你想要使用`aarch64-linux-gnu-gcc`编译器针对AArch64 Linux平台,你可以按照下面的方式编写:
```cmake
cmake_minimum_required(VERSION 3.5)
project(MyProject)
# 设置构建目录
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-gcc")
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
# 针对AArch64指定编译器标志
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 8) # 检查是否为64位系统
set(CMAKE_CXX_FLAGS "-march=armv8-a -mtune=cortex-a72") # 添加AArch64特定的编译选项
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") # 将C语言的编译选项设置得和C++一样
endif()
# 添加源文件目录和其他依赖项
set(SOURCE_DIRS src/)
add_executable(MyApp ${SOURCE_DIRS}main.cpp other_source.cpp)
# 定义其他构建配置,如安装路径等
install(TARGETS MyApp DESTINATION bin)
```
这个例子中,我们首先设置了CMake的C++和C编译器为`aarch64-linux-gnu-gcc`。然后检查是否为64位的Linux系统,如果是,则添加AArch64特定的编译标志。接着,指定了源文件目录,并通过`add_executable`函数创建了一个可执行文件。最后,定义了如何安装生成的可执行文件。
mkdir -p build && cd build && cmake .. -- The C compiler identification is GNU 9.3.0 -- The CXX compiler identification is unknown -- Check for working C compiler: /work/bsp/rk356x/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gcc -- Check for working C compiler: /work/bsp/rk356x/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done CMake Error in CMakeLists.txt: No CMAKE_CXX_COMPILER could be found. 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 Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.10) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. -- Configuring incomplete, errors occurred! See also "/home/edu/workplace/yuenki/ykrecovery/build/CMakeFiles/CMakeOutput.log". See also "/home/edu/workplace/yuenki/ykrecovery/build/CMakeFiles/CMakeError.log". Makefile:7: recipe for target 'configure' failed make: *** [configure] Error 1
这是一个CMake的错误,它提示找不到C++编译器。建议你检查一下你的系统中是否安装了C++编译器,并确认它的路径是否正确。同时,你也可以通过设置环境变量CXX或者CMake缓存条目CMAKE_CXX_COMPILER来告诉CMake编译器的路径或者编译器名称。另外,CMakeLists.txt文件中还缺少cmake_minimum_required命令,你需要在文件的开头添加这个命令,以指定CMake的最低版本要求。
阅读全文
相关推荐















