4

I'm trying to cross compile an opencv app on Ubuntu 14.04 to run on an ARM core. I can compile the open cv app fine on Ubuntu with

g++ test.c -o test -I /usr/include/opencv -I /usr/include/opencv2 -L /usr/local/lib/ -lopencv_core -lopencv_imgproc -lopencv_highgui

It compiles and I have a testl.bin in my directory.

However, when I alter the compiler for my arm core

arm-linux-gnueabi-g++ test.c -o test -I /usr/include/opencv -I /usr/include/opencv2 -L /usr/local/lib/ -lopencv_core -lopencv_imgproc -lopencv_highgui

I'm met with the error

error while loading shared libraries: libz.so.1: cannot open shared object file: no such file or directory.

When I try and install this library apt-get lets me know it's at it's newest version and there's nothing to be installed.

Can someone help me out?

11

I had the same problem - it is a bit confusing. The cross-compiler may be 32-bit (my case), so it is complaining about missing 32-bit library:

sudo apt-get install zlib1g:i386

Then cross-compiler should work.

3

I had the same problem but the library suggested by @Marek had no installation candidates on my system. Instead, I solved the problem by running:

sudo apt-get install lib32z1
  • This solution works on my Ubuntu 16.04 Docker. The accepted answer doesn't. – Penghe Geng Jul 31 '18 at 14:59
  • Didn't work for redis-desktop-manager.rdm on Ubuntu 18.04. Still "error while loading shared libraries: libz.so.1" – SYK Oct 12 '18 at 8:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.