c++ - OpenCV v3.3.1 ARM 交叉编译失败 : No CMAKE_CXX_COMPILER could be found

标签 c++ opencv cmake arm odroid

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

请注意,我已经按照本教程 Opencv Installation in Linux 尝试为我的 Intel x86 Ubuntu based 运行机器构建相同版本的 Opencv ,我成功做到了。但是,当使用同一台机器为 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,当我尝试删除它时,我成功地结束了为我的 x86 机器构建 Opencv,没有任何错误。

提前致谢。

最佳答案

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

所以还需要安装g++-arm-linux-gnueabi包。

关于c++ - OpenCV v3.3.1 ARM 交叉编译失败 : No CMAKE_CXX_COMPILER could be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48542972/

相关文章:

c++ - CMake 在多个目标上构建后自定义命令?

linker - CMake:如何生成二进制文件 "as static as possible"

c++ - 一个很长的 boolean 数组/std::bitset

ios - Opencv 可以在c/cpp 中开发- 在IOS 中运行吗?

C++:条件变量等待

opencv - 如何在OpenCV中对图像执行交叉加法

python - 计算等高线的周长(OpenCV、Python)

c++ - Linux Mint 19 上的 CMake 3.11 无法找到静态 Boost 库

c++ - OpenGL 多线程/共享上下文和 glGenBuffers

c++ - 如何在终端上运行 Netbeans makefile