zoukankan      html  css  js  c++  java
  • 【转】“/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 ;)

  • 相关阅读:
    C++设计模式 ==> 装饰(者)模式
    基于路由器的VRRP技术--VRRP的应用
    基于路由器的VRRP技术--VRRP的应用
    C++设计模式 ==> 策略模式与简单工厂模式结合
    C++设计模式 ==> 简单工厂模式
    DVWA之Insecure Captcha
    DVWA之Insecure Captcha
    DVWA之File Inclusion
    DVWA之File Inclusion
    DVWA之XSS
  • 原文地址:https://www.cnblogs.com/wi100sh/p/4314599.html
Copyright © 2011-2022 走看看