【转】“/usr/bin/ld: cannot find -lz”
原文网址:http://stackoverflow.com/questions/3373995/usr-bin-ld-cannot-find-lz
I am trying to compile Android source code under Ubuntu 10.04. I get an error saying,
/usr/bin/ld: cannot find -lz
Can you please tell me how can I fix it? What does cannot find -lz mean? Here's the full error message:
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
And my GCC version output:
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.
I already have the zlib1g-dev library installed:
$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version.
(I get that from this link.)
linux gcc linker
shareimprove this question
edited Oct 22 '12 at 22:31
Kazark
2,81532152
asked Jul 30 '10 at 17:34
michael
15.4k47146227
7
Wow, really? Even though he specifically says less than 4 inches above your comment that he does have it installed? – Justin Buser May 8 '12 at 14:32
4
@Justin Buser it's obligatory for every stackoverflow question to include a comment that shows that someone read about one sentence of the question and moved on. – magnetar Jun 10 '12 at 13:24
3
@magnetar Ahhh... that must have been at the end of the FAQ, I didn't actually read the whole thing unfortunately. ;) – Justin Buser Jul 15 '12 at 15:10
add a comment
9 Answers
activeoldestvotes
up vote
67
down vote
I had the exact same error, and like you, installing zlib1g-dev did not fix it. Installing lib32z1-dev got me past it. I have a 64 bit system and it seems like it wanted the 32 bit library.
shareimprove this answer
answered Apr 22 '11 at 16:34
kylefinn
96358
5
It worked here with libz-dev (virtual package for zlib1g-dev) on Kubuntu 12.04 x64. – Qsiris Jan 22 '13 at 16:06
1
helped me on a totally different problem. Thanks :-) – mgjk Dec 25 '13 at 16:20
This should be the accepted answer – Speccy Mar 23 '14 at 19:45
1
Also helped me install/build lxml-3.4.0 for Python via pip on Ubuntu 14.04 LTS/trusty. Thanks! – Marian Sep 15 '14 at 8:07
sudo apt-get install lib32z1-dev #FTW – Sangharsh Dec 11 '14 at 17:51
add a comment
up vote
18
down vote
I just encountered this problem and contrary to the accepted solution of "your make files are broken" and "host includes should never be included in a cross compile"
The android build includes many host executables used by the SDK to build an android app. In my case the make stopped while building zipalign, which is used to optimize and apk before installing on an android device.
Installing lib32z1-dev solved my problem, under Ubuntu you can install it with the following command:
sudo apt-get install lib32z1-dev
shareimprove this answer
edited Nov 22 '13 at 13:47
Chilledrat
2,27621427
answered May 1 '11 at 19:58
Adam
18112
add a comment
up vote
6
down vote
For x64 just install zlib1g-dev.
sudo apt-get install zlib1g-dev
I don't need all the x86 libs ;)
【转】“/usr/bin/ld: cannot find -lz”的更多相关文章
- 编译错误:/usr/bin/ld: cannot find -lz
编译时出现错误/usr/bin/ld: cannot find -lz,安装zlib和zlib-devel yum install zlib yum install zlib-devel
- /usr/bin/ld: cannot find -lz
同事在一台机器上新安装的CentOS,我拷贝一个项目在上面编译,老是报如下错误: “/usr/bin/ld: cannot find -lz” 说明:libz.so是有的,在/lib64下面 我设置环 ...
- android编译错误--/usr/bin/ld: cannot find -lz
编译时出现/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libz.so when se ...
- 编译的时候出现"/usr/bin/ld: cannot find -lz
编译的时候出现"/usr/bin/ld: cannot find -lz"错误,需要安装zlib-dev这个包,在线安装命令为:apt-get install zlib1g-dev ...
- /usr/bin/ld.bfd.real: cannot find -lGL /usr/bin/ld.bfd.real: cannot find -lX11
/usr/bin/ld.bfd.real: cannot find -lGL /usr/bin/ld.bfd.real: cannot find -lX11 根据网上大多数的说法,以及官网的介绍.截至 ...
- linux /usr/bin/ld cannot find 解决
问题: 在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息: /usr/bin/ld: cannot find -lxxx 这些讯息会随着编译不同类型的source ...
- linux /usr/bin/ld: cannot find -lxxx
在linux环境编译应用程式或lib的source code时出现如下错误:/usr/bin/ld: cannot find -lxxx 这些讯息会随着编译不同类型的source code 而有不同的 ...
- 关于usr/bin/ld: cannot find -lxxx问题总结
/usr/bin/ld: cannot find -lxxx问题总结 linux下编译应用程序常常会出现如下错误: /usr/bin/ld: cannot find -lxxx ...
- CentOS6.5安装readline时报错:/usr/bin/ld : cannot find -lncurses
CentOS6.5安装readline时报错:/usr/bin/ld : cannot find -lncurses 解决方法: 安装ncurses-devel,输入命令: #yum install ...
随机推荐
- 设置nginx禁止通过IP访问服务器的方法
在Nginx上设置禁止通过IP访问服务器,只允许通过域名访问,以避免别人把未备案的域名解析到自己的服务器IP而导致服务器被断网. nginx的默认虚拟主机允许用户通过IP访问,或者通过未设置的域名访问 ...
- 细说PHP中strlen和mb_strlen的区别
在PHP中,strlen与mb_strlen是求字符串长度的函数,但是对于一些初学者来说,如果不看手册,也许不太清楚其中的区别.下面通过例子,讲解这两者之间的区别. $str='中文a字1符'; ec ...
- 如何在Exe和BPL插件中实现公共变量共享及窗口溶入技术Demo源码
如何在Exe和BPL插件中实现公共变量共享及窗口溶入技术Demo源码 1.Delphi编译方式介绍: 当我们在开发一个常规应用程序时,Delphi可以让我们用两种方式使用VCL,一种是把VCL中的申明 ...
- Bios里,把SATA Mode Selection改为AHCI无法启动
新装系统Win7_X64,将SATA Mode Selection改为AHCI后总是重启,baidu参考: SATA的硬盘就选AHCI(全称应该是SATA AHCI),AHCI可以提升硬盘的读写速度原 ...
- python【第五篇】常用模块学习
一.主要内容 模块介绍 time &datetime模块 random os sys shutil json & pickle shelve xml处理 yaml处理 configpa ...
- 拖尾渲染器 Trail Renderer
拖尾渲染器(Trail Renderer)用于制作跟在场景中的物体后面的拖尾效果来代表它们在到处移动. 必须给Materials一个材质渲染器设置的Colors才有效. 展示自己的一个demo...
- 关于博客名“大话济公”的说明
其实本来没打算起这个名字的,换了几个名字都被占用了(无语啊...).最近呢,我在研究<济公传>,对于济公的传说比较喜欢,尤其是这个任务,诙谐幽默,同时有时时刻刻在帮助有困难的群众,虽然是个 ...
- HTTP - PUT 上传文件/Shell
今天遇到几个PUT上传的点,但是都没利用起来.一怒之下,在自己本地试了一下.步骤如下: 一.环境: 首先,根据 配置Apache服务器支持向目录PUT文件 更新一下httpd.conf文件,重启所有服 ...
- C# zip/unzip with DotNet framework 4.5
add reference System.IO.Compression.FileSystem public class ZipHelper { public static string UnZip(s ...
- caffe之(四)全连接层
在caffe中,网络的结构由prototxt文件中给出,由一些列的Layer(层)组成,常用的层如:数据加载层.卷积操作层.pooling层.非线性变换层.内积运算层.归一化层.损失计算层等:本篇主要 ...