Error while loading shared library libz.so.1 while cross compiling for arm-linux

36,849

Solution 1

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.

Solution 2

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
Share:
36,849

Related videos on Youtube

Mark Corrigan
Author by

Mark Corrigan

Updated on September 18, 2022

Comments

  • Mark Corrigan
    Mark Corrigan over 1 year

    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?

  • Penghe Geng
    Penghe Geng almost 6 years
    This solution works on my Ubuntu 16.04 Docker. The accepted answer doesn't.
  • SYK
    SYK over 5 years
    Didn't work for redis-desktop-manager.rdm on Ubuntu 18.04. Still "error while loading shared libraries: libz.so.1"
  • chrizonline
    chrizonline over 4 years
    This works on ubuntu 18.04.3 LTS
  • harperville
    harperville over 4 years
    Exactly what I needed for being able to run precompiled sqlite3 on Debian 9.