我正在尝试在Ubuntu 10.04下编译Android源代码.我收到一个错误说,
/ usr/bin/ld:找不到-lz
你能告诉我怎么解决它?什么cannot find -lz
意思?这是完整的错误消息:
external/qemu/Makefile.android:1101: warning: overriding commands for target `external/qemu/android/avd/hw-config-defs.h' external/qemu/Makefile.android:933: warning: ignoring old commands for target `external/qemu/android/avd/hw-config-defs.h' host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so) /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz /usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz /usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] Error 1
我的GCC版本输出:
scheung@scheung-virtual-box:/media/EXTDIV/mydroid$ gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我已经安装了zlib1g-dev
库:
$ sudo apt-get install zlib1g-dev Reading package lists... Done Building dependency tree Reading state information... Done zlib1g-dev is already the newest version.
(我从这个链接得到了.)
我有完全相同的错误,和你一样,安装zlib1g-dev并没有解决它.安装lib32z1-dev让我超越它.我有一个64位系统,似乎它想要32位库.
对于x64,只需安装zlib1g-dev.
sudo apt-get install zlib1g-dev
我不需要所有的x86库;)
sudo apt-get install libz-dev
在ubuntu.
我刚刚遇到这个问题而且与"你的make文件坏了"和"主机包含永远不应该包含在交叉编译中"的公认解决方案相反
android构建包括SDK用于构建Android应用程序的许多主机可执行文件.在我的情况下,make在构建zipalign时停止,用于在Android设备上安装之前优化apk.
安装lib32z1-dev解决了我的问题,在Ubuntu下你可以使用以下命令安装它:
sudo apt-get install lib32z1-dev
我有完全相同的错误,安装zlib-devel解决了我的问题,键入命令并安装zlib包.
在linux上:
sudo apt-get install zlib*
在Centos上:
sudo yum install zlib*