macOS Ventura(13.6)/macOS Sonoma(14.0)编译Android 10.0/Android 11.0源码过程总结(MacBook Pro 2023-Apple M2 Pro)

前置条件


  • macOS Ventura(13.6)/macOS Sonoma(14.0) MacBook Pro 2023-Apple M2 Pro (4能效核、8性能核、32GB内存、2TB磁盘)
  • Homebrew (4.0.28 或更高版本)
  • Xcode Version 15.0 (15A240d)
  • Android Studio Giraffe | 2022.3.1 Patch 1

从Intel版本MacBook Pro迁移到MacBook Pro 2023(Apple M2 Pro)的设备,参考 从Intel版本MacBook Pro 2013迁移到MacBook Pro 2023(Apple M2 Pro)后HomeBrew报错"Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)" 重新安装 Homebrew

根据 Google 官方文档,2021年6月22日之后的Android系统版本不支持在macOS系统上构建,我们在 Applic SiliconmacOS 系统是不能直接成功构建后续版本的,但是之前的版本可以在修改编译配置后成功编译。

尝试过使用 Podman Desktop / Docker 方式进行编译、也尝试过借助 OrbStackLima 这些纯虚拟机通过安装 ubuntu 22.04 系统镜像的方式进行编译,结果都在执行 lunch 命令的时候长时间卡住,观察系统进程发现名为 nsjail 进程的 CPU 占用持续卡住在 100% 上无法继续编译,并且由于 Docker 或者虚拟机文件系统是 Linux 文件系统,而宿主机的文件系统是 AppleFS 文件系统,导致需要进行文件转换,中间的转换性能代价非常高,性能很差。

通过 UTM 虚拟机,使用 MacOS 提供的虚拟机执行编译的话,性能会更好。但是目前测试发现存在严重的文件系统缺陷,编译/大量文件复制过程中,经常出现文件系统损坏,导致编译失败。

需要在 M2 上使用UTM 虚拟机编译的,可以参考 macOS Sonoma(14.1.1)通过UTM虚拟机编译Android 11.0源码过程总结(MacBook Pro 2023-Apple M2 Pro) 通过 UTM 虚拟机借助 Rosetta 2 的方式进行编译。目前测试来看,性能勉强能用。

另外,我们需要安装 Rosetta 2 支持运行部分 x86_64 应用。注意  Rosetta 2 只支持 64 位应用,不支持 32 位应用。 参考 Does Rosetta 2 support 32-bit Intel apps?

Important: Platform development on MacOS isn't supported as of June 22, 2021.

准备环境


创建大小写敏感分区

创建大小写敏感的 APFS 卷宗,相对于文件镜像,性能更好,尤其是针对 TimeMachine 更加友好。参考如下命令:

$ diskutil apfs addVolume disk1 'Case-sensitive APFS' aosp
安装依赖
# macOS 14.0 系统上貌似没有自带Python,需要手工额外安装
$ brew install python

$ xcode-select --install

# 安装 Rosetta 2 x86应用运行	 
$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
代码拉取&构建

1.使用镜像下载Android源代码

清华大学的镜像

# 建议直接下载压缩包,使用repo更新基本上都会失败,即使用国内镜像也是一样(目前大约96GB)

# 不建议直接在aosp根目录下直接操作,由于APFS创建的卷宗根目录下会放置回收站 .Trashes 因此编译的时候可能会报错: 
# opendir failed: .Trashes: Operation not permitted 

# 建议通过直接清华源的镜像压缩包进行代码同步
# 不要通过 repo sync 进行,目前测试发现 repo sync 成功的概率越来越低了
$ curl -OC - https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar

$ tar xvf aosp-latest.tar

$ cd aosp

2.Android 模拟器编译(必选)

# macOS可以执行的模拟器对应分支 emu-34-release 

$ repo init -b emu-master-dev

# 可能会失败多次,不断尝试,直到完全成功
$ repo sync -j4 --fail-fast

$ cd external/qemu && android/rebuild.sh

# 拷贝出刚刚编译好的文件,为后续编译系统镜像进行准备
# 后续编译系统镜像,需要还原代码,如果不进行提前备份,会导致编译后的文件丢失
$ mv objs /Volumes/aosp/emu

如果报错:

$ cd external/qemu && android/rebuild.sh
cmake.py --ccache auto
Running Clean: Deletes the destination directory.
Running Configure: Runs the CMake Ninja generator.
Configure target: darwin-aarch64, native compilation
Run: /Volumes/aosp/aosp/prebuilts/cmake/darwin-x86/bin/cmake -B/Volumes/aosp/aosp/external/qemu/android/objs -G Ninja -DOPTION_CRASHUPLOAD=NONE -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/Volumes/aosp/aosp/external/qemu/android/build/cmake/toolchain-darwin-aarch64.cmake -DOPTION_SDK_TOOLS_BUILD_NUMBER=standalone-0 -DPython_EXECUTABLE=/Volumes/aosp/aosp/external/qemu/android/../../../prebuilts/python/darwin-x86/bin/python3 -DCLANG_COMPILER_VERSION=clang-r487747c -DRUST_COMPILER_VERSION=1.71.0 -DQTWEBENGINE=True -DOPTION_CCACHE=/Volumes/aosp/aosp/prebuilts/android-emulator-build/common/sccache/darwin-x86_64/sccache /Volumes/aosp/aosp/external/qemu -DOPTION_SDK_TOOLS_REVISION=34.1.3 -DOPTION_TEST_LOGS=/Volumes/aosp/aosp/external/qemu/android/objs/testlogs in None
Running /Volumes/aosp/aosp/external/qemu/android/scripts/unix/gen-android-sdk-toolchain.sh '--host=darwin-aarch64' '/Volumes/aosp/aosp/external/qemu/android/objs/toolchain' '' '--aosp-dir=/Volumes/aosp/aosp' '--aosp-clang_ver=clang-r487747c' '--verbosity=2'
CMake Error at android/build/cmake/toolchain.cmake:59 (message):
Unable to retrieve sdk info from
/Volumes/aosp/aosp/external/qemu/android/scripts/unix/gen-android-sdk-toolchain.sh
--host=darwin-aarch64
/Volumes/aosp/aosp/external/qemu/android/objs/toolchain : Using AOSP dir:
/Volumes/aosp/aosp

Detected OPT_HOST darwin-aarch64

Setting BUILD_ARCH to aarch64

OSX: Installed SDKs: 10.	macOS 14.0 	-sdk macosx14.0 10.	macOS 14.0 	-sdk
macosx14.0

OSX: Using SDK version

, ERROR: No supported OSX SDKs found on the machine (Need any of: [10.11
10.12 10.13 10.14 10.15 10.16 11.0 11.1 11.2 11.3 11.4 11.5 11.6 12.0 12.1
12.3 13.0 13.1 13.3], have: [10.	macOS 14.0 	-sdk macosx14.0 10.	macOS 14.0
-sdk macosx14.0 ])

Call Stack (most recent call first):
android/build/cmake/toolchain.cmake:99 (toolchain_cmd)
android/build/cmake/toolchain.cmake:152 (toolchain_generate_internal)
android/build/cmake/toolchain-darwin-aarch64.cmake:52 (toolchain_generate)
/Volumes/aosp/aosp/prebuilts/cmake/darwin-x86/share/cmake-3.23/Modules/CMakeDetermineSystem.cmake:124 (include)
CMakeLists.txt:2 (project)


CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Build failure due to /Volumes/aosp/aosp/prebuilts/cmake/darwin-x86/bin/cmake -B/Volumes/aosp/aosp/external/qemu/android/objs -G Ninja -DOPTION_CRASHUPLOAD=NONE -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/Volumes/aosp/aosp/external/qemu/android/build/cmake/toolchain-darwin-aarch64.cmake -DOPTION_SDK_TOOLS_BUILD_NUMBER=standalone-0 -DPython_EXECUTABLE=/Volumes/aosp/aosp/external/qemu/android/../../../prebuilts/python/darwin-x86/bin/python3 -DCLANG_COMPILER_VERSION=clang-r487747c -DRUST_COMPILER_VERSION=1.71.0 -DQTWEBENGINE=True -DOPTION_CCACHE=/Volumes/aosp/aosp/prebuilts/android-emulator-build/common/sccache/darwin-x86_64/sccache /Volumes/aosp/aosp/external/qemu -DOPTION_SDK_TOOLS_REVISION=34.1.3 -DOPTION_TEST_LOGS=/Volumes/aosp/aosp/external/qemu/android/objs/testlogs Status: 1 != 0

则说明编译器版本太高,当前的编译配置中缺少指定版本的SDK导致的。

则在源代码代码目录下的 external/qemu/android/scripts/unix/gen-android-sdk-toolchain.sh 文件中找到 prepare_build_for_darwin / prepare_build_for_darwin_aarch64 这两个函数,然后在其中的 OSX_SDK_SUPPORTED 变量列表中增加 14.0 版本,如下:

# Configure the darwin toolchain.
prepare_build_for_darwin() {
    OSX_VERSION=$(sw_vers -productVersion)
    OSX_DEPLOYMENT_TARGET=10.11
    OSX_REQUIRED=10.13
    MIN_XCODE=10
    OSX_DESIRED=12.2

    # This is the list of supported SDKs,
    OSX_SDK_SUPPORTED="${OSX_REQUIRED} 10.15 10.16 11.0 11.1 11.2 11.3 11.4 11.5 11.6 12.0 12.1 12.3 13.0 13.1 13.3 14.0"
    OSX_XCODE=$(xcodebuild -version | tr '\n' ' ')
    OSX_SDK_INSTALLED_LIST=$(xcodebuild -showsdks 2>/dev/null | \
            egrep --color=never -o " macosx\d+.\d+$" | sed -e "s/.*macosx//g" | sort -n | \
            tr '\n' ' ')
    if [ -z "$OSX_SDK_INSTALLED_LIST" ]; then
        panic "Please install XCode on this machine!"
    fi
    log "OSX: Installed SDKs: $OSX_SDK_INSTALLED_LIST"
    for supported_sdk in $(echo "$OSX_SDK_SUPPORTED" | tr ' ' '\n' | sort -r)
    do
        POSSIBLE_OSX_SDK_VERSION=$(echo "$OSX_SDK_INSTALLED_LIST" | tr ' ' '\n' | grep $supported_sdk | head -1)
        if [ -n "$POSSIBLE_OSX_SDK_VERSION" ]; then
            OSX_SDK_VERSION=$POSSIBLE_OSX_SDK_VERSION
        fi
    done

    # Extract the Xcode version, and use version sort to stack the installed version
    # on top of what you have. If your version is to low it ends up on top.
    OSX_XCODE_VERSION=$(xcodebuild -version | egrep 'Xcode (\d+.\d+)' | sed 's/Xcode //g')
    VERSION_SORT=$(printf "$MIN_XCODE\n$OSX_XCODE_VERSION" | sort --version-sort | head -n 1)

    if test "$VERSION_SORT" != "$MIN_XCODE"; then
        log "You need to have at least XCode 10 installed, not ${OSX_XCODE}"
        please_install_proper_sdk_error
    fi

    XCODE_PATH=$(xcode-select -print-path 2>/dev/null)

    log "OSX: Using ${OSX_XCODE} with SDK version $OSX_SDK_VERSION"
    log "OSX: XCode path: $XCODE_PATH"

    if [ -z "$OSX_SDK_VERSION" ]; then
        please_install_proper_sdk_error
    fi

    OSX_SDK_ROOT=$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk
    log2 "OSX: Looking for $OSX_SDK_ROOT"
    if [ ! -d "$OSX_SDK_ROOT" ]; then
        OSX_SDK_ROOT=/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk
        log2 "OSX: Looking for $OSX_SDK_ROOT"
        if [ ! -d "$OSX_SDK_ROOT" ]; then
            please_install_proper_sdk_error
        fi
    fi
    log "OSX: Using SDK at $OSX_SDK_ROOT"
    EXTRA_ENV_SETUP="export SDKROOT=$OSX_SDK_ROOT"
    CLANG_BINDIR=$PREBUILT_TOOLCHAIN_DIR/bin
    PREBUILT_TOOLCHAIN_DIR=

    GNU_CONFIG_HOST=

    common_FLAGS="-target x86_64-apple-darwin12.0.0"
    var_append common_FLAGS " -isysroot $OSX_SDK_ROOT"
    var_append common_FLAGS " -mmacosx-version-min=$OSX_DEPLOYMENT_TARGET"
    var_append common_FLAGS " -DMACOSX_DEPLOYMENT_TARGET=$OSX_DEPLOYMENT_TARGET"
    EXTRA_CFLAGS="$common_FLAGS -B/usr/bin"
    EXTRA_CXXFLAGS="$common_FLAGS -B/usr/bin"
    var_append EXTRA_CXXFLAGS "-stdlib=libc++"
    EXTRA_LDFLAGS="$common_FLAGS"
    DST_PREFIX=
}

prepare_build_for_darwin_aarch64() {
    # Use system clang
    CLANG_BINDIR=
    CLANG_DIR=
    GNU_CONFIG_HOST=
    CLANG_VERSION=
    SYSROOT="/"

    OSX_VERSION=$(sw_vers -productVersion)
    OSX_DEPLOYMENT_TARGET=10.16
    OSX_SDK_SUPPORTED="10.11 10.12 10.13 10.14 10.15 10.16 11.0 11.1 11.2 11.3 11.4 11.5 11.6 12.0 12.1 12.3 13.0 13.1 13.3 14.0"
    OSX_SDK_INSTALLED_LIST=$(xcodebuild -showsdks 2>/dev/null | \
            grep --color=never macosx | sed -e "s/.*macosx10\.//g" | sort -n | \
            sed -e 's/^/10./g' | tr '\n' ' ')
    if [ -z "$OSX_SDK_INSTALLED_LIST" ]; then
        panic "Please install XCode on this machine!"
    fi
    log "OSX: Installed SDKs: $OSX_SDK_INSTALLED_LIST"
    for supported_sdk in $(echo "$OSX_SDK_SUPPORTED" | tr ' ' '\n' | sort -r)
    do
        POSSIBLE_OSX_SDK_VERSION=$(echo "$OSX_SDK_INSTALLED_LIST" | tr ' ' '\n' | grep $supported_sdk | head -1)
        if [ -n "$POSSIBLE_OSX_SDK_VERSION" ]; then
            OSX_SDK_VERSION=$POSSIBLE_OSX_SDK_VERSION
        fi
    done
    log "OSX: Using SDK version $OSX_SDK_VERSION"
    if [ -z "$OSX_SDK_VERSION" ]; then
        panic "No supported OSX SDKs found on the machine (Need any of: [$OSX_SDK_SUPPORTED], have: [$OSX_SDK_INSTALLED_LIST])"
    fi

    XCODE_PATH=$(xcode-select -print-path 2>/dev/null)
    log "OSX: XCode path: $XCODE_PATH"

    OSX_SDK_ROOT=$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk
    log "OSX: Looking for $OSX_SDK_ROOT"
    if [ ! -d "$OSX_SDK_ROOT" ]; then
        OSX_SDK_ROOT=/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk
        log "OSX: Looking for $OSX_SDK_ROOT"
        if [ ! -d "$OSX_SDK_ROOT" ]; then
            panic "Could not find SDK $OSX_SDK_VERSION at $OSX_SDK_ROOT"
        fi
    fi
    log "OSX: Using SDK at $OSX_SDK_ROOT"
    EXTRA_ENV_SETUP="export SDKROOT=$OSX_SDK_ROOT"
    PREBUILT_TOOLCHAIN_DIR=

    GNU_CONFIG_HOST=

    common_FLAGS="-target arm64-apple-darwin20.0.0"
    var_append common_FLAGS " -isysroot $OSX_SDK_ROOT"
    var_append common_FLAGS " -DMACOSX_DEPLOYMENT_TARGET=$OSX_DEPLOYMENT_TARGET"
    EXTRA_CFLAGS="$common_FLAGS -B/usr/bin"
    EXTRA_CXXFLAGS="$common_FLAGS -B/usr/bin"
    var_append EXTRA_CXXFLAGS "-stdlib=libc++"
    var_append EXTRA_CXXFLAGS "--std=c++17"
    EXTRA_LDFLAGS="$common_FLAGS"
    DST_PREFIX=
}

修改完成后,继续执行上述的编译命令即可。

3.编译源代码

# 撤销由于编译模拟器而进行的代码修复,否则无法成功切换代码分支
$ rm -rf /Volumes/aosp/aosp/external/

# 切换目录
$ cd /Volumes/aosp/aosp

# 查看分支
# cd .repo/manifests
# git branch -a | grep "android-11"

#  检出代码代码
# repo init -b android-10.0.0_r47

$ repo init -b android-security-11.0.0_r72

$ repo sync -j4 --fail-fast

# 执行构建
$ source build/envsetup.sh

# too many open files 
$ ulimit -S -n 4096

# 默认编译的镜像是 release 模式的,运行速度更快,但是不方便系统调试
# 如果需要跟踪调试代码,建议编译为调试类型 
# export TARGET_BUILD_TYPE=debug

# 纯ARM64系统镜像,可以刷机
# lunch aosp_arm64-eng

# eng:代表 engineer,开发工程师的版本,拥有最大的权限(root等),具有额外调试工具的开发配置。 
# 执行 lunch 命令可以输出全部的编译目标列表 
# 更多的编译选项可以从 build/make/target/product/ 下看到 

# 模拟器使用的系统镜像
# lunch sdk_phone_arm64-userdebug

$ lunch sdk_phone_arm64-eng

$ export USE_CCACHE=1  

$ m

如果报错:

repo reset: 错误:Entry '.flake8' not uptodate. Cannot merge.
致命错误:不能重置索引文件至版本 'v2.37^0'。

则手工删除 .flake8 这个目录,重新同步。

执行如下命令:

# find . -name .flake8

$ rm -rf ./.repo/repo/.flake8

如果报错:

info: A new version of repo is available
warning: repo is not tracking a remote branch, so it will not receive updates
repo reset: 错误:Entry 'README.md' not uptodate. 
Cannot merge. 致命错误:不能重置索引文件至版本 'v2.37^0'。

则说明当前的 repo 版本太低,需要更新到最新版本。

执行如下命令:

$ cd .repo/repo

$ git pull

如果报错:

error: external/qemu: Cannot remove project: uncommittedchanges are present.


error: Local checkouts *not* updated.
Traceback (most recent call last):
  File "/Volumes/aosp/aosp/.repo/repo/subcmds/sync.py", line 1737, in _ExecuteHelper
    self.UpdateProjectList(opt, m)
  File "/Volumes/aosp/aosp/.repo/repo/subcmds/sync.py", line 1267, in UpdateProjectList
    project.DeleteWorktree(
  File "/Volumes/aosp/aosp/.repo/repo/project.py", line 1777, in DeleteWorktree
    raise DeleteDirtyWorktreeError(msg, project=self)
project.DeleteDirtyWorktreeError: error: external/qemu: Cannot remove project: uncommittedchanges are present.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Volumes/aosp/aosp/.repo/repo/main.py", line 416, in execute_command
    execute_command_helper()
  File "/Volumes/aosp/aosp/.repo/repo/main.py", line 382, in execute_command_helper
    result = cmd.Execute(copts, cargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/aosp/aosp/.repo/repo/subcmds/sync.py", line 1598, in Execute
    self._ExecuteHelper(opt, args, errors)
  File "/Volumes/aosp/aosp/.repo/repo/subcmds/sync.py", line 1749, in _ExecuteHelper
    raise SyncFailFastError(aggregate_errors=errors)
subcmds.sync.SyncFailFastError

则需要撤销由于编译模拟器而进行的代码修复,否则无法成功切换代码分支,执行如下命令:

$ cd /Volumes/aosp/aosp/external/qemu

$ rm -rf qemu

如果报错:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=aosp_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-22.6.0-x86_64-13.6
HOST_BUILD_TYPE=release
BUILD_ID=RD2A.211001.002
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera
============================================
[ 94% 171/181] test android/soong/cc
FAILED: out/soong/.bootstrap/soong-cc/test/test.passed
out/soong/.bootstrap/bin/gotestrunner -p ./build/soong/cc -f out/soong/.bootstrap/soong-cc/test/test.passed -- out/soong/.bootstrap/soong-cc/test/test -test.short
--- FAIL: TestDefaults (36.06s)
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3075: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestDoubleLoadbleDep (0.04s)
    cc_test.go:733: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:733: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:733: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestEnforceProductVndkVersion (0.05s)
    cc_test.go:1869: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1869: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1869: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestEnforceProductVndkVersionErrors (0.13s)
    cc_test.go:119: missing the expected error "Vendor module that is not VNDK should not link to \".*\" which is marked as `vendor_available: false`" (checked 6 error(s))
    cc_test.go:119: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestErrorsIfAModuleDependsOnDisabled (0.04s)
    cc_test.go:110: missing the expected error "module \"libA\" .* depends on disabled module \"libB\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestExcludeRuntimeLibs (0.04s)
    cc_test.go:2623: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2623: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2623: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestFuchsiaDeps (0.02s)
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:145: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestFuchsiaTargetDecl (0.01s)
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:182: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestFuzzTarget (0.04s)
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3034: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestGen (0.07s)
    --- FAIL: TestGen/simple (0.03s)
        gen_test.go:25: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:25: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:25: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestGen/filegroup (0.04s)
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        gen_test.go:43: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestLibraryHeaders (0.03s)
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestLibraryReuse (0.21s)
    --- FAIL: TestLibraryReuse/simple (0.03s)
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestLibraryReuse/extra_static_source (0.03s)
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:52: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestLibraryReuse/extra_shared_source (0.03s)
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:78: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestLibraryReuse/extra_static_cflags (0.03s)
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:104: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestLibraryReuse/extra_shared_cflags (0.03s)
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:130: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestLibraryReuse/global_cflags_for_reused_generated_sources (0.04s)
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        library_test.go:156: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestLinkerScript (0.03s)
    --- FAIL: TestLinkerScript/script (0.03s)
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        object_test.go:23: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestLlndkHeaders (0.04s)
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2507: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestLlndkLibrary (0.04s)
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2479: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestMakeLinkType (0.04s)
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2026: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestPrebuilt (0.03s)
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestPrebuiltLibrary (0.03s)
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestPrebuiltLibraryHeaders (0.04s)
    library_headers_test.go:44: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:44: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_headers_test.go:44: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestPrebuiltLibraryShared (0.03s)
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestPrebuiltLibraryStatic (0.03s)
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    prebuilt_test.go:171: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestProductVariableDefaults (0.04s)
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:3169: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestProductVndkExtDependency (0.05s)
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1577: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestProto (0.07s)
    --- FAIL: TestProto/simple (0.03s)
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:26: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    --- FAIL: TestProto/plugin (0.04s)
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
        proto_test.go:40: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestRecovery (0.03s)
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2838: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestRuntimeLibs (0.04s)
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2600: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestRuntimeLibsNoVndk (0.03s)
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2635: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStaticDepsOrderWithStubs (0.03s)
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2974: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStaticExecutable (0.03s)
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2949: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStaticLibDepExport (0.04s)
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2672: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStaticLibDepReordering (0.03s)
    cc_test.go:2396: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2396: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2396: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStaticLibDepReorderingWithShared (0.04s)
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestStubsVersions (0.03s)
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    library_test.go:204: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVendorModuleUseVndkExt (0.04s)
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1403: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVendorPublicLibraries (0.04s)
    cc_test.go:2772: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2772: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2772: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVendorSnapshot (0.04s)
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:891: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVendorSrc (0.04s)
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:194: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVersionedStubs (0.04s)
    cc_test.go:2873: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2873: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:2873: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndk (0.04s)
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:374: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkDepError (0.25s)
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 3 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExt (0.05s)
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1151: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExtInconsistentSupportSystemProcessError (0.07s)
    cc_test.go:110: missing the expected error "module \".*\" with mismatched support_system_process" (checked 3 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" with mismatched support_system_process" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExtUseVendorLib (0.04s)
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1455: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExtVendorAvailableFalseError (0.08s)
    cc_test.go:110: missing the expected error "`extends` refers module \".*\" which does not have `vendor_available: true`" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: missing the expected error "`extends` refers module \".*\" which does not have `vendor_available: true`" (checked 3 error(s))
    cc_test.go:119: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:119: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExtWithoutBoardVndkVersion (0.03s)
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1165: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkExtWithoutProductVndkVersion (0.04s)
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:1195: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkLibrariesTxtAndroidMk (0.03s)
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:475: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkSpExtUseVndkError (0.08s)
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkUseVndkExtError (0.11s)
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: missing the expected error "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"" (checked 6 error(s))
    cc_test.go:110: errs[0] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[1] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[2] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[3] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[4] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:110: errs[5] = "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkUsingCoreVariant (0.04s)
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:524: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkWhenVndkVersionIsNotSet (0.03s)
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:530: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
--- FAIL: TestVndkWithHostSupported (0.04s)
    cc_test.go:434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
    cc_test.go:434: "Could not find a supported mac sdk: [\"10.10\" \"10.11\" \"10.12\" \"10.13\" \"10.14\" \"10.15\"]"
FAIL
13:08:47 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

#### failed to build some targets (56 seconds) ####

则需要查看自己电脑上安装的 MacOSX.sdk ,执行如下命令:

$ ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs

MacOSX.sdk	MacOSX14.0.sdk	MacOSX14.sdk

然后在 build/soong/cc/config/x86_darwin_host.go 文件中找到 "darwinSupportedSdkVersions" 添加 MacOSX.sdk 对应的版本号 14.0 。如下:

	darwinSupportedSdkVersions = []string{
		"10.10",
		"10.11",
		"10.12",
		"10.13",
		"10.14",
		"10.15",
		"14.0",
	}

如果报错:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=aosp_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-22.6.0-x86_64-13.6
HOST_BUILD_TYPE=release
BUILD_ID=RD2A.211001.002
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera
============================================
[100% 96/96] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
error: external/v8/Android.bp:181:16: module "v8_bytecode_builtins_list_generator" variant "darwin_x86_64": host_ldlibs: Host library `-lrt` not available
error: external/v8/Android.bp:209:16: module "v8_torque" variant "darwin_x86_64": host_ldlibs: Host library `-lrt` not available
13:35:34 soong bootstrap failed with: exit status 1

#### failed to build some targets (02:35 (mm:ss)) ####

问题参考 https://stackoverflow.com/questions/47703239/ld-library-not-found-for-lrt,在旧的 Linux 系统中有 -lrtGNU libc 使用,但是在新的 glibc (after 2.17 from 2013) 之后就没有这个了。解决办法为在 external/v8/Android.bp 找到 -lrt 这一行,把整行全部注释掉。

host_ldlibs: ["-lrt"]

可以简单的执行如下命令:

$ sed -i "" "s/host_ldlibs/\/\/host_ldlibs/g" external/v8/Android.bp

如果报错:

[ 11% 13787/118866] //system/core/base:libbase clang++ cmsg.cpp [darwin]
FAILED: out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o
 prebuilts/clang/host/darwin-x86/clang-r383902b1/bin/clang++ -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.10 -DMACOSX_DEPLOYMENT_TARGET=10.10 -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang   -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -DANDROID_STRICT -fPIC -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next   -Isystem/core/base -Isystem/core/base/include -Iexternal/fmtlib/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Isystem/core/liblog/include -Wall -Werror -Wextra -std=gnu++17 -Wexit-time-destructors -D_LIBCPP_DISABLE_AVAILABILITY -nostdinc++ -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o.d -o out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o system/core/base/cmsg.cpp
system/core/base/cmsg.cpp:36:21: error: use of undeclared identifier 'PAGE_SIZE'
  if (cmsg_space >= PAGE_SIZE) {
                    ^
system/core/base/cmsg.cpp:78:21: error: use of undeclared identifier 'PAGE_SIZE'
  if (cmsg_space >= PAGE_SIZE) {
                    ^
2 errors generated.
[ 11% 13800/118866] //bionic/libc:common_libc versioner preprocess include
warning: attempted to generate guard with empty availability: obsoleted = 21
warning: attempted to generate guard with empty availability: obsoleted = 23
14:02:47 ninja failed with: exit status 1

#### failed to build some targets (06:36 (mm:ss)) ####

则参考 satckoverflow 上的说明,直接在 system/core/base/include/android-base/cmsg.h 中增加 PAGE_SIZE 定义,如下:

#ifndef PAGE_SIZE
  #define PAGE_SIZE (size_t)(sysconf(_SC_PAGESIZE))
#endif

修改后的结果大致如下:

 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#ifndef PAGE_SIZE
  #define PAGE_SIZE (size_t)(sysconf(_SC_PAGESIZE))
#endif

#include <sys/stat.h>
#include <sys/types.h>

#include <type_traits>
#include <vector>

#include <android-base/collections.h>
#include <android-base/macros.h>
#include <android-base/unique_fd.h>

namespace android {
namespace base {

#if !defined(_WIN32)

如果报错:

[ 32% 41640/129245] //external/icu/icu4c/source/i18n:libicui18n clang++ choicfmt.cpp [darwin]
FAILED: out/soong/.intermediates/external/icu/icu4c/source/i18n/libicui18n/darwin_x86_64_static/obj/external/icu/icu4c/source/i18n/choicfmt.o
 prebuilts/clang/host/darwin-x86/clang-r383902b1/bin/clang++ -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.10 -DMACOSX_DEPLOYMENT_TARGET=10.10 -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang   -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -fPIC -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next   -Iexternal/icu/icu4c/source/i18n -Iexternal/icu/icu4c/source/i18n -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Iexternal/icu/icu4c/source/common -Iexternal/icu/android_icu4c/include -D_REENTRANT -DU_I18N_IMPLEMENTATION -O3 -fvisibility=hidden -Wall -Werror -Wno-unused-parameter -Wno-unused-const-variable -Wno-unneeded-internal-declaration -std=gnu++17 -std=c++11 -D_LIBCPP_DISABLE_AVAILABILITY -nostdinc++ -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/soong/.intermediates/external/icu/icu4c/source/i18n/libicui18n/darwin_x86_64_static/obj/external/icu/icu4c/source/i18n/choicfmt.o.d -o out/soong/.intermediates/external/icu/icu4c/source/i18n/libicui18n/darwin_x86_64_static/obj/external/icu/icu4c/source/i18n/choicfmt.o external/icu/icu4c/source/i18n/choicfmt.cpp
external/icu/icu4c/source/i18n/choicfmt.cpp:178:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(temp, "%.*g", DBL_DIG, value);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
14:21:22 ninja failed with: exit status 1

#### failed to build some targets (10:39 (mm:ss)) ####

则需要在编译配置文件( build/soong/cc/config/x86_darwin_host.go )中的  "darwinCflags" 配置中,增加对 sprintf 不安全的警告的忽略( -Wno-deprecated-declarations ),如下:

	darwinCflags = []string{
		"-fdiagnostics-color",

		"-fPIC",
		"-funwind-tables",

		// Workaround differences in inttypes.h between host and target.
		//See bug 12708004.
		"-D__STDC_FORMAT_MACROS",
		"-D__STDC_CONSTANT_MACROS",

		"-isysroot ${macSdkRoot}",
		"-mmacosx-version-min=${macMinVersion}",
		"-DMACOSX_DEPLOYMENT_TARGET=${macMinVersion}",
		
		"-Wno-deprecated-declarations",

		"-m64",
	}

如果报错:

[ 25% 24348/93680] //external/python/cpython2:py2-launcher-lib clang Modules/getpath.c [darwi
FAILED: out/soong/.intermediates/external/python/cpython2/py2-launcher-lib/darwin_x86_64_static/obj/external/python/cpython2/Modules/getpath.o
 prebuilts/clang/host/darwin-x86/clang-r383902b1/bin/clang -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.10 -DMACOSX_DEPLOYMENT_TARGET=10.10 -Wno-deprecated-declarations -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang   -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -fPIC  -Iexternal/python/cpython2/darwin_x86_64/pyconfig -Iexternal/python/cpython2/Include -Iexternal/python/cpython2 -Iexternal/sqlite/dist -Isystem/core/base/include -Iexternal/fmtlib/include -Iexternal/boringssl/src/include -Iexternal/expat/lib -Isystem/core/liblog/include -Iexternal/zlib -Iexternal/libcxx/include -Iexternal/libcxxabi/include -fwrapv -O3 -Wall -Wstrict-prototypes -DPy_BUILD_CORE -Werror -Wno-invalid-source-encoding -Wno-int-conversion -Wno-missing-field-initializers -Wno-null-pointer-arithmetic -Wno-register -Wno-shift-count-overflow -Wno-sign-compare -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-unused-parameter -Wno-unused-result '-DVERSION="2.7"' '-DVPATH=""' '-DPREFIX=""' '-DEXEC_PREFIX=""' '-DPYTHONPATH="..:"' -DANDROID_SKIP_ZIP_PATH -DANDROID_SKIP_EXEC_PREFIX_PATH '-DANDROID_LIB_PYTHON_PATH="internal/stdlib"' '-DDATE="Dec 31 1969"' '-DTIME="23:59:59"' -Wno-deprecated-declarations -Wno-pointer-arith -std=gnu99 -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/soong/.intermediates/external/python/cpython2/py2-launcher-lib/darwin_x86_64_static/obj/external/python/cpython2/Modules/getpath.o.d -o out/soong/.intermediates/external/python/cpython2/py2-launcher-lib/darwin_x86_64_static/obj/external/python/cpython2/Modules/getpath.o external/python/cpython2/Modules/getpath.c
external/python/cpython2/Modules/getpath.c:414:50: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types]
     else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP)
                                                 ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/mach-o/dyld.h:105:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize)                 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
                                                     ^
1 error generated.
15:34:41 ninja failed with: exit status 1

#### failed to build some targets (26:45 (mm:ss)) ####

则需要在编译配置文件( build/soong/cc/config/x86_darwin_host.go )中的  "darwinCflags" 配置中,增加对指针转换安全的警告的忽略( -Wno-incompatible-pointer-types ),如下:

	darwinCflags = []string{
		"-fdiagnostics-color",

		"-fPIC",
		"-funwind-tables",

		// Workaround differences in inttypes.h between host and target.
		//See bug 12708004.
		"-D__STDC_FORMAT_MACROS",
		"-D__STDC_CONSTANT_MACROS",

		"-isysroot ${macSdkRoot}",
		"-mmacosx-version-min=${macMinVersion}",
		"-DMACOSX_DEPLOYMENT_TARGET=${macMinVersion}",
		
		"-Wno-deprecated-declarations",
		"-Wno-incompatible-pointer-types",

		"-m64",
	}

如果报错:

[ 58% 43237/73654] //external/v8:v8_libbase clang++ src/base/platform/platform-linux.cc [darw
FAILED: out/soong/.intermediates/external/v8/v8_libbase/darwin_x86_64_static/obj/external/v8/src/base/platform/platform-linux.o
 prebuilts/clang/host/darwin-x86/clang-r383902b1/bin/clang++ -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.10 -DMACOSX_DEPLOYMENT_TARGET=10.10 -Wno-deprecated-declarations -Wno-incompatible-pointer-types -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang   -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -fPIC -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next   -Iexternal/v8/src -Iexternal/v8 -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Wall -Werror -Wno-endif-labels -Wno-implicit-fallthrough -Wno-import -Wno-format -Wno-unused-variable -Wno-unused-parameter -Wno-unused-private-field -Wno-sign-compare -Wno-missing-field-initializers -Wno-ignored-qualifiers -Wno-undefined-var-template -Wno-non-virtual-dtor -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-missing-braces -fno-exceptions -fvisibility=hidden -fno-rtti -g0 -Os -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ATOMIC_MARKING_STATE -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_SNAPSHOT_COMPRESSION -DV8_NO_ARGUMENTS_ADAPTOR -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -UANDROID -DV8_TARGET_ARCH_X64 -std=gnu++14 -D_LIBCPP_DISABLE_AVAILABILITY -nostdinc++ -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/soong/.intermediates/external/v8/v8_libbase/darwin_x86_64_static/obj/external/v8/src/base/platform/platform-linux.o.d -o out/soong/.intermediates/external/v8/v8_libbase/darwin_x86_64_static/obj/external/v8/src/base/platform/platform-linux.o external/v8/src/base/platform/platform-linux.cc
external/v8/src/base/platform/platform-linux.cc:13:10: fatal error: 'sys/prctl.h' file not found
#include <sys/prctl.h>
         ^~~~~~~~~~~~~
1 error generated.
17:32:25 ninja failed with: exit status 1

#### failed to build some targets (01:49:46 (hh:mm:ss)) ####

原因为2021年1月8日 V8 升级导致的,我们直接强制回退 V8 版本到之前的版本,执行如下命令:

$ cd external/v8

$ git reset --hard 55fc782bb8accc49ae3ed52e6856d55392e2a579

$ cd ../..

$ m

如果报错:

[ 88% 6876/7806] //frameworks/base/tools/aapt:libaapt clang++ CrunchCache.cpp [darwin]
FAILED: out/soong/.intermediates/frameworks/base/tools/aapt/libaapt/darwin_x86_64_static/obj/frameworks/base/tools/aapt/CrunchCache.o
 prebuilts/clang/host/darwin-x86/clang-r383902b1/bin/clang++ -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -mmacosx-version-min=10.10 -DMACOSX_DEPLOYMENT_TARGET=10.10 -Wno-deprecated-declarations -Wno-incompatible-pointer-types -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang   -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -DANDROID_STRICT -fPIC -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next   -Iframeworks/base/tools/aapt -Iframeworks/base/libs/androidfw/include -Iexternal/zlib -Iexternal/libpng -Isystem/core/libutils/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iexternal/expat/lib -Isystem/core/libziparchive/include -Iexternal/googletest/googletest/include -Isystem/core/base/include -Iexternal/fmtlib/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Wall -Werror -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS -D_DARWIN_UNLIMITED_STREAMS -std=gnu++17 -D_LIBCPP_DISABLE_AVAILABILITY -nostdinc++ -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/soong/.intermediates/frameworks/base/tools/aapt/libaapt/darwin_x86_64_static/obj/frameworks/base/tools/aapt/CrunchCache.o.d -o out/soong/.intermediates/frameworks/base/tools/aapt/libaapt/darwin_x86_64_static/obj/frameworks/base/tools/aapt/CrunchCache.o frameworks/base/tools/aapt/CrunchCache.cpp
In file included from frameworks/base/tools/aapt/CrunchCache.cpp:9:
In file included from system/core/libutils/include/utils/Vector.h:23:
In file included from system/core/liblog/include/log/log.h:24:
In file included from external/libcxx/include/stdio.h:108:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/stdio.h:127:2: error: "_DARWIN_UNLIMITED_STREAMS specified, but -mmacosx-version-min version does not support it."
#error "_DARWIN_UNLIMITED_STREAMS specified, but -mmacosx-version-min version does not support it."
 ^
1 error generated.

我们需要修改 frameworks/base/tools/aapt/Android.bp 移除 -D_DARWIN_UNLIMITED_STREAMS 的定义,可以执行如下命令:

$ sed -i "" "s/\"-D_DARWIN_UNLIMITED_STREAMS\"//g" frameworks/base/tools/aapt/Android.bp

如果报错:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=10
TARGET_PRODUCT=sdk_phone_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-23.0.0-x86_64-14.0
HOST_BUILD_TYPE=release
BUILD_ID=QP1A.190711.019
OUT_DIR=out
============================================
[  0% 7/23112] build out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/trebl
FAILED: out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/treble_sepolicy_tests_26.0
/bin/bash -c "(out/host/darwin-x86/bin/treble_sepolicy_tests -l 		out/host/darwin-x86/lib64/libsepolwrap.dylib  -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 	-b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/26.0_mapping.combined.cil 		-o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/built_26.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy 		-u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil 		--fake-treble ) && (touch out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/treble_sepolicy_tests_26.0 )"
/bin/bash: line 1: 77572 Segmentation fault: 11  ( out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/26.0_mapping.combined.cil -o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_26.0_intermediates/built_26.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil --fake-treble )
[  0% 8/23112] build out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/trebl
FAILED: out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0
/bin/bash -c "(out/host/darwin-x86/bin/treble_sepolicy_tests -l 		out/host/darwin-x86/lib64/libsepolwrap.dylib  -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 	-b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/27.0_mapping.combined.cil 		-o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/built_27.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy 		-u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil 		--fake-treble ) && (touch out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0 )"
/bin/bash: line 1: 77571 Segmentation fault: 11  ( out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/27.0_mapping.combined.cil -o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_27.0_intermediates/built_27.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil --fake-treble )
[  0% 9/23112] build out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/trebl
FAILED: out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
/bin/bash -c "(out/host/darwin-x86/bin/treble_sepolicy_tests -l 		out/host/darwin-x86/lib64/libsepolwrap.dylib  -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 	-b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil 		-o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy 		-u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil 		--fake-treble ) && (touch out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0 )"
/bin/bash: line 1: 77573 Segmentation fault: 11  ( out/host/darwin-x86/bin/treble_sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -b out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil -o out/target/product/generic_arm64/obj/ETC/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy -u out/target/product/generic_arm64/obj/ETC/built_plat_sepolicy_intermediates/base_plat_pub_policy.cil --fake-treble )
[  0% 10/23112] build out/target/product/generic_arm64/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests
FAILED: out/target/product/generic_arm64/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests
/bin/bash -c "(out/host/darwin-x86/bin/sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib 		 -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts  -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy ) && (touch out/target/product/generic_arm64/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests )"
/bin/bash: line 1: 77568 Segmentation fault: 11  ( out/host/darwin-x86/bin/sepolicy_tests -l out/host/darwin-x86/lib64/libsepolwrap.dylib -f out/target/product/generic_arm64/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts -f out/target/product/generic_arm64/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts -p out/target/product/generic_arm64/obj/ETC/sepolicy_intermediates/sepolicy )
14:47:16 ninja failed with: exit status 1

#### failed to build some targets (14 seconds) ####

这个问题是由于 macOS 不支持静态链接 libc++ 导致的,需要修改 system/sepolicy/tests/Android.bp ,移除 stl: "libc++_static" 这一行。

可以简单的执行如下命令:

$ sed -i "" "/libc++_static/d" system/sepolicy/tests/Android.bp

如果报错:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=10
TARGET_PRODUCT=sdk_phone_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-23.0.0-x86_64-14.0
HOST_BUILD_TYPE=release
BUILD_ID=QP1A.190711.019
OUT_DIR=out
============================================
[ 50% 1/2] Create system-qemu.img now
FAILED: out/target/product/generic_arm64/system-qemu.img
/bin/bash -c "(export SGDISK=out/host/darwin-x86/bin/sgdisk SIMG2IMG=out/host/darwin-x86/bin/simg2img;      device/generic/goldfish/tools/mk_combined_img.py -i out/target/product/generic_arm64/system-qemu-config.txt -o out/target/product/generic_arm64/system-qemu.img)"
/bin/bash: device/generic/goldfish/tools/mk_combined_img.py: /usr/bin/python: bad interpreter: No such file or directory
[100% 2/2] build check-all-partition-sizes
The sum of sizes of [system vendor] is within BOARD_SUPER_PARTITION_SIZE:
1197776896+85405696 == 1283182592 <=  3229614080 == 3229614080
The sum of sizes of [system vendor] is within BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE:
1197776896+85405696 == 1283182592 <= 3221225472 == 3221225472
The sum of sizes of [emulator_dynamic_partitions] is within BOARD_SUPER_PARTITION_SIZE:
3221225472 == 3221225472 <= 3229614080 == 3229614080
16:28:19 ninja failed with: exit status 1

#### failed to build some targets (15 seconds) ####

这个原因是由于高版本的 macOS Sonoma(14.0) 已经默认不再内置 Python 2(默认内置的是 Python 3 )导致的,我们需要使用转换成 Python 3 格式的脚本。

转换后可用的脚本内容如下:

#!/usr/bin/python3

from __future__ import print_function

import argparse
import codecs
import operator
import os
import sys
from subprocess import Popen, PIPE
from tempfile import mkstemp


def check_sparse(filename):
    magic = 3978755898
    with open(filename, 'rb') as i:
        word = i.read(4)
        if magic == int(codecs.encode(word[::-1], 'hex'), 16):
            return True
    return False


def shell_command(comm_list):
    command = Popen(comm_list, stdout=PIPE, stderr=PIPE)
    command.communicate()
    command.wait()
    if command.returncode != 0:
        sys.exit(1)


def parse_input(input_file):
    parsed_lines = list()
    lines = input_file.readlines()
    for line in lines:
        line = line.strip()
        if not line or line[0] == "#":
            continue
        params = line.split()
        if len(params) == 3:
            for param in params:
                # interprete file paths such as $OUT/system.img
                param = os.path.expandvars(param)
            parsed_lines.append(params)

    partitions = list()
    num_used = set()
    for line in parsed_lines:
        partition_info = dict()
        partition_info["path"] = line[0]
        partition_info["label"] = line[1]
        # round up by 1M
        sizeByMb = str((1024 * 1024 - 1 + os.path.getsize(line[0])) / 1024 / 1024)
        partition_info["sizeByMb"] = sizeByMb

        try:
            partition_info["num"] = int(line[2])
        except ValueError:
            print("'%s' cannot be converted to int" % (line[2]))
            sys.exit(1)

        # check if the partition number is out of range
        if partition_info["num"] > len(lines) or partition_info["num"] < 0:
            print("Invalid partition number: %d, range [1..%d]" % \
                  (partition_info["num"], len(lines)))
            sys.exit(1)

        # check if the partition number is duplicated
        if partition_info["num"] in num_used:
            print("Duplicated partition number:%d" % (partition_info["num"]))
            sys.exit(1)
        num_used.add(partition_info["num"])
        partitions.append(partition_info)

    partitions.sort(key=operator.itemgetter("num"))
    return partitions


def write_partition(partition, output_file, offset):
    # $ dd if=/path/to/image of=/path/to/output conv=notrunc,sync \
    #   ibs=1024k obs=1024k seek=<offset>
    dd_comm = ['dd', 'if=' + partition["path"], 'of=' + output_file, 'conv=notrunc,sync',
               'ibs=1024k', 'obs=1024k', 'seek=' + str(offset)]
    shell_command(dd_comm)
    return


def unsparse_partition(partition):
    # if the input image is in sparse format, unsparse it
    simg2img = os.environ.get('SIMG2IMG', 'simg2img')
    print("Unsparsing %s" % (partition["path"]), end=' ')
    partition["fd"], temp_file = mkstemp()
    shell_command([simg2img, partition["path"], temp_file])
    partition["path"] = temp_file
    print("Done")
    return


def clear_partition_table(filename):
    sgdisk = os.environ.get('SGDISK', 'sgdisk')
    print("%s --clear %s" % (sgdisk, filename))
    shell_command([sgdisk, '--clear', filename])
    return


def add_partition(partition, output_file):
    sgdisk = os.environ.get('SGDISK', 'sgdisk')
    num = str(partition["num"])
    new_comm = '--new=' + num + ':' + partition["start"] + ':' + partition["end"]
    type_comm = '--type=' + num + ':8300'
    name_comm = '--change-name=' + num + ':' + partition["label"]
    # build partition table in order. for example:
    # $ sgdisk --new=1:2048:5244927 --type=1:8300 --change-name=1:system \
    #   /path/to/output
    shell_command([sgdisk, new_comm, type_comm, name_comm, output_file])
    return


def main():
    # check usage:
    parser = argparse.ArgumentParser()
    parser.add_argument("-i", "--input",
                        type=str, help="input configuration file",
                        default="image_config")
    parser.add_argument("-o", "--output",
                        type=str, help="output filename",
                        default=os.environ.get("OUT", ".") + "/combined.img")
    args = parser.parse_args()

    output_filename = os.path.expandvars(args.output)

    # remove the output_filename.qcow2
    print("removing " + output_filename + ".qcow2")
    shell_command(['rm', '-rf', output_filename + ".qcow2"])

    # check input file
    config_filename = args.input
    if not os.path.exists(config_filename):
        print("Invalid config file name " + config_filename)
        sys.exit(1)

    # read input file
    config = open(config_filename, "r")
    partitions = parse_input(config)
    config.close()

    # take a shortcut in build environment
    if os.path.exists(output_filename) and len(partitions) == 2:
        print("updating " + output_filename + " ...")
        shell_command(['dd', "if=" + partitions[0]["path"], "of=" + output_filename,
                       "conv=notrunc,sync", "ibs=1024k", "obs=1024k", "seek=1"])
        shell_command(['dd', "if=" + partitions[1]["path"], "of=" + output_filename,
                       "conv=notrunc,sync", "ibs=1024k", "obs=1024k", "seek=2"])
        print("done")
        sys.exit(0)
    elif len(partitions) == 2:
        gptprefix = partitions[0]["sizeByMb"] + "_" + partitions[1]["sizeByMb"]
        prebuilt_gpt_dir = os.path.dirname(os.path.abspath( __file__ )) + "/prebuilt/gpt/" + gptprefix
        gpt_head = prebuilt_gpt_dir + "/head.img"
        gpt_tail = prebuilt_gpt_dir + "/head.img"
        if os.path.exists(gpt_head) and os.path.exists(gpt_tail):
            print("found prebuilt gpt header and footer, use it")
            shell_command(['dd', "if=" + gpt_head, "of=" + output_filename, "bs=1024k",
                    "conv=notrunc,sync", "count=1"])
            shell_command(['dd', "if=" + partitions[0]["path"], "of=" + output_filename,
                    "bs=1024k", "conv=notrunc,sync", "seek=1"])
            shell_command(['dd', "if=" + partitions[1]["path"], "of=" + output_filename,
                    "bs=1024k", "conv=notrunc,sync", "seek=" + str(1 + int(partitions[0]["sizeByMb"]))])
            shell_command(['dd', "if=" + gpt_tail, "of=" + output_filename,
                    "bs=1024k", "conv=notrunc,sync",
                    "seek=" + str(1 + int(partitions[0]["sizeByMb"]) + int(partitions[1]["sizeByMb"]))])
            print("done")
            sys.exit(0)

    # combine the images
    # add padding
    shell_command(['dd', 'if=/dev/zero', 'of=' + output_filename, 'ibs=1024k', 'count=1'])

    for partition in partitions:
        offset = os.path.getsize(output_filename)
        partition["start"] = str(offset // 512)
        # dectect sparse file format
        if check_sparse(partition["path"]):
            unsparse_partition(partition)

        # TODO: extract the partition if the image file is already formatted

        write_partition(partition, output_filename, offset // 1024 // 1024)
        offset = os.path.getsize(output_filename)
        partition["end"] = str(offset // 512 - 1)

    # add padding
    # $ dd if=/dev/zero of=/path/to/output conv=notrunc bs=1 \
    #   count=1024k seek=<offset>
    offset = os.path.getsize(output_filename) // 1024 // 1024
    shell_command(['dd', 'if=/dev/zero', 'of=' + output_filename,
                   'conv=notrunc', 'bs=1024k', 'count=1', 'seek=' + str(offset)])

    # make partition table
    # $ sgdisk --clear /path/to/output
    clear_partition_table(output_filename)

    for partition in partitions:
        add_partition(partition, output_filename)
        # clean up, delete any unsparsed image files generated
        if 'fd' in partition:
            os.close(partition["fd"])
            os.remove(partition["path"])


if __name__ == "__main__":
    main()
额外的模拟器编译配置

通过上面的修改,我们可以成功编译完成,但是编译出的镜像并能在模拟器中正常加载,运行过程中反复重启,观察运行日志,可以看到如下报错:

[    3.240114] init: Service 'boringssl_self_test32' (pid 154) exited with status 127 waiting took 0.003000 seconds
[    3.241245] init: Sending signal 9 to service 'boringssl_self_test32' (pid 154) process group...
[    3.242340] libprocessgroup: Successfully killed process cgroup uid 0 pid 154 in 0ms
[    3.243225] init: Service with 'reboot_on_failure' option failed, shutting down system.
[    3.244400] init: Clear action queue and start shutdown trigger
[    3.245175] init: Entering shutdown mode
[    3.245652] init: processing action (shutdown_done) from (<Builtin Action>:0)
[    3.246440] apexd (136): highest shadow stack usage: 304 bytes
[    3.246559] init: Reboot start, reason: reboot,boringssl-self-check-failed, reboot_target: boringssl-self-check-failed
[    3.248905] init: Shutdown timeout: 0 ms
[    3.249533] init: Create reboot monitor thread.
[    3.250461] init: shutdown_timeout_timespec.tv_sec: 303
[    3.250633] init: Could not open '/metadata/bootstat/persist.sys.boot.reason' to persist reboot reason: No such file or directory
[    3.252752] init: Reboot ending, jumping to kernel
[    3.253648] cfg80211: failed to load regulatory.db
[    3.311673] reboot: Restarting system with command 'boringssl-self-check-failed'
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x00000000]

根据 android-emulator-m1-preview 的说明,这个原因是由于 Applic Silicon 系列芯片的设备只支持 ARM64 的系统镜像,无法运行 ARM32 系列指令集,我们需要修改编译选项,移除对于 ARM32 指令集的支持。

修改 /Volumes/aosp/aosp/build/make/target/board/emulator_arm64/BoardConfig.mk 文件,注释掉 ARM 指令的支持,修改后的代码如下:

# arm64 emulator specific definitions
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := arm64-v8a

# TARGET_2ND_ARCH := arm
# TARGET_2ND_CPU_ABI := armeabi-v7a
# TARGET_2ND_CPU_ABI2 := armeabi

继续执行编译,报错如下:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=sdk_phone_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-22.6.0-x86_64-13.6
HOST_BUILD_TYPE=release
BUILD_ID=RD2A.211001.002
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
build/make/target/board/emulator_arm64/BoardConfig.mk was modified, regenerating...
out/soong/make_vars-sdk_phone_arm64.mk was modified, regenerating...
[  5% 12/221] including art/Android.mk ...
art/build/Android.common.mk:51: warning: unsupported HOST_ARCH=x86_64
[ 99% 226/227] finishing build rules ...
FAILED: 
platform_testing/build/tasks/tests/native_test_list.mk: error: continuous_native_tests: Unknown installed file for module 'resolv_gold_test' 
In file included from build/make/core/main.mk:1327:
In file included from build/make/core/Makefile:5557:
In file included from platform_testing/build/tasks/continuous_native_tests.mk:27:
build/make/core/tasks/tools/package-modules.mk:80: error: done.
15:52:26 ckati failed with: exit status 1

#### failed to build some targets (01:58 (mm:ss)) ####

则参照 arpi 11 : framework patch 的说明,删除 platform_testing/build/tasks/tests/native_test_list.mk 中的 resolv_gold_test 这一行, 参考如下:

platform_testing/build/tasks/tests/native_test_list.mk
@@ line 111
     puffin_unittest \
     recovery_unit_test \
-    resolv_gold_test \
     resolv_integration_test \
     resolv_unit_test \

可以简单的执行如下命令:

$ sed -i "" "/resolv_gold_test/d" platform_testing/build/tasks/tests/native_test_list.mk

继续编译报错:

$ m
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=sdk_phone_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_OS=darwin
HOST_OS_EXTRA=Darwin-22.6.0-x86_64-13.6
HOST_BUILD_TYPE=release
BUILD_ID=RSV1.210329.096
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
$(file <out/.module_paths/Android.mk.list) was changed, regenerating...
[  1% 3/211] including art/Android.mk ...
art/build/Android.common.mk:51: warning: unsupported HOST_ARCH=x86_64
FAILED: ninja: 'out/target/product/emulator_arm64/system/lib/libbluetooth.so', needed by 'out/target/product/emulator_arm64/system/lib/libbluetooth_qti.so', missing and no known rule to make it
10:58:20 ninja failed with: exit status 1

则参照 Build faild #71 的解决方案:

$ mv device/google/vrservices/xr/packages/BluetoothQtiSymlink/Android.mk device/google/vrservices/xr/packages/BluetoothQtiSymlink/Android.not-mk

/Volumes/aosp/aosp/device/generic/goldfish/arm64-vendor.mk

运行镜像

选择 system-qemu.imgvendor-qemu.img,这两个镜像是专门为 qemu 运行制作的,如果选择 system.img vendor.img,则 avd 运行失败。

$ cd /Volumes/aosp

$ export ANDROID_BUILD_TOP=/Volumes/aosp/aosp

$ export PATH=$PATH:$ANDROID_BUILD_TOP/out/host/darwin-x86/bin

$ export ANDROID_SWT=$ANDROID_BUILD_TOP/out/host/darwin-x86/framework

$ export ANDROID_PRODUCT_OUT=$ANDROID_BUILD_TOP/out/target/product/emulator_arm64

$ export OUT=$ANDROID_PRODUCT_OUT

$ ./emu/emulator -verbose -show-kernel

上面运行起来的镜像是从 ` /Volumes/aosp/aosp/out/target/product/emulator_arm64/hardware-qemu.ini `读取配置信息的,但是这个文件直接修改无效。我们如果需要修改参数,只能从启动参数中设置。

比如我们如果需要增大内存,开启 `GPU` 的支持,则执行如下命令:

$ ./emu/emulator -gpu on -memory 4096 -verbose -show-kernel

参考链接


发布者

《macOS Ventura(13.6)/macOS Sonoma(14.0)编译Android 10.0/Android 11.0源码过程总结(MacBook Pro 2023-Apple M2 Pro)》上有5条评论

  1. 大佬牛逼,我按照教程,编译完全没有问题。
    但在运行模拟器的时候,分区没有加载出来,模拟器一直黑屏。M1的电脑。
    7] init: starting service 'derive_sdk'...
    [ 5.011416] init: SVC_EXEC service 'derive_sdk' pid 231 (uid 9999 gid 9999+0 context default) started; waiting...
    [ 5.014430] init: Service 'derive_sdk' (pid 231) exited with status 0 waiting took 0.003000 seconds
    [ 5.015364] init: Sending signal 9 to service 'derive_sdk' (pid 231) process group...
    [ 5.016098] libprocessgroup: Successfully killed process cgroup uid 9999 pid 231 in 0ms
    [ 5.017056] init: starting service 'exec 6 (/system/bin/vdc --wait cryptfs init_user0)'...
    [ 5.018007] init: SVC_EXEC service 'exec 6 (/system/bin/vdc --wait cryptfs init_user0)' pid 232 (uid 0 gid 0+0 context default) started; waiting...
    [ 5.027068] chattr (230): highest shadow stack usage: 328 bytes
    [ 5.027940] init: Service 'exec 6 (/system/bin/vdc --wait cryptfs init_user0)' (pid 232) exited with status 0 waiting took 0.009000 seconds
    [ 5.028902] init: Sending signal 9 to service 'exec 6 (/system/bin/vdc --wait cryptfs init_user0)' (pid 232) process group...
    [ 5.029764] libprocessgroup: Successfully killed process cgroup uid 0 pid 232 in 0ms
    [ 5.030396] init: starting service 'apexd-snapshotde'...
    [ 5.031233] init: SVC_EXEC service 'apexd-snapshotde' pid 235 (uid 0 gid 1000+0 context default) started; waiting...
    [ 5.034230] apexd: Snapshot DE subcommand detected
    [ 5.034941] apexd: Failed to stat /metadata/apex/sessions: No such file or directory
    [ 5.035674] apexd: Marking APEXd as ready
    [ 5.036512] init: Service 'apexd-snapshotde' (pid 235) exited with status 0 waiting took 0.005000 seconds
    [ 5.037230] init: Sending signal 9 to service 'apexd-snapshotde' (pid 235) process group...
    [ 5.037867] libprocessgroup: Successfully killed process cgroup uid 0 pid 235 in 0ms
    [ 5.038814] selinux: SELinux: Skipping restorecon on directory(/data)
    [ 5.039328] selinux:
    [ 5.039608] init: starting service 'exec 7 (/system/bin/tzdatacheck /apex/com.android.tzdata/etc/tz /data/misc/zoneinfo)'...
    [ 5.040751] init: SVC_EXEC service 'exec 7 (/system/bin/tzdatacheck /apex/com.android.tzdata/etc/tz /data/misc/zoneinfo)' pid 236 (uid 1000 gid 1000+0 context default) started; waiting...
    [ 5.042994] init: Service 'exec 7 (/system/bin/tzdatacheck /apex/com.android.tzdata/etc/tz /data/misc/zoneinfo)' (pid 236) exited with status 0 waiting took 0.002000 seconds
    [ 5.044311] init: Sending signal 9 to service 'exec 7 (/system/bin/tzdatacheck /apex/com.android.tzdata/etc/tz /data/misc/zoneinfo)' (pid 236) process group...
    [ 5.045372] libprocessgroup: Successfully killed process cgroup uid 1000 pid 236 in 0ms
    [ 5.046195] init: processing action (post-fs-data) from (/system/etc/init/hw/init.usb.rc:6)
    [ 5.046952] init: processing action (post-fs-data) from (/vendor/etc/init/hw/init.ranchu.rc:44)
    [ 5.048320] init: starting service 'ranchu-net'...
    [ 5.049065] init: processing action (post-fs-data) from (/system/etc/init/bootstat.rc:9)
    [ 5.049955] init: processing action (ro.debuggable=1 && post-fs-data) from (/system/etc/init/clean_scratch_files.rc:1)
    [ 5.050963] init: Command 'exec_background - root root -- /system/bin/clean_scratch_files' action=ro.debuggable=1 && post-fs-data (/system/etc/init/clean_scratch_files.rc:2) took 0ms and failed: Could not start exec background service: File /system/bin/clean_scratch_files(labeled "u:object_r:system_file:s0") has incorrect label or no domain transition from u:r:init:s0 to another SELinux domain defined. Have you configured your service correctly? https://source.android.com/security/selinux/device-policy#label_new_services_and_address_denials
    [ 5.054706] init: processing action (post-fs-data) from (/system/etc/init/gsid.rc:14)
    [ 5.055508] init: Not setting encryption policy on: /data/gsi
    [ 5.056233] init: processing action (post-fs-data) from (/system/etc/init/incidentd.rc:21)
    [ 5.056919] init: processing action (post-fs-data) from (/system/etc/init/iorapd.rc:28)
    [ 5.057820] init: processing action (post-fs-data) from (/system/etc/init/logtagd.rc:4)
    [ 5.059114] init: processing action (post-fs-data) from (/system/etc/init/otapreopt.rc:3)
    [ 5.059791] init: starting service 'exec 9 (/system/bin/otapreopt_slot)'...
    [ 5.060654] init: SVC_EXEC service 'exec 9 (/system/bin/otapreopt_slot)' pid 239 (uid 0 gid 0+0 context default) started; waiting...
    [ 5.068567] init: starting service 'dhcpclient_def'...
    [ 5.069555] init: Control message: Processed ctl.start for 'dhcpclient_def' from pid: 242 (setprop ctl.start dhcpclient_def)
    [ 5.070841] init: Service 'exec 9 (/system/bin/otapreopt_slot)' (pid 239) exited with status 1 waiting took 0.010000 seconds
    [ 5.071887] init: Sending signal 9 to service 'exec 9 (/system/bin/otapreopt_slot)' (pid 239) process group...
    [ 5.072858] libprocessgroup: Successfully killed process cgroup uid 0 pid 239 in 0ms
    [ 5.073389] init.ranchu-net (237) used greatest stack depth: 11584 bytes left
    [ 5.073947] init: Service 'ranchu-net' (pid 237) exited with status 0 oneshot service took 0.025000 seconds in background
    [ 5.075086] init: Sending signal 9 to service 'ranchu-net' (pid 237) process group...
    [ 5.075900] libprocessgroup: Successfully killed process cgroup uid 0 pid 237 in 0ms
    [ 5.077087] selinux: SELinux: Skipping restorecon on directory(/data/dalvik-cache/arm)
    [ 5.077672] selinux:
    [ 5.077911] selinux: SELinux: Skipping restorecon on directory(/data/dalvik-cache/arm64)
    [ 5.078505] selinux:
    [ 5.078688] selinux: SELinux: Could not stat /data/dalvik-cache/mips: No such file or directory.
    [ 5.079410] selinux:
    [ 5.079611] selinux: SELinux: Could not stat /data/dalvik-cache/mips64: No such file or directory.
    [ 5.080283] selinux:
    [ 5.080468] selinux: SELinux: Could not stat /data/dalvik-cache/x86: No such file or directory.
    [ 5.081117] selinux:
    [ 5.081296] selinux: SELinux: Could not stat /data/dalvik-cache/x86_64: No such file or directory.
    [ 5.081953] selinux:
    [ 5.082135] init: processing action (post-fs-data) from (/system/etc/init/perfetto.rc:67)
    [ 5.082823] init: Command 'rm /data/misc/perfetto-traces/.guardraildata' action=post-fs-data (/system/etc/init/perfetto.rc:68) took 0ms and failed: unlink() failed: No such file or directory
    [ 5.084367] init: processing action (post-fs-data) from (/system/etc/init/recovery-persist.rc:1)
    [ 5.085207] init: starting service 'exec 10 (/system/bin/recovery-persist)'...
    [ 5.085985] init: processing action (post-fs-data) from (/system/etc/init/tombstoned.rc:10)
    [ 5.086693] init: starting service 'tombstoned'...
    [ 5.087298] init: Created socket '/dev/socket/tombstoned_crash', mode 666, user 1000, group 1000
    [ 5.088007] init: Created socket '/dev/socket/tombstoned_intercept', mode 666, user 1000, group 1000
    [ 5.088746] init: Created socket '/dev/socket/tombstoned_java_trace', mode 666, user 1000, group 1000
    [ 5.089721] init: Service 'exec 10 (/system/bin/recovery-persist)' (pid 246) exited with status 0 oneshot service took 0.003000 seconds in background
    [ 5.090721] init: Sending signal 9 to service 'exec 10 (/system/bin/recovery-persist)' (pid 246) process group...
    [ 5.091504] libprocessgroup: Successfully killed process cgroup uid 1000 pid 246 in 0ms
    [ 5.108408] init: processing action (post-fs-data) from (/system/etc/init/wifi.rc:18)
    [ 5.109322] selinux: SELinux: Skipping restorecon on directory(/data/misc/apexdata/com.android.wifi)
    [ 5.110084] selinux:
    [ 5.110279] init: processing action (post-fs-data) from (/vendor/etc/init/hostapd.android.rc:9)
    [ 5.111630] init: processing action (load_persist_props_action) from (/system/etc/init/hw/init.rc:405)
    [ 5.112509] init: Could not set 'ro.logd.size' to '2M' in /data/local.prop: Read-only property was already set
    [ 5.113549] init: Wait for property 'ro.persistent_properties.ready=true' took 1ms
    [ 5.114187] init: starting service 'logd-reinit'...
    [ 5.114857] init: processing action (load_persist_props_action) from (/system/etc/init/flags_health_check.rc:1)
    [ 5.115724] init: Top-level directory needs encryption action, eg mkdir /data/server_configurable_flags encryption=Require
    [ 5.116301] logd.daemon: reinit
    [ 5.116839] init: starting service 'exec 11 (/system/bin/flags_health_check BOOT_FAILURE)'...
    [ 5.117844] init: SVC_EXEC service 'exec 11 (/system/bin/flags_health_check BOOT_FAILURE)' pid 249 (uid 1000 gid 1000+0 context default) started; waiting...
    [ 5.119077] init: Service 'logd-reinit' (pid 248) exited with status 0 oneshot service took 0.004000 seconds in background
    [ 5.120070] init: Sending signal 9 to service 'logd-reinit' (pid 248) process group...
    [ 5.120764] libprocessgroup: Successfully killed process cgroup uid 1036 pid 248 in 0ms
    [ 5.122780] init: Service 'exec 11 (/system/bin/flags_health_check BOOT_FAILURE)' (pid 249) exited with status 0 waiting took 0.004000 seconds
    [ 5.123814] init: Sending signal 9 to service 'exec 11 (/system/bin/flags_health_check BOOT_FAILURE)' (pid 249) process group...
    [ 5.124667] libprocessgroup: Successfully killed process cgroup uid 1000 pid 249 in 0ms
    [ 5.125279] init: processing action (load_persist_props_action) from (/system/etc/init/logcatd.rc:29)
    [ 5.126067] init: processing action (load_bpf_programs) from (/system/etc/init/bpfloader.rc:20)
    [ 5.126817] init: starting service 'bpfloader'...
    [ 5.127504] init: processing action (persist.sys.fuse=true && zygote-start) from (/system/etc/init/hw/init.rc:797)
    [ 5.128660] init: processing action (ro.crypto.state=unsupported && zygote-start) from (/system/etc/init/hw/init.rc:820)
    [ 5.129630] init: starting service 'update_verifier_nonencrypted'...
    [ 5.135121] init: SVC_EXEC service 'update_verifier_nonencrypted' pid 251 (uid 0 gid 2001+1 context default) started; waiting...
    [ 5.136037] init: Service 'update_verifier_nonencrypted' (pid 251) exited with status 0 waiting took 0.005000 seconds
    [ 5.136994] init: Sending signal 9 to service 'update_verifier_nonencrypted' (pid 251) process group...
    [ 5.137745] libprocessgroup: Successfully killed process cgroup uid 0 pid 251 in 0ms
    [ 5.138821] init: starting service 'statsd'...
    [ 5.139349] init: Created socket '/dev/socket/statsdw', mode 222, user 1066, group 1066
    [ 5.140541] init: starting service 'netd'...
    [ 5.140931] init: Created socket '/dev/socket/dnsproxyd', mode 660, user 0, group 3003
    [ 5.141647] init: Created socket '/dev/socket/mdns', mode 660, user 0, group 1000
    [ 5.142347] init: Created socket '/dev/socket/fwmarkd', mode 660, user 0, group 3003
    [ 5.149034] init: starting service 'zygote'...
    [ 5.149659] init: Created socket '/dev/socket/zygote', mode 660, user 0, group 1000
    [ 5.150550] init: Created socket '/dev/socket/usap_pool_primary', mode 660, user 0, group 1000
    [ 5.152106] init: Service 'bpfloader' (pid 250) exited with status 0 oneshot service took 0.024000 seconds in background
    [ 5.153581] init: Sending signal 9 to service 'bpfloader' (pid 250) process group...
    [ 5.154418] libprocessgroup: Successfully killed process cgroup uid 0 pid 250 in 0ms
    [ 5.155148] init: processing action (zygote-start) from (/vendor/etc/init/hw/init.ranchu.rc:51)
    [ 5.156252] init: processing action (firmware_mounts_complete) from (/system/etc/init/hw/init.rc:411)
    [ 5.157329] init: processing action (early-boot) from (/system/etc/init/installd.rc:5)
    [ 5.159334] libprocessgroup: Failed to open /dev/stune/top-app/tasks: No such file or directory: No such file or directory
    [ 5.159959] init: processing action (boot) from (/system/etc/init/hw/init.rc:836)
    [ 5.160182] libprocessgroup: Failed to apply MaxPerformance task profile: No such file or directory
    [ 5.161392] init: starting service 'hidl_memory'...
    [ 5.162688] init: starting service 'vendor.audio-hal'...
    [ 5.164191] init: starting service 'vendor.authsecret-1-0'...
    [ 5.165360] init: starting service 'vendor.bluetooth-1-1'...
    [ 5.166725] init: starting service 'vendor.camera-provider-2-6-google'...
    [ 5.168580] libprocessgroup: Failed to open /dev/stune/foreground/tasks: No such file or directory: No such file or directory
    [ 5.169746] libprocessgroup: Failed to apply HighPerformance task profile: No such file or directory
    [ 5.171097] init: starting service 'vendor.contexthub-hal-1-1-mock'...
    [ 5.172616] init: failed to write pid to files: couldn't write 262 to /dev/cpuset/camera-daemon/tasks: No such file or directory
    [ 5.174243] init: starting service 'vendor.drm-clearkey-hal-1-3'...

    1. 目前还没找到原因,不仅仅是M1 编译出来的镜像工作不正常,就是 X86编译出来的ARM镜像 也是各种启动问题,倒是编译出的X86镜像都很正常

  2. 大佬牛批,我升级到macos14前编译一切正常。直到某天因为要用一下xcode,然后升级了。升级后就开始各种坑了。折腾好久都编译不成功,试一下大佬的方式。有联系方式吗?可以加个v不

    1. 建议还是UTM虚拟机编译,目前测试来看这个是相对来说比较简单的方案,当然,也只能是相对比较简单,当前Apple虚拟化部分在高负载下,磁盘文件系统的实现部分存在缺陷,会导致虚拟机报告文件系统损坏(不影响真机)。

      一般也是要重试几次即可编译成功,编译出的结果经过验证是可用的。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注