cmake 报错

2023-11-11

目录

错误

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:24 (project):
  The CMAKE_C_COMPILER:

    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/armpoky-linux-gnueabi-gcc

  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:24 (project):
  The CMAKE_CXX_COMPILER:

    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linuxgnueabi/arm-poky-linux-gnueabi-g++

  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/flynnsinu/cmake_test/build/CMakeFiles/CMakeOutput.log".
See also "/home/flynnsinu/cmake_test/build/CMakeFiles/CMakeError.log".

原因

可能是你直接复制正点原子pdf教程过来出现问题,很奇怪,感觉怎么找都不对,可以尝试把这几个路径重新写一下

# CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
##################################
# 配置 ARM 交叉编译
#################################
set(CMAKE_SYSTEM_NAME Linux) #设置目标系统名字
set(CMAKE_SYSTEM_PROCESSOR arm) #设置目标处理器架构

# 指定编译器的 sysroot 路径
set(TOOLCHAIN_DIR /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots)
set(CMAKE_SYSROOT ${TOOLCHAIN_DIR}/cortexa7hf-neon-poky-linux-gnueabi)
# 指定交叉编译器 arm-linux-gcc 和 arm-linux-g++
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++)
# 为编译器添加编译选项
set(CMAKE_C_FLAGS "-march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7")
set(CMAKE_CXX_FLAGS "-march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#################################
# end
##################################
project(HELLO) #设置工程名称
add_executable(main main.c)
~                              

或者
修改CMakeLists.txt,把那该死的变量写法全换成路径。

# CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
##################################
# 配置 ARM 交叉编译
#################################
set(CMAKE_SYSTEM_NAME Linux) #设置目标系统名字
set(CMAKE_SYSTEM_PROCESSOR arm) #设置目标处理器架构

# 指定编译器的 sysroot 路径
set(TOOLCHAIN_DIR /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots)
set(CMAKE_SYSROOT /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi)
# 指定交叉编译器 arm-linux-gcc 和 arm-linux-g++
set(CMAKE_C_COMPILER /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++)
# 为编译器添加编译选项
set(CMAKE_C_FLAGS "-march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7")
set(CMAKE_CXX_FLAGS "-march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#################################
# end
##################################
project(HELLO) #设置工程名称
add_executable(main main.c)

这边使用3.16.0也是可以的,因为我是以为3.16.0版本低了所以尝试使用22版本,可原因不在这里,不过还是建议中等版本。

3.10.2报错

flynnsinu@ubuntu:~/cmake_test/build$ cmake --version
cmake version 3.10.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

flynnsinu@ubuntu:~/cmake_test/build$ cmake ..
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
-- Check for working C compiler: /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/flynnsinu/cmake_test/build/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_b4078/fast"
    /usr/bin/make -f CMakeFiles/cmTC_b4078.dir/build.make CMakeFiles/cmTC_b4078.dir/build
    make[1]: 进入目录“/home/flynnsinu/cmake_test/build/CMakeFiles/CMakeTmp”
    Building C object CMakeFiles/cmTC_b4078.dir/testCCompiler.c.o
    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi    -o CMakeFiles/cmTC_b4078.dir/testCCompiler.c.o   -c /home/flynnsinu/cmake_test/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_b4078
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b4078.dir/link.txt --verbose=1
    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi    -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed  CMakeFiles/cmTC_b4078.dir/testCCompiler.c.o  -o cmTC_b4078 
    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/real-ld: error: cmTC_b4078 uses VFP register arguments, CMakeFiles/cmTC_b4078.dir/testCCompiler.c.o does not
    /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/real-ld: failed to merge target specific data of file CMakeFiles/cmTC_b4078.dir/testCCompiler.c.o
    collect2: error: ld returned 1 exit status
    CMakeFiles/cmTC_b4078.dir/build.make:97: recipe for target 'cmTC_b4078' failed
    make[1]: *** [cmTC_b4078] Error 1
    make[1]: 离开目录“/home/flynnsinu/cmake_test/build/CMakeFiles/CMakeTmp”
    Makefile:126: recipe for target 'cmTC_b4078/fast' failed
    make: *** [cmTC_b4078/fast] Error 2
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:24 (project)


-- Configuring incomplete, errors occurred!
See also "/home/flynnsinu/cmake_test/build/CMakeFiles/CMakeOutput.log".
See also "/home/flynnsinu/cmake_test/build/CMakeFiles/CMakeError.log".

flynnsinu@ubuntu:~/cmake_test/build$ /opt/cmake-3.22.0-linux-x86_64/bin/cmake ..
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/flynnsinu/cmake_test/build
flynnsinu@ubuntu:~/cmake_test/build$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile
flynnsinu@ubuntu:~/cmake_test/build$ make
[ 50%] Building C object CMakeFiles/main.dir/main.c.o
[100%] Linking C executable main
[100%] Built target main
flynnsinu@ubuntu:~/cmake_test/build$ file main 
main: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=bce8d381ca827111447b5656e44741f2ff7df00c, not stripped

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

cmake 报错 的相关文章

随机推荐

  • Web3创新者之夜,与其他开发者一同畅谈波卡生态

    Token2049在即 许多开发者都将在9月中齐聚新加坡 一同讨论区块链生态发展及未来 届时将会有超过1万名与会者 并有超过300个赞助商和项目协助支持本次大会 波卡作为跨链互操作性的龙头生态也将参与至本次盛会之中 为了让波卡社区的成员 贡
  • vue中表单验证特殊字符、数据大小长度、经纬度、数组

    vue中表单验证特殊字符 数据大小长度 经纬度 数组 验证不可输入特殊字符 param rule param value param callback export function checkInputString rule value
  • SQL语言中的连接表

    连接表 包括 内连接 左连接 右连接 全外连接 交叉连接 1 内连接 内连接是SQL Server中最常用的连接之一 内部联接子句用于查询来自两个或多个相关表的数据 语法 在from子句中指定主表 t1 在 inner join 子句和连接
  • fork函数全解析

    从最简单 基础 的一个例子说起 应该说是最基础而不是简单 下面的这个最基础的例子其实并不简单 因为有很多细节 我们需要从fork函数的定义开始说起 man 手册官方定义 this function creates a new process
  • 建立安全连接失败连接到 120.79.9.99:9200 时发生错误。SSL 接收到一个超出最大准许长度的记录。错误代码:SSL_ERROR_RX_RECORD_TOO_LONG

    建立安全连接失败 连接到 120 79 9 99 9200 时发生错误 SSL 接收到一个超出最大准许长度的记录 错误代码 SSL ERROR RX RECORD TOO LONG 因为我是用https访问的需要安全协议只要改为http就行
  • docker运行有数据库连接的springboot项目无法访问

    docker run name tsb p 8808 8080 d testspringboot 8808 8888 前一个数值是访问路径的端口号 后一个数值是上传的jar包中项目设定的端口号 默认8080 访问测试 测试地址 http 1
  • Spark学习笔记(二)

    以下笔记基于对尚硅谷spark教程的学习 Spark版本3 0 目录 什么是 RDD RDD核心属性 执行原理 基础编程 创建环境 RDD 创建 从集合中创建RDD 从文件中创建RDD RDD 转换算子 Value 类型 双Value类型
  • C1认证学习笔记(第一章)

    C1认证 一 计算机通识 进制转换 进制定义 进制之间的转换 任务训练练习 信息单位 单位定义 换算公式 任务训练练习 数据校验 任务背景 奇偶校验 任务训练练习 多媒体基础参数 任务背景 参数定义 计算公式 任务训练练习 HTTP 任务背
  • 【Transformer】12、Do Vision Transformers See Like Convolutional Neural Networks?

    文章目录 一 背景 二 方法 论文链接 https arxiv org pdf 2108 08810 pdf 出处 NeurIPS2021 一 背景 Transformer 现在在视觉方面取得了超越 CNN 的效果 所以作者就有一个问题 T
  • SQL server2019安装教程

    建议 建议给位看官先看完再动手 也可以多搜索其他的文章多看看 心里有数儿了再按照文档执行 有条件的在虚拟机里面跑一遍 下载必备 由于安装文件太大 所以没有办法上传 各位就请自行下载 我尝试着加一下链接SQL引导包的链接 也就是图片中的第二个
  • leetcode#26 Remove Duplicates from Sorted Array

    给定一个排序数组 你需要在原地删除重复出现的元素 使得每个元素只出现一次 返回移除后数组的新长度 不要使用额外的数组空间 你必须在原地修改输入数组并在使用 O 1 额外空间的条件下完成 示例 1 给定数组 nums 1 1 2 函数应该返回
  • JS 数组求和的5种方法(解题报告)

    转自牛客网 题目 题目描述 计算给定数组 arr 中所有元素的总和 输入描述 数组中的元素均为 Number 类型 输入例子 sum 1 2 3 4 输出例子 10 不考虑算法复杂度 用递归做 1 2 3 4 5 6
  • 推荐10个AI人工智能技术网站

    推荐 将 NSDT场景编辑器加入你的3D工具链 3D工具集 NSDT简石数字孪生 1 AI Trends AI Trends https www aitrends com 是一个专注于人工智能领域的网站 它提供了最新的AI技术和应用趋势的报
  • C++ 常用数学函数详解汇总#include<math.h>

    目录 前言 一 头文件 二 常用函数 1 开平方 2 求常数e的x次方 3 求常数x的y次方 4 求对数lnx lgx 5 求x绝对值 6 取整函数 7 产生随机数 8 取整与取余 9 三角函数 10 反三角函数 11 的表示 前言 在实际
  • 左神-11 动态规划(仔细看end)

    最长递增子序列 01背包问题 硬币找零问题 用空间换时间 1 2 3 4 5 6 end 转载于 https www cnblogs com h3953774 p 7307790 html
  • 卷麻了,00后测试用例写的比我还好,简直无地自容.....

    前言 作为一个测试新人 刚开始接触测试 对于怎么写测试用例很头疼 无法接触需求 只能根据站在用户的角度去做测试 但是这样情况会导致不能全方位的测试APP 这种情况就需要一份测试用例了 但是不会写 求指教 还有就是测试出来的bug该如何追踪
  • Prometheus Node_exporter 之 Node Exporter

    Node Exporter 1 Node Exporter Scrape Time type GraphUnit secondsLabel Seconds collector 各个收集器持续时间metrics node scrape col
  • 安全SaaS,在中国TO B中艰难成长

    无论是一体化 还是以业务为中心专攻政企或金融客户 还是针对中小微企业市场推出免费产品 都可能成为未来安全SaaS规模化的发展路径 作者 斗斗 编辑 皮爷 出品 产业家 5G 物联网 AI 云计算等技术的应用 让生产 服务过程加速数字化 云化
  • 【Qt】UI显示中文

    QT UI显示中文的三种方法 最近在用Qt做项目 遇到UI不能显示中文的问题 发现有3种方法可以解决 先记录一下 方法一 QString fromLocal8Bit 你好中国 1 方法二 QStringLiteral 你好中国 1 方法三
  • cmake 报错

    目录 错误 原因 错误 The C compiler identification is unknown The CXX compiler identification is unknown CMake Error at CMakeList