ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

在aarch64-himix100-linux-gcc下cmake报错(The C compiler identification is unknown)

2021-09-10 15:02:14  阅读:500  来源: 互联网

标签:bin gcc cmake -- aarch64 CXX 报错 linux compiler


项目场景:

华为好望角AI摄像头C系列的算法移植过程中,遇到cmake报错


问题描述:

gcc: aarch64-himix100-linux-gcc

CMakeLists.txt文档:

cmake_minimum_required(VERSION 3.14)
project(NNIE_tutorial)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_COMPILER /home/liuky/HDD_1/soft/aarch-linux-gnu/bin/aarch64-linux-gnu-g++)
set(CMAKE_C_COMPILER /home/liuky/HDD_1/soft/aarch-linux-gnu/bin/aarch64-linux-gnu-gcc)

include_directories(3rd_party/hisi/include)
include_directories(include)

file(GLOB SRCS
        src/*.cpp
        src/*.hpp
        )
file(GLOB LIBS
        libs/libsecurec.a)

add_executable(NNIE_tutorial ${SRCS})

target_link_libraries(NNIE_tutorial pthread m dl)
target_link_libraries(NNIE_tutorial ${LIBS})

注意:此处修改标红地址,改成你自己的aarch64-linux-gnu-g++和aarch64-linux-gnu-gcc所在地址。

1、set(CMAKE_CXX_COMPILER /home/liuky/HDD_1/soft/aarch-linux-gnu/bin/aarch64-linux-gnu-g++)

2、set(CMAKE_C_COMPILER /home/liuky/HDD_1/soft/aarch-linux-gnu/bin/aarch64-linux-gnu-gcc)

在CMakeLists.txt所在目录下,依次执行以下命令,

mkdir bin # 创建bin文件夹,方便存放cmake生成的中间文件
cd bin
cmake .. # ..是CMakeLists.txt所在

报错

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_C_COMPILER could be found.

  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:2 (project):
  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.


-- Configuring incomplete, errors occurred!
See also "/home/HuaweiAI/nnie_sdc_tutorial/Part_3/bin/CMakeFiles/CMakeOutput.log".
See also "/home/HuaweiAI/nnie_sdc_tutorial/Part_3/bin/CMakeFiles/CMakeError.log".


解决方案:

1、确认 aarch64-himix100-linux-gcc安装上了,执行如下命令

aarch64-himix100-linux-gcc -v

如果正确安装,则输出gcc version。

2、依次执行以下命令,更新依赖

sudo apt-get update
sudo apt-get install -y build-essential

此时再cmake,则成功,如下

root@e3f6c5260a7b:/home/HuaweiAI/nnie_sdc_tutorial/Part_3/bin# cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/HuaweiAI/nnie_sdc_tutorial/Part_3/bin

标签:bin,gcc,cmake,--,aarch64,CXX,报错,linux,compiler
来源: https://blog.csdn.net/qq_30841655/article/details/120221687

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有