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

2021/9/11 7:08:18

本文主要是介绍在aarch64-himix100-linux-gcc下cmake报错(The C compiler identification is unknown),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

项目场景:

华为好望角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



这篇关于在aarch64-himix100-linux-gcc下cmake报错(The C compiler identification is unknown)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程