I cross-compiled OpenCV for arm following this guide, and built this sample program.
When I first ran it like this:
./DisplayImage image.png
I got:
./DisplayImage: error while loading shared libraries:
libopencv_highgui.so.3.1: cannot open shared object file: No such file or directory
So I figured it needs the library libopencv_highgui.so.3.1
. So I added all these libs to /lib
:
(1) libopencv_highgui.so
(2) libopencv_highgui.so.3.1
(3) libopencv_highgui.so.3.1.0
symlinks: (1) -> (2) -> (3)
But now I'm getting:
./DisplayImage: error while loading shared libraries:
lib/libopencv_highgui.so.3.1: internal error
I ran file
on both the library and the executable to check their info, and this is the output:
.../opencv/platforms/linux/my_build/lib$ file libopencv_highgui.so.3.1.0
libopencv_highgui.so.3.1.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=1107ba22b36437bedb37dbfe0250626c14759be9, not stripped
.../opencv_sample$ file DisplayImage
DisplayImage: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=aef57fe79d0928ca3afdff8d1b65268e1ad72e77, not stripped
edit:
Running readelf -d DisplayImage | grep NEEDED
produces:
0x00000001 (NEEDED) Shared library: [libopencv_highgui.so.3.1]
0x00000001 (NEEDED) Shared library: [libopencv_imgcodecs.so.3.1]
0x00000001 (NEEDED) Shared library: [libopencv_core.so.3.1]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x00000001 (NEEDED) Shared library: [ld-linux-armhf.so.3]
I found all of them on my target except ld-linux-armhf.so.3
.
What could be causing this "internal error" problem?
sudo apt-get install
it and go.