Android8.0原始碼編譯填坑之路
環境:Mac10.13.4
問題一:
system/core/base/logging.cpp:81:10: 'syscall' is deprecated: first deprecated in OS X 10.12 - syscall(2) is unsupported;
please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations]
system/core/base/logging.cpp:81:10: error:
'syscall' is deprecated: first deprecated in OS X 10.12 - syscall(2) is unsupported;
please switch to a supported interface.
For SYS_kdebug_trace use kdebug_signpost().
[-Werror,-Wdeprecated-declarations]
return syscall(SYS_thread_selfid);
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:733:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
1 error generated.
[ 0% 142/32130] host C++: libbacktrac...tem/core/libbacktrace/BacktraceMap.cpp
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
解決方式:
去到/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs,
發現MacOSX10.11.sdk已經被刪除,只剩下MacOSX10.12.sdk,
所以首先要去下載10.11的SDK。可以去MacOSX-SDKs下載MacOSX10.11.sdk,
解壓拷貝到/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs。
為了避免下次升級的時候再被刪除,可以放到~/Document/MacOSX10.11.sdk,再給它建立一個軟連結:
問題二:
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
解決方式:
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
問題三:
none of the installed SDKs (ac_sdk_versions_installed) match supported versions (10.8 10.9 10.10 10.11), trying 10.8
直接找到這個檔案build/core/combo/mac_version.mk修改其中的 mac_sdk_versions_installed
加上我mac的版本10.13,解決了這個錯誤。
問題四:
build/core/config.mk:600: *** Error: could not find jdk tools.jar at /System/Library/Frameworks/JavaVM.
framework/Versions/Current/Commands/../lib/tools.jar, please check if your JDK was installed correctly. Stop.
解決方式:
找到:build/core/config.mk:600
找到:sh檔案:
讓ANDROID_JAVA_HOME = JAVA_HOME
問題五:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
解決方式:
將xcode切換為老版本
問題六:
FAILED: setup-jack-server
Jack server installation not found
到prebuilts/sdk/tools 目錄下執行一下這個命令:
./jack-admin install-server jack-launcher.jar jack-server-4.11.ALPHA.jar
問題七:
模擬器黑屏問題
emulator -kernel /Volumes/android/android-source/prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -system system.img -data userdata.img -ramdisk ramdisk.img
又會提示:
New emulator backend requires minimum kernel version 3.10+ (currently got lower)
Please make sure you've got updated system images and do not force the specific kernel
image together with the engine version
(新的模擬器後端需要最小核心版本3.10 +(當前更低)請確保您已經獲得了更新的系統映像,並且不要將特定核心映像與引擎版本一起強制。)
emulator -partition-size 1024 -skin WVGA854
編譯完成後啟動虛擬機器時,卡在黑屏,嘗試編譯aosp_arm64-eng解決.因此,這裡我使用了aosp_arm64-eng
問題八:
error: ro.build.fingerprint cannot exceed 91 bytes: Android/mini_emulator_x86/mini-emulator-x86:8.0.0/OPR6.170623.013/jkerte05091121:userdebug/test-keys (100)
1:編輯build/tools/post_process_props.py。換行如下:
PROP_NAME_MAX = 31
# PROP_VALUE_MAX = 91
PROP_VALUE_MAX = 128
2:編輯bionic/libc/include/sys/system_properties.h。換行如下:
#define PROP_NAME_MAX 32
// #define PROP_VALUE_MAX 92
#define PROP_VALUE_MAX 128
3:做
make clean
make
您也可以使用如下語法並行執行第二個make命令
make -j8
問題九:
frameworks/native/cmds/installd/installd.cpp:43:1: error: static_assert failed "Size mismatch."
frameworks/native/cmds/installd/installd_deps.h
// LY mod
// constexpr size_t kPropertyValueMax = 92u;
constexpr size_t kPropertyValueMax = 128u;
8.0配置:PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=mini_emulator_x86
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-17.5.0-x86_64-i386-64bit
HOST_BUILD_TYPE=release
BUILD_ID=OPR6.170623.013
OUT_DIR=out
lunch目錄:
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng7. full_fugu-userdebug
8. aosp_fugu-userdebug
9. car_emu_arm64-userdebug
10. car_emu_arm-userdebug
11. car_emu_x86-userdebug
12. car_emu_x86_64-userdebug
13. mini_emulator_arm64-userdebug
14. m_e_arm-userdebug
15. m_e_mips-userdebug
16. m_e_mips64-eng
17. mini_emulator_x86-userdebug
18. mini_emulator_x86_64-userdebug
19. aosp_dragon-userdebug
20. aosp_dragon-eng
21. aosp_marlin-userdebug
22. aosp_marlin_svelte-userdebug
23. aosp_sailfish-userdebug
24. aosp_angler-userdebug
25. aosp_bullhead-userdebug
26. aosp_bullhead_svelte-userdebug
27. hikey-userdebug