-1

I'm trying to install OpenCV on Fedora 21 with a cross compiler for ARM processor.

However, when i try to configure using Cmake 3.03, it gives the error:

*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:

# .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.

Umar
  • 1
  • 1
  • 6

1 Answers1

0

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. I would start with creating Hello World in C++ and trying to compile that with your cross compiler. 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.

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. A yum install zlib.i686 should solve your issue. The FriendlyArm toolchain works for me and I have zlib.i686 installed already. If you get any other errors about missing shared objects make sure you have the 32 bit version installed.

missimer
  • 4,022
  • 1
  • 19
  • 33
  • So i just tried to cross compile a sample hello world program by the command: arm-linux-gcc new.c -o new and it didn't work. It generated this error: /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 – Umar Jun 13 '15 at 04:13
  • I would try to install libz.so for your host. While it could be looking for libz.so for your target (arm) I doubt it as it seems the issue is it can't launch your toolchain's assembler (as). – missimer Jun 13 '15 at 04:17
  • I just tried running the toolchain with Fedora 9 in vmware and it worked like a charm without installing any other thing. But i am unable to run the same arm-linux toolchain in Fedora 21. Btw, libz.so is already installed in lib64 directory (Fedora21). – Umar Jun 13 '15 at 05:26
  • Quick question was the fedora 9 32 bit or 64 bit? Can you run `ldd` on the toolchain's `as` and give the output. – missimer Jun 13 '15 at 05:34
  • Fedora 9 was 64bit but had support for 32bit executables as well. So i guess that was the reason for why it's working in F9. Thanks for the help! :) – Umar Jun 13 '15 at 12:51