当前位置: 首页 > news >正文

RK3588上Linux系统编译C/C++ Demo时出现BUG:The C/CXX compiler identification is unknown

BUG的解决思路

    • BUG描述:
    • 解决方法:
      • 首先最重要的一步:
      • 第二步:正确设置gcc和g++的路径
        • 方法一:使用本地系统中安装的 aarch64-linux-gnu-gcc 和 aarch64-linux-gnu-g++
        • 方法二:下载使用官方指定的交叉编译工具
        • 方法三:使用本地系统中安装的gcc和g++
      • 注意:方法一、二、三运行前都需要找到`/home/firefly/second/rknn_model_zoo-2.3.0/build`路径,删除其下所有/相关文件夹,以免失败。

BUG描述:

在RK3588板卡上,运行编译rknn_model_zoo-2.3.0中的C/C++ Demo时,出现BUG:

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

    /home/firefly/second/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-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:3 (project):
  The CMAKE_CXX_COMPILER:

    /home/firefly/second/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-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/firefly/second/rknn_model_zoo-2.3.0/build/build_rknn_resnet_demo_rk3588_linux_aarch64_Release/CMakeFiles/CMakeOutput.log".
See also "/home/firefly/second/rknn_model_zoo-2.3.0/build/build_rknn_resnet_demo_rk3588_linux_aarch64_Release/CMakeFiles/CMakeError.log".

解决方法:

首先最重要的一步:

找到/home/firefly/second/rknn_model_zoo-2.3.0/build路径,删除其下所有文件夹(类似于build_rknn_xxx_demo_rk3588_linux_aarch64_Release的所有文件夹)。

第二步:正确设置gcc和g++的路径

方法一:使用本地系统中安装的 aarch64-linux-gnu-gcc 和 aarch64-linux-gnu-g++
  1. 查看本地系统中安装的 aarch64-linux-gnu-gcc 和 aarch64-linux-gnu-g++ 的路径
which aarch64-linux-gnu-gcc
which aarch64-linux-gnu-g++

如果输出/usr/bin/aarch64-linux-gnu-gcc/usr/bin/aarch64-linux-gnu-g++的结果就是本地aarch64-linux-gnu-gcc和aarch64-linux-gnu-g++ 的地址路径。

  1. 设置GCC_COMPILER路径
    在rknn_model_zoo-2.3.0文件根目录中打开终端,进入环境,输入:
export GCC_COMPILER=/usr/bin/aarch64-linux-gnu
  1. 编译相应的C/C++ Demo
    我这里编译的是resnet,平台是RK3588,系统架构为aarch64,故在终端输入:
./build-linux.sh -t rk3588 -a aarch64 -d resnet
  1. 编译成功
    在rknn_model_zoo-2.3.0文件夹下生成文件/install/rk3588_linux_aarch64/rknn_resnet_demo,其中有可执行文件。
方法二:下载使用官方指定的交叉编译工具
  1. 下载解压交叉编译工具

(如果系统中已经装有交叉编译工具,请忽略此步骤)
不同的系统架构,依赖不同的交叉编译工具。下面给出具体系统架构建议使用的交叉编译工具下载链接:

  • aarch64: https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
  • armhf: https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&rev=e09a1c450ed34a8eb06bdb3978fd8d56&hash=9C4F2E8255CB4D87EABF5769A2E65733
  • armhf-uclibcgnueabihf(RV1103/RV1106): https://console.zbox.filez.com/l/H1fV9a (fetch code: rknn)

下载交叉编译工具aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz:

wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz

解压缩下载好的交叉编译工具,记住具体的路径,后面在编译时会用到该路径:

tar xvf gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
  1. 设置GCC_COMPILER路径

在rknn_model_zoo-2.3.0文件根目录中打开终端,进入环境,输入:

export GCC_COMPILER=/home/firefly/second/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu
  1. 编译相应的C/C++ Demo
方法三:使用本地系统中安装的gcc和g++

这个方法需要修改build-linux.sh,进入该文件中找到所有CCCXX,并修改为

# 第一处
export CC=gcc
export CXX=g++
# 第二处
echo "CC=gcc"
echo "CXX=g++"

保存后编译相应的C/C++ Demo。这个方法在rknn_model_zoo-2.3.0中可能会失败,但在rknn-toolkit2-2.3.0/rknpu2中可以成功的。

注意:方法一、二、三运行前都需要找到/home/firefly/second/rknn_model_zoo-2.3.0/build路径,删除其下所有/相关文件夹,以免失败。

相关文章:

  • 双向链表专题(C语言)
  • RK3576 GPIO 配置与使用
  • 【Docker】离线安装Docker
  • 【土堆 PyTorch 教程总结】PyTorch入门
  • 【频域分析】功率谱
  • Conda与Pip:Python包管理工具的对比与选型
  • Day15:关于MySQL的编程技术——基础知识
  • MDP最优控制问题转化为可求解的线性规划
  • dify应用例子
  • 一、springboot 整合 langchain4j 实现简单的问答功能
  • FreeRTOS(消息队列信号量队列集事件标志组)
  • Emu: Enhancing Image Generation Models Using Photogenic Needles in a Haystack
  • Windows笔记本怎样删除已保存的Wifi
  • 0413-多态、Object类方法、访问权限修饰符、装箱拆箱、128陷阱
  • 车载以太网-SOMEIP
  • python 微博爬虫 01
  • Java学习手册:Java I/O与NIO
  • 【题解-洛谷】P1824 进击的奶牛
  • LangSmith 设置指南
  • 安装树莓派3B+环境
  • 俄乌代表团抵达谈判会场
  • 网易有道一季度净利润同比增长247%:有能力在今年实现更强劲的利润增长
  • 特朗普称即将与伊朗达成核协议,外交部:中方愿继续发挥建设性作用
  • 恒生银行回应裁员传闻:受影响的员工数目占银行核心业务员工总数约1%
  • 国家卫健委通报:吊销肖某医师执业证书,撤销董某莹四项证书
  • 有人倒卖试运营门票?上海乐高乐园:这些票存在无法入园风险