libz.so.1: cannot open shared object file

15,699 views
Skip to first unread message

Doug .

unread,
May 15, 2011, 11:20:12 PM5/15/11
to andro...@googlegroups.com
Hm... I've not had trouble building stuff before using the NDK, but I just downloaded it onto a server running ubuntu 10.10 on a 64-bit OS, and I'm getting this error:

doug@shadowmint:~/libpng-android$ ~/android-ndk/ndk-build NDK_PROJECT_PATH=./
Compile thumb  : png <= png.c
/home/doug/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [obj/local/armeabi/objs/png/png.o] Error 1

Any ideas? Been trawling around on the net and I can't find anything exactly the same; I saw this old thread:

Tried installing the packages there, but that didn't seem to help at all.

Do I have to rebuild the ndk for 64bit or something?

Cheers,
Doug.
Message has been deleted

David Turner

unread,
May 16, 2011, 9:47:56 AM5/16/11
to andro...@googlegroups.com
No, it should work. Can you provide more information, e.g. the output of ndk-build V=1 for this specific compilation command?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

mingw android

unread,
May 16, 2011, 9:53:29 AM5/16/11
to andro...@googlegroups.com

I ran into this yesterday too. On ubuntu 11.04 64bit. I'm not sure what caused it but I ended up reinstalling and it went away. I guess some package I apt getted that caused it.

Doug .

unread,
May 16, 2011, 8:35:42 PM5/16/11
to andro...@googlegroups.com
doug@shadowmint:~/projects/Natives/libzip-android$ ./build.sh V=1
rm -f .//libs/armeabi/lib*.so .//libs/armeabi-v7a/lib*.so .//libs/x86/lib*.so
rm -f .//libs/armeabi/gdbserver .//libs/armeabi-v7a/gdbserver .//libs/x86/gdbserver
rm -f .//libs/armeabi/gdb.setup .//libs/armeabi-v7a/gdb.setup .//libs/x86/gdb.setup
Compile thumb  : zip <= zip_add.c
/home/doug/projects/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF .//obj/local/armeabi/objs/zip/zip_add.o.d.org -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Ijni -DANDROID  -Wa,--noexecstack -O2 -DNDEBUG -g -I/home/doug/projects/android-ndk/platforms/android-3/arch-arm/usr/include -c  jni/zip_add.c -o .//obj/local/armeabi/objs/zip/zip_add.o && rm -f .//obj/local/armeabi/objs/zip/zip_add.o.d && mv .//obj/local/armeabi/objs/zip/zip_add.o.d.org .//obj/local/armeabi/objs/zip/zip_add.o.d
/home/doug/projects/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [obj/local/armeabi/objs/zip/zip_add.o] Error 1

Doug .

unread,
May 16, 2011, 8:36:22 PM5/16/11
to andro...@googlegroups.com
By reinstalling, you mean, the NDK, or the entire os? O_o
*sigh* I really don't want to do that. :/

~
Doug.

mingw.android

unread,
May 17, 2011, 4:12:13 AM5/17/11
to andro...@googlegroups.com
I guess you got it working now from seeing your more recent post?

I had to install the full OS again unfortunately. You can use this
script to setup an new Ubuntu 64 install for running (and building)
Android toolchains. It also installs Oracle Java:

http://projects.kde.org/projects/playground/mobile/necessitas/ministro/repository/revisions/master/raw/Necessitas_SDK/setup_ubuntu_for_necessitas_build.sh

Doug .

unread,
May 17, 2011, 5:07:49 AM5/17/11
to andro...@googlegroups.com
haha.. no, I just stopped using that machine to build on. :P

Cheers, I might give that link a try.

~
Doug.

David Turner

unread,
May 17, 2011, 5:57:07 AM5/17/11
to andro...@googlegroups.com
Interesting, it looks like the assembler program needs libz on the host system.

The issue is probably that the toolchain binaries are 32-bit and you are on a 64-bit system. In this case, you would need to install the 32-bit libz libraries to make the toolchain binaries work. Try the following:

sudo apt-get install lib32z1

This should normally fix the problem for you. Fact is that this library is a requirement on nearly all our machines here (to build the Android platform sources), so it's probably why this didn't get detected.

I'll try to see if it is possible to build the binaries in such a way that they do not depend on the host libz. I filed http://code.google.com/p/android/issues/detail?id=16910

Let me know if this doesn't work.


Doug .

unread,
May 17, 2011, 6:25:57 AM5/17/11
to andro...@googlegroups.com
That fixed it! thank you. Seems to be building things without a problem now.

Cheers,
Doug.

Indrakumar G

unread,
Nov 12, 2013, 12:40:53 AM11/12/13
to andro...@googlegroups.com, di...@android.com
Hi David,
I am also facing the same issue:

           /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 me a solution.

Indrakumar G

unread,
Jan 21, 2014, 5:28:33 AM1/21/14
to andro...@googlegroups.com, di...@android.com
Hi,

Can anyone please answer my below query?

Thank you......
Reply all
Reply to author
Forward
0 new messages