0x00 MacBook Pro (Retina, 13-inch, Early 2015)
2015年买的MacBook Pro,之前256G的硬盘实在是捉襟见肘,最近为了编译AOSP升级硬盘到512G。来看下我的配置:
由于是新升级的硬盘,因此给他重新装了最新的系统:macOS Mojave 10.14(18A391)
。从各方面得到的消息,编译AOSP硬盘最好不要低于200G,因此将这块512的硬盘分了两个区,HD和Data:
- HD:256G,APFS。存放操作系统和软件等数据。
- Data:256G,APFS(区分大小写)。专门用来编译AOSP。
0x01 Prepare Environment
-
- Command_Line_Tools_macOS_10.13_for_Xcode_9.3
/Library/Developer/CommandLineTools
JAVA
➜ ~ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
➜ ~
- make
➜ ~ brew install make
==> Downloading https://homebrew.bintray.com/bottles/make-4.2.1_1.mojave.bottle.
==> Downloading from https://akamai.bintray.com/c4/c457485b491cccb4a03059e38244b
######################################################################## 100.0%
==> Pouring make-4.2.1_1.mojave.bottle.3.tar.gz
==> Caveats
GNU "make" has been installed as "gmake".
If you need to use it as "make", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
==> Summary
🍺 /usr/local/Cellar/make/4.2.1_1: 15 files, 959.4KB
➜ ~
- gnupg
➜ ~ brew install gnupg2
Updating Homebrew...
==> Installing dependencies for gnupg: adns, gettext, gmp, libtasn1, libunistring, nettle, libffi, p11-kit, libevent, unbound, gnutls, libgpg-error, libassuan, libgcrypt, libksba, libusb, npth and pinentry
==> Installing gnupg dependency: adns
...
0x02 Error
Could not find a supported mac sdk: ["10.10" "10.11" "10.12"]
[2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
[1/1] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja
[2/3] glob external/*/Android.bp
[2/2] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -b out/soong -d out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12"]
ninja: build stopped: subcommand failed.
22:49:04 soong failed with: exit status 1
#### failed to build some targets (13 seconds) ####
// build/soong/cc/config/x86_darwin_host.go
darwinSupportedSdkVersions = []string{
"10.10",
"10.11",
"10.12",
"10.13",
}
BISON_PKGDATADIR
[ 0% 573/87516] //external/selinux/checkpolicy:checkpolicy yacc policy_parse.y [darwin]
FAILED: out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/darwin_x86_64/gen/yacc/external/selinux/checkpolicy/policy_parse.c out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/darwin_x86_64/gen/yacc/external/selinux/checkpolicy/policy_parse.h
BISON_PKGDATADIR=external/bison/data prebuilts/misc/darwin-x86/bison/bison -d --defines=out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/darwin_x86_64/gen/yacc/external/selinux/checkpolicy/policy_parse.h -o out/soong/.intermediates/external/selinux/checkpolicy/checkpolicy/darwin_x86_64/gen/yacc/external/selinux/checkpolicy/policy_parse.c external/selinux/checkpolicy/policy_parse.y
[ 0% 576/87516] //system/libvintf:assemble_vintf clang++ assemble_vintf.cpp [darwin]
ninja: build stopped: subcommand failed.
23:47:05 ninja failed with: exit status 1
#### failed to build some targets (18:14 (mm:ss)) ####
cd external/bison
git cherry-pick c0c852bd6fe462b148475476d9124fd740eba160
mm
cp out/host/darwin-x86/bin/bison prebuilts/misc/darwin-x86/bison/
https://groups.google.com/forum/#!topic/android-building/D1-c5lZ9Oco
0x03 Summarize
除了CommandLineTools
工具集,总共就安装这两个工具:make
,gnupg
(当然还装了python3
,这个是自己常用的,不知道编译的时候用没用到)。由于需要编译的Andorid版本是8.1.0,8.1.0源码里只支持到10.12,自己的macOS版本又是10.14,因此选择了一个在macOS 10.14版本下能装的最低版本的CommandLineTools
——Command_Line_Tools_macOS_10.13_for_Xcode_9.3
,然后竟然就编译成功了。看了下Android 9.0.0的源码中支持到了10.13,因此猜测当前环境能直接编译,不过还没有亲测。