Cmake 错误:CXX 编译器标识未知,C 编译器标识未知
Cmake errors: The CXX Compiler identification is unknown, The C compiler identification is unknown
我正在尝试在 Fedora 21 上使用 ARM 处理器的交叉编译器安装 OpenCV。
然而,当我尝试使用 Cmake 3.03 进行配置时,出现错误:
*The CXX compiler identification is unknown
The C compiler identification is unknown
Check for working CXX compiler: /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++
Check for working CXX compiler: /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: /opt/opencv/relarm/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTryCompileExec1616328985/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1616328985.dir/build.make
CMakeFiles/cmTryCompileExec1616328985.dir/build
gmake[1]: Entering directory '/opt/opencv/relarm/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/opt/opencv/relarm/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object
CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o
/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -o
CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o -c
/opt/opencv/relarm/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/as:
error while loading shared libraries: libz.so.1: cannot open shared object
file: No such file or directory
CMakeFiles/cmTryCompileExec1616328985.dir/build.make:57: recipe for target
'CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o' failed
gmake[1]: Leaving directory '/opt/opencv/relarm/CMakeFiles/CMakeTmp'
gmake[1]: ***
[CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o] Error 1
Makefile:118: recipe for target 'cmTryCompileExec1616328985/fast' failed
gmake: *** [cmTryCompileExec1616328985/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:63 (project)
Configuring incomplete, errors occurred!
See also "/opt/opencv/relarm/CMakeFiles/CMakeOutput.log".
See also "/opt/opencv/relarm/CMakeFiles/CMakeError.log".*
我尝试将路径添加到我的 bash_profile,因此它看起来像这样:
# .bash_profile
# Get the aliases and functions if [ -f ~/.bashrc ]; then
. ~/.bashrc fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++:/usr/bin/gmake:/usr/share/bin:/usr/share/sbin
我已经谷歌搜索了几个小时,但找不到任何有用的步骤。任何帮助,将不胜感激。
提前致谢。
从输出来看,cmake 似乎能够找到您的交叉编译器,但正如输出所说,它无法编译一个简单的程序。我将从用 C++ 创建 Hello World 开始,然后尝试使用交叉编译器对其进行编译。如果那不起作用,那是您的第一个问题。如果它确实有效,那么我猜它与某些环境变量有关。您可以尝试让 cmake 在尝试编译简单的 C++ 程序之前打印环境变量并与您的 shell 环境变量进行比较,抱歉,我没有比这更有帮助的了。
更新:
所以我下载了 FriendlyArm,它提供的二进制文件是 32 位 ELF,因此您需要 32 位版本的 libz。 yum install zlib.i686
应该可以解决您的问题。 FriendlyArm 工具链适合我,我已经安装了 zlib.i686。如果您收到有关缺少共享对象的任何其他错误,请确保您安装了 32 位版本。
我正在尝试在 Fedora 21 上使用 ARM 处理器的交叉编译器安装 OpenCV。
然而,当我尝试使用 Cmake 3.03 进行配置时,出现错误:
*The CXX compiler identification is unknown
The C compiler identification is unknown
Check for working CXX compiler: /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++
Check for working CXX compiler: /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: /opt/opencv/relarm/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTryCompileExec1616328985/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1616328985.dir/build.make
CMakeFiles/cmTryCompileExec1616328985.dir/build
gmake[1]: Entering directory '/opt/opencv/relarm/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/opt/opencv/relarm/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object
CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o
/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -o
CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o -c
/opt/opencv/relarm/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/as:
error while loading shared libraries: libz.so.1: cannot open shared object
file: No such file or directory
CMakeFiles/cmTryCompileExec1616328985.dir/build.make:57: recipe for target
'CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o' failed
gmake[1]: Leaving directory '/opt/opencv/relarm/CMakeFiles/CMakeTmp'
gmake[1]: ***
[CMakeFiles/cmTryCompileExec1616328985.dir/testCXXCompiler.cxx.o] Error 1
Makefile:118: recipe for target 'cmTryCompileExec1616328985/fast' failed
gmake: *** [cmTryCompileExec1616328985/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:63 (project)
Configuring incomplete, errors occurred!
See also "/opt/opencv/relarm/CMakeFiles/CMakeOutput.log".
See also "/opt/opencv/relarm/CMakeFiles/CMakeError.log".*
我尝试将路径添加到我的 bash_profile,因此它看起来像这样:
# .bash_profile
# Get the aliases and functions if [ -f ~/.bashrc ]; then
. ~/.bashrc fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++:/usr/bin/gmake:/usr/share/bin:/usr/share/sbin
我已经谷歌搜索了几个小时,但找不到任何有用的步骤。任何帮助,将不胜感激。 提前致谢。
从输出来看,cmake 似乎能够找到您的交叉编译器,但正如输出所说,它无法编译一个简单的程序。我将从用 C++ 创建 Hello World 开始,然后尝试使用交叉编译器对其进行编译。如果那不起作用,那是您的第一个问题。如果它确实有效,那么我猜它与某些环境变量有关。您可以尝试让 cmake 在尝试编译简单的 C++ 程序之前打印环境变量并与您的 shell 环境变量进行比较,抱歉,我没有比这更有帮助的了。
更新:
所以我下载了 FriendlyArm,它提供的二进制文件是 32 位 ELF,因此您需要 32 位版本的 libz。 yum install zlib.i686
应该可以解决您的问题。 FriendlyArm 工具链适合我,我已经安装了 zlib.i686。如果您收到有关缺少共享对象的任何其他错误,请确保您安装了 32 位版本。