具体的android的源码获取方法,请参考http://source.android.com/source/index.html官方文档的介绍。如果能完全照着做,意味着可以少折腾一点,比如ubuntu使用64bit的;jdk的版本使用对应内核的:2.2(Froyo)以下的版本用1.5,2.3(Gingerbread)以上用1.6;gcc使用4.4等等。当你不幸使用了ubuntu 11.10以上的32bit版本时,你就有可能和我一样遇到以下一些问题……
直接把gcc link到 4.4的版本上,省很多事情。see: http://hi.baidu.com/designhouse/blog/item/fec5cdbf8d6a231618d81fc1.html
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
cd /usr/bin
ls -l gcc*
sudo mv gcc gcc.bak
sudo ln -s gcc-4.4 gcc
sudo mv g++ g++.bak
sudo ln -s g++-4.4 g++
否则在gcc 4.6.x下:
1. frameworks/base/libs/utils/RefBase.cpp:507:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
解决方案:
cd frameworks/base/:
git cherry-pick c4fbbe06
2. In the gingerbread branch of AOSP, on Ubuntu 11.10 x86_64 running Linux 3.0.0-12-generic, builds fail on obbtool (frameworks/base/tools/obbtool/Main.cpp) with:
error: "_FORTIFY_SOURCE" redefined [-Werror]
解决方案:
see: http://code.google.com/p/android/issues/detail?id=20795
build/core/combo/HOST_linux-x86.mk line 61:
-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
3. SkFlipPixelRef.cpp: SkPixelRef::Registrar::Registrar reg(...), names the constructor, not the type.
SkImageRef_GlobalPool.cpp: SkPixelRef::Registrar::Registrar reg(...), names the constructor, not the type.
解决方案:
see: http://android-x86.git.sourceforge.net/git/gitweb.cgi?p=android-x86/korg_external_skia.git;a=commit;h=ec0c72cdf4891b8e72c34f5a124459ecd44e3e22
cd external/skia/:
git cherry-pick 65083ff5 -m 1
4. <limits.h> seems to be missing in frameworks/base/media/libstagefright/HTTPStream.cpp:136: error: ‘USHRT_MAX’ was not declared in this scope
解决方案:
不要编译simulator版本,编译generic的版本。