简体   繁体   English

Cmake错误:未知的CXX编译器标识,未知的C编译器标识

[英]Cmake errors: The CXX Compiler identification is unknown, The C compiler identification is unknown

I'm trying to install OpenCV on Fedora 21 with a cross compiler for ARM processor. 我正在尝试使用适用于ARM处理器的交叉编译器在Fedora 21上安装OpenCV。

However, when i try to configure using Cmake 3.03, it gives the error: 但是,当我尝试使用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".*

I tried adding Path to my bash_profile, so that it looks like this: 我尝试将Path添加到我的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

I Have been googling around for hours but couldn't find any helpful steps. 我已经搜寻了几个小时,但是找不到任何有用的步骤。 Any help would be appreciated. 任何帮助,将不胜感激。 Thanks in advance. 提前致谢。

From the output it appears that cmake was able to find your cross compiler but as the output says it can't compile a simple program. 从输出看来,cmake能够找到您的交叉编译器,但是如输出所示,它无法编译简单的程序。 I would start with creating Hello World in C++ and trying to compile that with your cross compiler. 我将首先使用C ++创建Hello World,然后尝试使用交叉编译器进行编译。 If that doesn't work that is your first problem. 如果那不起作用,那是您的第一个问题。 If it does work then I would guess it has to do with some environment variable(s). 如果它确实起作用,那么我猜想它与某些环境变量有关。 You could try to have cmake print the environment variables before it tries to compile the simple C++ program and compare to your shell environment variables, sorry I can't be more helpful than that. 您可以尝试cmake在尝试编译简单的C ++程序并与您的shell环境变量进行比较之前先打印环境变量,对不起,我没有其他帮助。

Update: 更新:

So I downloaded FriendlyArm and the binaries it provides are 32 bit ELF's so you will need the 32 bit version of libz. 因此,我下载了FriendlyArm,它提供的二进制文件是32位ELF,因此您将需要32位版本的libz。 A yum install zlib.i686 should solve your issue. yum install zlib.i686应该可以解决您的问题。 The FriendlyArm toolchain works for me and I have zlib.i686 installed already. FriendlyArm工具链对我有用,并且我已经安装了zlib.i686。 If you get any other errors about missing shared objects make sure you have the 32 bit version installed. 如果您遇到有关丢失共享对象的任何其他错误,请确保已安装32位版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM