72

I am facing an issue on ubuntu 12.04 as :

/usr/lib/ndk/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

I tried

sudo apt-get install lib32z1

But it says

Reading package lists... Done Building dependency tree Reading state information... Done lib32z1 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 610 not upgraded.

Please suggest a solution.

Andreas
  • 5,305
  • 4
  • 41
  • 60
user3218948
  • 741
  • 1
  • 6
  • 6

11 Answers11

123

After checking to which package does the libz.so.1 belongs (http://packages.ubuntu.com/lucid/i386/zlib1g/filelist) you should try to install zlib1g:

sudo apt-get install zlib1g

As pointed by @E-rich, it may be required to add a :i386 suffix to the package name for the package manager correctly identify it:

sudo apt-get install zlib1g:i386


EDIT (for CentOS or other distro that makes use of yum):

If someone using CentOS (or any other distro that makes use of yum) that may end up reading this question, @syslogic proposed the following solution in the comments:

yum install zlib.i686

or, for 32-bit binaries:

yum install zlib.i386
pah
  • 4,700
  • 6
  • 28
  • 37
17

This worked for me

sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5

avm
  • 181
  • 1
  • 7
3

For Fedora (can be useful for someone)

sudo dnf install zlib-1.2.8-10.fc24.i686 libgcc-6.1.1-2.fc24.i686

MariuszS
  • 30,646
  • 12
  • 114
  • 155
2

Check below link: Specially "Install 32 bit libraries (if you're on 64 bit)"

 https://github.com/meteor/meteor/wiki/Mobile-Dev-Install:-Android-on-Linux
  • 3
    this is what finally worked for me "sudo apt-get update; sudo apt-get install --yes lib32z1 lib32stdc++6" – user406905 Apr 04 '15 at 07:10
2

sudo apt-get install zlib1g:i386 fixed the Gradle issue on Android 2.1.1 on Xubuntu 16.04.

Bogdan
  • 21
  • 1
1

for centos, just zlib didn't solve the problem.I did sudo yum install zlib-devel.i686

Tianshi
  • 11
  • 2
1

For Arch Linux, it is pacman -S lib32-zlib from multilib, not zlib.

Arle Camille
  • 163
  • 1
  • 12
0

Just thought everyone should know that the videodownloadhelper companion applicaiton installs it's own version of libz.so.1 in /usr/lib at least in Archlinux. A simple reinstall of zlib, even with --overwrite='*' does not fix the problem. It actually breaks the kernel and a pacstrap from the recovery media is needed. Stay away from the vdhcoapp for now...

0

Solution:

Installing the lib64z1 package solved it for me: sudo apt install lib64z1.


Backstory:

While using a Raspberry Pi OS VM and trying to connect it to GitHub Actions, the library libz.so.1 was missing. This error appeared when I ran the config.sh script, more specifically when this script ran ldd ./bin/libSystem.IO.Compression.Native.so.

I updated zlib1g, zlib1g-dev and zlib1g:i386 with no improvements.

I then noticed that the only libz.so.1 library installed was 32 bits by doing sudo find / -name libz.so.1*, that returned these 2 file locations:

/usr/lib/i386-linux-gnu/libz.so.1.2.11
/usr/lib/i386-linux-gnu/libz.so.1 (this one is a symbolic link to the one above)

and analysing this library with file /usr/lib/i386-linux-gnu/libz.so.1.2.11 returned:

/usr/lib/i386-linux-gnu/libz.so.1.2.11: ELF 32-bit ...

Now that I've found that I was missing the 64-bit version of this library, searching for a package with it was done on the debian packages website: https://packages.debian.org/search?suite=bullseye&arch=i386&mode=filename&searchon=contents&keywords=libz.so.1 which shows that lib64z1 has the library we want on the 64 bits library directory: /usr/lib64/libz.so.1.

I've also confirmed this package exists on the Ubuntu package repository: https://packages.ubuntu.com/search?keywords=lib64z1

AfonsoFigs
  • 26
  • 4
-1

sudo yum install zlib* swig dtc patch bison flex gcc zlib.i686 bc m4 zip unzip ncurses-compat-libs sudo ln -s /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.5

sgkch
  • 1
  • 1
    While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch Apr 01 '23 at 07:15
-2

I've downloaded these packages:

  • libc6-i386
  • lib32stdc++6
  • lib32gcc1
  • lib32ncurses5
  • zlib1g

I then unpacked them and added the directories to LD_LIBRARY_PATH in my ~/.bashrc. Just make sure to add proper dirs to the path.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Krzysztof Jabłoński
  • 1,890
  • 1
  • 20
  • 29
  • To be honest - I don't know. I just did `find \`pwd\` -type d | xargs | tr " " ":"` to generate a complete listing of all subdirectories. But probably there are docs out there that tell exactly which those are. I was short on time, so I had to guess :-) – Krzysztof Jabłoński Sep 17 '14 at 09:48