摘自自己的github
build whole android (AOSP) in Mac OS X Yosemite + Xcode 7.0.1(v10.5 SDK)
Mac OX X 10.10.5(14F27) Xcode 7.0.1(7A1001) jdk1.7.0_80 jdk1.8.0_51 (Default)
First of course, download AOSP by official instructions except that i use android-5.1.1_r14 branch instead of android-4.0.1_r1.
Then what i did especically are:
export build_mac_version=`sw_vers -productVersion` #for me, result is 10.10.5 export mac_sdk_version=10.9 #this is the biggest version AOSP build system support export mac_sdk_root=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk export gcc_darwin_version=11
VERSIONS_CHECKED := 5 BUILD_EMULATOR ?= false
AOSP要求输出所在的文件系统区分大小写,这真是无稽之谈,我不相信有什么工具故意生成大小写不同的两个文件。而且java版本检查做的很笨,envsetup.sh里都能够正确的检测出了1.7了,为何这里就傻乎乎的非要执行1.8的java,还给我抱错!索性跳过去。
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/v1
这个是我用-v选项打印出include path list后发现的。Xcode 7就自动的使用了toolchain的那个c++/v1。这个v1似乎是C++11的意思。一开始我把v1指向和他同级别的4.2.1目录,结果在ld链接时发生很多std:string的符号找不到,查呀查,发现需要用libstdc++而不是默认的libc++。后来发现Xcode根本就不用这个4.2.1目录里的东西,而是toolchain那边的,这才发现4.2.1里都是GNU的C++头文件,而v1里的都是LLVM工程里C++头文件。
53c53,54 < static const CGFontIndex kCGGlyphMax = kCGFontIndexMax; --- > //static const CGFontIndex kCGGlyphMax = kCGFontIndexMax; > static const CGFontIndex kCGGlyphMax = ((1 << 16) - 2);
489a490 > #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 495a497 > #endif
就是在489行插入#if,495行插入#endif。这个改动使得10.10以下无效,10.10开始才有效,本来里面的内容就是这个前提的,所以不影响Xcode的使用。
OK, now you can make, as a tip, you can add "showcommands" option to make, and even combine more like following commands to save output with timestamp prefix to log file.
make -j4 -k showcommands 2>&1 | (while read line; do echo `date +"%Y-%m-%d %H:%M:%S"` $line; done) | tee out/make.log
Good luck