Hi,

I'm following the build instruction https://grapheneos.org/build and build GrapheneOS 15 (Development branch) for shiba (Pixel 8).

Unfortunately I'm stuck at step "Extracting vendor files for Pixel devices", the command "m aapt2" fails.

# m aapt2
10:03:45 Build sandboxing disabled due to nsjail error.
10:03:47 ************************************************************
10:03:47 You are building on a machine with 12GB of RAM
10:03:47 
10:03:47 The minimum required amount of free memory is around 16GB,
10:03:47 and even with that, some configurations may not work.
10:03:47 
10:03:47 If you run into segfaults or other errors, try reducing your
10:03:47 -j value.
10:03:47 ************************************************************
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=15
TARGET_PRODUCT=sdk_phone64_x86_64
TARGET_BUILD_VARIANT=user
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-6.11.0-17-generic-x86_64-Ubuntu-24.04.2-LTS
HOST_CROSS_OS=windows
BUILD_ID=AP4A.250205.002
PLATFORM_SECURITY_PATCH=2025-02-05
OUT_DIR=out
============================================
10:06:45 soong bootstrap failed with: exit status 1
[100% 1/1] analyzing Android.bp files and generating ninja file at out/soong/build.sdk_phone64_x86_64.ninja
FAILED: out/soong/build.sdk_phone64_x86_64.ninja
cd "$(dirname "out/host/linux-x86/bin/soong_build")" && BUILDER="$PWD/$(basename "out/host/linux-x86/bin/soong_build")"
 && cd / && env -i  "$BUILDER"     --top "$TOP"     --soong_out "out/soong"     --out "out"     --soong_variables out/s
oong/soong.sdk_phone64_x86_64.variables -o out/soong/build.sdk_phone64_x86_64.ninja -l out/.module_paths/Android.bp.lis
t --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used.sdk_phone64_x86_64.
build Android.bp
Warning: Module 'androidx.wear_wear' depends on non-existing optional_uses_libs 'wear-sdk'
Warning: Module 'androidx.wear.compose_compose-foundation' depends on non-existing optional_uses_libs 'wear-sdk'
Killed
ninja: build stopped: subcommand failed.

In additional, there's a warning: Build sandboxing disabled due to nsjail error.

Please advise how to fix these build issues.

  • de0u replied to this.

    Switching from a Windows-hosted virtual machine to the native Ubuntu Linux server (24.04 LTS, 32 Gb RAM) fixed the build issue.

    headwind-mdm If the build machine doesn't have enough memory, all sorts of things go wrong, and the error reporting does not implicate memory exhaustion, so the errors appear random and nonsensical.

    I recently did an emulator build (i.e., without extracting vendor files for a device) on a machine with 12 GB of physical memory, but it used 40 GB virtual and took multiple days.

    headwind-mdm Please advise how to fix these build issues.

    You could look in your system logs to see if the OOM killer is running... but it would probably be better overall to get machine with at least 32 GB of physical memory, with 64 GB being a safer bet. And I would still recommend configuring a swap partition (better than a swap file).

    9 days later

    Hello,
    I get the same Errors when I'm building aapt2:
    Warning: Module 'androidx.wear_wear' depends on non-existing optional_uses_libs 'wear-sdk'
    Warning: Module 'androidx.wear.compose_compose-foundation' depends on non-existing optional_uses_libs 'wear-sdk

    I am using Debian 12 on an Dell R630 with 32 GB RAM. OOM-Killer is not running.

    Thank you,
    MegaBernd

    • de0u replied to this.

      MegaBernd Is swap configured? I think I saw soong using 40 GB of virtual memory in the pre-Ninja phase recently.

      Edit: I just today built the emulator and aapt2 and bluejay without error (on an Ubuntu machine with 64 GB of RAM plus also swap).

      swap is not configured, i will try it!

      MegaBernd Those two lines are the only errors before the build fails? Did the aapt2 build follow a previous build as described in the build instructions?

      This worked for me just today (building 2025030300), so I'm not really sure how to help. Maybe more help here: https://grapheneos.org/contact#community-chat

      @de0u answered correctly - that message is just an unrelated warning, and there's a silent out-of-memory error. Got the same issue on another server (Ubuntu 24.04, 32 Gb RAM), and adding the swap (extra 32 Gb) fixed the issue.

      • de0u replied to this.