6

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?

2 Answers 2

12

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.

0
9

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
4
  • This solution works on my Ubuntu 16.04 Docker. The accepted answer doesn't. Jul 31, 2018 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, 2018 at 8:23
  • This works on ubuntu 18.04.3 LTS Sep 9, 2019 at 6:58
  • Exactly what I needed for being able to run precompiled sqlite3 on Debian 9. Sep 19, 2019 at 22:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .