例如:
/usr/include/features.h:323:26: 致命错误: bits/predefs.h:没有那个文件或目录
编译中断。
make: *** [out/host/linux-x86/obj/EXECUTABLES/mkbootfs_intermediates/mkbootfs.o] 错误 1
make: *** 正在等待未完成的任务….
In file included from /usr/include/stdlib.h:25:0,
from build/tools/acp/acp.c:11:
/usr/include/features.h:323:26: 致命错误: bits/predefs.h:没有那个文件或目录
编译中断。
或者是这个现象
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<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
上述两个问题都是由于:
ubuntu 11.10的gcc版本是4.6.1,版本太高,编译android时出错,要把gcc版本改为4.4.3。
废话不多说了,直接写解决方法吧;
ubuntu 系统下安装gcc 4.4的方法是仅用以下两条命令。
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
$ ls -l gcc*
lrwxrwxrwx 1 root root 7 2011-10-29 09:11 gcc -> gcc-4.6
-rwxr-xr-x 1 root root 224544 2011-10-06 05:47 gcc-4.4
-rwxr-xr-x 1 root root 302104 2011-09-17 05:43 gcc-4.6
sudo mv gcc gcc.bak
sudo ln -s gcc-4.4 gcc
ls -l g++*
lrwxrwxrwx 1 root root 7 2011-08-14 15:17 g++ -> g++-4.6
-rwxr-xr-x 1 root root 228640 2011-10-06 05:45 g++-4.4
-rwxr-xr-x 1 root root 306200 2011-09-17 05:39 g++-4.6
需要将g++链接改为g++-4.4:
/usr/bin$ sudo mv g++ g++.bak
/usr/bin$sudo ln -s g++-4.4 g++
gcc -vg++ -v