skip to Main Content

Details of the Issue with Building AOSP 14

Problem Description

When attempting to build AOSP 14, I encountered an error during the build process. The build environment was configured according to the requirements for AOSP 14, but I encountered the following error:

internal error: undefined variable CTS_TEST_SUITES_DEFAULT
11:02:32 fatal errors encountered

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

Steps Taken

  1. Environment Setup:

    • Executed source build/envsetup.sh.
    • Selected the build environment with the command lunch aosp_cf_x86_64_phone-trunk_staging-userdebug.
  2. Build Information:

    • PLATFORM_VERSION_CODENAME=VanillaIceCream
    • TARGET_PRODUCT=aosp_cf_x86_64_phone
    • TARGET_BUILD_VARIANT=userdebug
    • HOST_OS=linux
    • HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
    • BUILD_ID=MAIN
  3. Memory Warning:

    • My machine has 16 GB of RAM.

Errors Encountered

  • Error: internal error: undefined variable CTS_TEST_SUITES_DEFAULT
  • Details: Build failed due to fatal errors.

Full Terminal

thanhchung@Chung-Computer:/media/thanhchung/data/AOSP14$ source build/envsetup.sh
thanhchung@Chung-Computer:/media/thanhchung/data/AOSP14$ lunch aosp_cf_x86_64_phone-trunk_staging-userdebug

============================================
PLATFORM_VERSION_CODENAME=VanillaIceCream
PLATFORM_VERSION=VanillaIceCream
TARGET_PRODUCT=aosp_cf_x86_64_phone
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=silvermont
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=silvermont
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
BUILD_ID=MAIN
OUT_DIR=out
============================================

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Wondering whether to use user, userdebug or eng?

  user        The builds that ship to users. Reduced debugability.
  userdebug   High fidelity to user builds but with some debugging options
              enabled. Best suited for performance testing or day-to-day use
              with debugging enabled.
  eng         More debugging options enabled and faster build times, but
              runtime performance tradeoffs. Best suited for day-to-day
              local development when not doing performance testing.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

thanhchung@Chung-Computer:/media/thanhchung/data/AOSP14$ echo "$TARGET_PRODUCT-$TARGET_RELEASE-$TARGET_BUILD_VARIANT"
aosp_cf_x86_64_phone-trunk_staging-userdebug
thanhchung@Chung-Computer:/media/thanhchung/data/AOSP14$ m 
11:00:10 ************************************************************
11:00:10 You are building on a machine with 15.6GB of RAM
11:00:10 
11:00:10 The minimum required amount of free memory is around 16GB,
11:00:10 and even with that, some configurations may not work.
11:00:10 
11:00:10 If you run into segfaults or other errors, try reducing your
11:00:10 -j value.
11:00:10 ************************************************************
============================================
PLATFORM_VERSION_CODENAME=VanillaIceCream
PLATFORM_VERSION=VanillaIceCream
TARGET_PRODUCT=aosp_cf_x86_64_phone
TARGET_BUILD_VARIANT=userdebug
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=silvermont
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=silvermont
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
BUILD_ID=MAIN
OUT_DIR=out
============================================
internal error: undefined variable CTS_TEST_SUITES_DEFAULT
11:02:32 fatal errors encountered

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

thanhchung@Chung-Computer:/media/thanhchung/data/AOSP14$ 

Has anyone encountered the same error and can you suggest to me how to fix it?

2

Answers


  1. Chosen as BEST ANSWER

    Solution for AOSP 14 Build Error

    I found the solution. The error occurred due to insufficient memory (16GB of RAM isn't enough). To fix this, you need to create a swapfile on your SSD.

    Here’s how to create a 34GB swapfile:

    1. Check Available Disk Space:

      df -h
      
    2. Create a 34GB Swapfile:

      sudo fallocate -l 34G /swapfile
      

      If fallocate is unavailable:

      sudo dd if=/dev/zero of=/swapfile bs=1G count=34
      
    3. Set Permissions:

      sudo chmod 600 /swapfile
      
    4. Format as Swap:

      sudo mkswap /swapfile
      
    5. Activate the Swapfile:

      sudo swapon /swapfile
      
    6. Verify:

      sudo swapon --show
      free -h
      
    7. Make It Permanent:

      echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
      

    Additional Advice

    After setting up the swapfile, it's recommended to

    • delete the existing source,
    • reinitialize the repo - repo init,
    • clone it again,
    • and repo sync -j$(nproc)

  2. The error looks explicit – you need at least 64GB of RAM to build AOSP AOSP Build Requirements

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search