OpenCV v3.3.1 ARM的交叉编译失败:找不到CMAKE_CXX_COMPILER

时间:2018-01-31 13:08:07

标签: c++ opencv cmake arm odroid

我遵循了本教程Cross compilation for ARM based Linux systems,以便使用Opencv为基于ARM的Linux系统(在ODROID-XU4 Mini PC上运行的Ubuntu Mate)构建cmake版本3.3.1。对于构建过程,我正在运行Ubuntu Mate v 16.04.1 x86

请注意,我已经尝试按照本教程Opencv Installation in Linux为我的Opencv正在运行的计算机构建相同版本的Intel x86 Ubuntu based,并且我做到了成功。但是,当使用同一台机器为ARM构建它时,我收到以下错误。

-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:114 (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.


CMake Error at CMakeLists.txt:114 (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.


-- Configuring incomplete, errors occurred!
See also "/home/jhon/Programs/opencv-3.3.1/arm/CMakeFiles/CMakeOutput.log".
See also "/home/jhon/Programs/opencv-3.3.1/arm/CMakeFiles/CMakeError.log".

以下是生成此错误的命令行:

cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake ..

请注意,选项-DCMAKE_TOOLCHAIN_FILE告诉cmake为基于ARM的Linux系统构建Opencv,当我尝试删除它时,我成功地建立了Opencv我的x86机器没有任何错误。

提前致谢。

2 个答案:

答案 0 :(得分:1)

OpenCV文档告诉我只安装 C 交叉编译器(包gcc-arm-linux-gnueabi),但实际上OpenCV也需要 C ++ 编译器。

因此,还需要安装g++-arm-linux-gnueabi包。

答案 1 :(得分:0)

我一直想知道为什么Opencv-Linux没有预先构建的二进制文件(我仍然不知道为什么)所以在这里我把我的工作公之于众,其中包括Opencv 3.3.1 Linux x86,x64和armv7hf的预构建版本(包括相应的java二进制文件)。

OpenCV Linux x86, x62 & armv7hf binaries