Android libz.so.1:无法打开共享对象文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21256866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 04:14:12  来源:igfitidea点击:

libz.so.1: cannot open shared object file

androidubuntuubuntu-12.04android-sdk-tools

提问by user3218948

I am facing an issue on ubuntu 12.04 as :

我在 ubuntu 12.04 上面临一个问题:

/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

/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:加载共享库时出错:libz.so.1:无法打开共享对象文件:没有这样的文件或目录

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.

读取包列表...完成 构建依赖树 读取状态信息...完成 lib32z1 已经是最新版本。0 升级,0 新安装,0 删除和 610 未升级。

Please suggest a solution.

请提出解决方案。

回答by pah

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:

在检查 libz.so.1 属于哪个包(http://packages.ubuntu.com/lucid/i386/zlib1g/filelist)后,您应该尝试安装 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:

正如@E-rich 所指出的,可能需要在包名称后添加 :i386 后缀,以便包管理器正确识别它:

sudo apt-get install zlib1g:i386



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

编辑(用于 CentOS 或其他使用 的发行版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:

如果有人使用 CentOS(或任何其他使用 的发行版yum)最终阅读了这个问题,@syslogic 在评论中提出了以下解决方案:

yum install zlib.i686

or, for 32-bit binaries:

或者,对于 32 位二进制文​​件:

yum install zlib.i386

回答by avm

This worked for me

这对我有用

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

须藤 apt-get 安装 libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5

回答by MariuszS

For Fedora (can be useful for someone)

对于 Fedora(可能对某人有用)

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

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

回答by Soheil Karshenas

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

检查以下链接:特别是“安装 32 位库(如果您使用的是 64 位)”

 https://github.com/meteor/meteor/wiki/Mobile-Dev-Install:-Android-on-Linux

回答by Bogdan

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

sudo apt-get install zlib1g:i386 修复了 Xubuntu 16.04 上的 Android 2.1.1 上的 Gradle 问题。

回答by Arle Camille

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

对于 Arch Linux,它pacman -S lib32-zlib来自multilib,而不是zlib.

回答by Tianshi

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

对于centos,只是zlib没有解决问题。我做到了 sudo yum install zlib-devel.i686

回答by Krzysztof Jab?oński

I've downloaded these packages:

我已经下载了这些软件包:

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

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

然后我解压它们并将目录添加到LD_LIBRARY_PATH我的~/.bashrc. 只需确保向路径添加正确的目录即可。