ubuntu 12.04 编译android 2.3遇到的问题

1、

/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
缺少lib32z1-dev,安装即可:apt-get install lib32z1-dev

2、

<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default] 

    <built-in>:0:0: note: this is the location of the previous definition cc1plus: all warnings being treated as errors

    make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

    后来发现了,原来是Ubuntu11.10里的gcc和g++版本太高了,于是执行下面的操作:

    sudo apt-get install gcc-4.4

    sudo apt-get install g++-4.4

    sudo rm -rf /usr/bin/gcc /usr/bin/g++

    sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc

    sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

    上面两句ln命令可不执行,可以执行如下命令:(每次打开终端时都需输入,或放至脚本中)

    export CC=gcc-4.4

    export CXX=g++-4.4

3、g++ selected multilib '32' not installed

    继续奋战吧,安装相应的工具吧:sudo apt-get install g++-4.4-multilib


你可能感兴趣的:(ubuntu 12.04 编译android 2.3遇到的问题)