【发布时间】:2018-01-31 13:08:06
【问题描述】:
我遵循本教程Cross compilation for ARM based Linux systems,以便使用cmake 为基于ARM 的Linux 系统构建Opencv 3.3.1 版(Ubuntu Mate 在ODROID-XU4 Mini PC 上运行)。对于构建过程,我正在运行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,没有任何错误。
提前致谢。
【问题讨论】:
-
除了使用适当的工具链传递 CMAKE_TOOLCHAIN_FILE 选项外,您还需要为该工具链安装编译器:
sudo apt-get install gcc-arm-linux-gnueabi。这在您参考的教程中有说明。 -
感谢@Tsyvarev,但它已经安装好了,
-
gcc-arm-linux-gnueabi 已经是最新版本(4:5.3.1-1ubuntu1)。
-
嗯,那么工具链已经找不到你的编译器了……不知道为什么。在切换到工具链之前,您是否清除了构建目录? (换句话说,命令
cmake -DCMAKE_TOOLCHAIN_FILE=...应该在empty目录中执行。) -
是的,我确保在构建之前构建目录是空的,但是在尝试构建并出现错误之后,cmake 正在生成一些文件,包括可能对您有帮助的错误日志文件,在这里是它的链接:dropbox.com/s/ujjaap7u3hkl2hu/arm.zip?dl=0
标签: c++ opencv cmake arm odroid