Edge2 Compiling Android 12 Source - FAIL

Which system do you use? Android, Ubuntu, OOWOW or others?

** Android 12 **

Which version of system do you use? Khadas official images, self built images, or others?

** Khadas official source and images **

Please describe your issue below:

$ Clean install of Ubuntu 18.04
Install Google Environment: https://source.android.com/source/initializing.html. 
$ sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
$ sudo apt-get install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
$ sudo apt-get install exfat-fuse exfat-utils device-tree-compiler liblz4-tool
$ sudo apt-get install openjdk-8-jdk
$ sudo apt install git-lfs
$ mkdir -p WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://github.com/khadas/android_manifest.git -b khadas-edge2-android12
$ repo sync -j4
$ cd ~/WORKING_DIRECTORY/external/camera_engine_rkaiq
$ ~/WORKING_DIRECTORY/external/camera_engine_rkaiq$ git lfs pull
Git LFS: (4 of 4 files) 208.97 MB / 208.97 MB                                                                                                                                                                                             

$ cd ~/WORKING_DIRECTORY/prebuilts/module_sdk
$ ~/WORKING_DIRECTORY/prebuilts/module_sdk$ git lfs pull
Git LFS: (3 of 3 files) 936.69 MB / 936.69 MB   
                                                                                                                                                                                          
$ cd ~/WORKING_DIRECTORY/users/Edge2$ cd device/khadas/rk3588
$ ~/WORKING_DIRECTORY/device/khadas/rk3588$ git lfs pull
Git LFS: (1 of 1 files) 211.07 MB / 211.07 MB

$ cd ~/WORKING_DIRECTORY

UPDATE: Ubuntu 18.04 - it has outdated lz4 and therefore instead of doing apt-get install liblz4-tool - it is required to download sources and compile manually:
wget https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.zip
unzip v1.9.4.zip
cd 1.9.4 && make && make install

$ source build/envsetup.sh
$ lunch kedge2-userdebug
$ ./build.sh -CKAUu

Post a console log of your issue below:

asus@asus-N501JW:~/WORKING_DIRECTORY$ ./build.sh -CKAUu
...
...
  CC [M]  drivers/net/ethernet/realtek/r8168/r8168.mod.o
  CC [M]  drivers/net/phy/realtek.mod.o
  CC [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.mod.o
  LZ4C    arch/arm64/boot/Image.lz4
  LD [M]  drivers/media/usb/gspca/gspca_main.ko
  LD [M]  drivers/net/ethernet/realtek/r8168/r8168.ko
  LD [M]  drivers/net/phy/realtek.ko
  LD [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.ko
  Image:  resource.img (with rk3588s-khadas-edge2.dtb logo.bmp logo_kernel.bmp) is ready
  Image:  boot.img (with Image  resource.img) is ready
  Image:  zboot.img (with Image.lz4  resource.img) is ready

#### build completed successfully (16:39 (mm:ss)) ####

/home/asus/WORKING_DIRECTORY
Build kernel ok!
package resoure.img with charger images

Pack ./tools/images/ & ../kernel-5.10/resource.img to resource.img ...
Unpacking old image(../kernel-5.10/resource.img):
rk-kernel.dtb logo.bmp logo_kernel.bmp 3
Pack to resource.img successed!

Packed resources:
rk-kernel.dtb battery_1.bmp battery_2.bmp battery_3.bmp battery_4.bmp battery_5.bmp battery_fail.bmp logo.bmp logo_kernel.bmp battery_0.bmp 10

./resource.img with battery images is ready
/home/asus/WORKING_DIRECTORY
./build.sh: line 173: [: =: unary operator expected
start build android
13:51:02 ************************************************************
13:51:02 You are building on a machine with 15.5GB of RAM
13:51:02 
13:51:02 The minimum required amount of free memory is around 16GB,
13:51:02 and even with that, some configurations may not work.
13:51:02 
13:51:02 If you run into segfaults or other errors, try reducing your
13:51:02 -j value.
13:51:02 ************************************************************
build/make/core/soong_config.mk:195: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.
build/make/core/soong_config.mk:196: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=kedge2
TARGET_BUILD_VARIANT=userdebug
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_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SQ3A.220705.003.A1
OUT_DIR=out
============================================
13:51:04 Entire data directory removed.
13:51:04 Deleted images and staging directories.

#### build completed successfully (2 seconds) ####

13:51:04 ************************************************************
13:51:04 You are building on a machine with 15.5GB of RAM
13:51:04 
13:51:04 The minimum required amount of free memory is around 16GB,
13:51:04 and even with that, some configurations may not work.
13:51:04 
13:51:04 If you run into segfaults or other errors, try reducing your
13:51:04 -j value.
13:51:04 ************************************************************
build/make/core/soong_config.mk:195: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.
build/make/core/soong_config.mk:196: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=kedge2
TARGET_BUILD_VARIANT=userdebug
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_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SQ3A.220705.003.A1
[100% 268/268] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER"     --top "$TOP"     --out "out/soong"     -n "out"     -d "out/soong/build.ninja.d"     -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
audioflinger want to conditional Compile
devicefactory want to conditional Compile
libRkTeeWeaver want to conditional Compile
libaudioclient want to conditional Compile
libaudiohal want to conditional Compile
libeptz want to conditional Compile
libgralloc_priv want to conditional Compile
libmpimmz conditional Compile
librga want to conditional Compile
librknnrt want to conditional Compile
librockx want to conditional Compile
managerdefault want to conditional Compile
Rockchip conditional compile
libeptz enabled on RK3588
libeptz enabled on RK3588
libeptz enabled on RK3588
[hardware/rockchip/libgralloc frameworks/native/include system/core/libsync system/core/libsync/include external/libdrm/include/drm] 32
librknnrt enabled on RK3588
librknnrt enabled on RK3588
librknnrt enabled on RK3588
Optee Version: v2
>>>>>>>>>>>>>>>>>>>>> rk3588
librockx enabled on RK3588
librockx enabled on RK3588
librockx enabled on RK3588
Killed
13:53:32 soong bootstrap failed with: exit status 1

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

Build android failed!

Anyone else having this issue? Thanks!

I tried this. It did NOT WORK:

$ sudo apt install libncurses5:i386
$ source build/envsetup.sh
$ lunch kedge2-userdebug
$ ./build.sh -CKAUu

Arch: Enable multilib,sudo pacman -S lib32-ncurses

Ubuntu: sudo apt install libncurses5:i386

I’ve isolated the problem to the following command:

From the ~/WORKING_DIRECTORY:
$ cd “$(dirname “out/soong/.bootstrap/bin/soong_build”)” && BUILDER=“$PWD/$(basename “out/soong/.bootstrap/bin/soong_build”)” && cd / && env -i “$BUILDER” --top “$TOP” --out “out/soong” -n “out” -d “out/soong/build.ninja.d” -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp

RESPONSE:
audioflinger want to conditional Compile
devicefactory want to conditional Compile
libRkTeeWeaver want to conditional Compile
libaudioclient want to conditional Compile
libaudiohal want to conditional Compile
libeptz want to conditional Compile
libgralloc_priv want to conditional Compile
libmpimmz conditional Compile
librga want to conditional Compile
librknnrt want to conditional Compile
librockx want to conditional Compile
managerdefault want to conditional Compile
Rockchip conditional compile
error reading available environment file ‘out/soong/soong.environment.available’: open out/soong/soong.environment.available: no such file or directory
root:/$ pwd
root:/$ /

Notice that the command returns you to the ROOT DIRECTORY /. From here it says the file, “soon.environment.available” doesn’t exist.

However, if you cd ~/WORKING_DIRECTORY/out/soon/ you will see a file called “soong-environment.available” is there!!

HAS ANYONE outside of Khadas gotten this source code to compile properly? Please help me! I’ve exhausted my bag of tricks. Frustration is now setting in.

@byob11 As per the compilation prompt above, can you increase the DDR memory to over 16GB? Or use the following command to compile and see if it’s okay?

$ source build/envsetup.sh
$ lunch kedge2-userdebug
$ make -j1

@byob11 Alternatively, you can try increasing the swap partition.

@goenjoy
I will try that tonight and let it run.

Please.note: the process fails on a command that doesn’t work when run in isolation.

From the ~/WORKING_DIRECTORY:
$ cd “$(dirname “out/soong/.bootstrap/bin/soong_build”)” && BUILDER=“$PWD/$(basename “out/soong/.bootstrap/bin/soong_build”)” && cd / && env -i “$BUILDER” --top “$TOP” --out “out/soong” -n “out” -d “out/soong/build.ninja.d” -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp

Encounters an error if i copy the above text and paste it into the working directory.

“error reading available environment file ‘out/soong/soong.environment.available’: open out/soong/soong.environment.available: no such file or directory”

After running the command, I land back at the root directory. I type:
root:/$ pwd
root:/$ /

Notice that the command returns you to the ROOT DIRECTORY /. From here it says the file, “soon.environment.available” doesn’t exist.

However, if you cd ~/WORKING_DIRECTORY/out/soong you will see a file called “soong-environment.available” is there!! The command appears to be formed incorrectly. And thats why the script is failing because the command is incorrect.

This doesn’t appear to be a RAM issue… can you confirm the build process is working from scratch on your side? Thank you.

@goenjoy

$ source build/envsetup.sh
$ lunch kedge2-userdebug
$ make -j1

Fails on the following command in the make script:

cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER"     --top "$TOP"     --out "out/soong"     -n "out"     -d "out/soong/build.ninja.d"     -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp

Paste the command above and execute it from ~/WORKING_DIRECTORY terminal and execute it outside of the make process:

error reading available environment file 'out/soong/soong.environment.available': open out/soong/soong.environment.available: no such file or directory

The command takes you back to the root directory and then looks for pwd or /out/soon/soong.environment.available which doesn’t exist.

The command appears to be incorrectly formed.

asus@asus-N501JW:~/WORKING_DIRECTORY$ make -j1
23:52:43 ************************************************************
23:52:43 You are building on a machine with 15.5GB of RAM
23:52:43 
23:52:43 The minimum required amount of free memory is around 16GB,
23:52:43 and even with that, some configurations may not work.
23:52:43 
23:52:43 If you run into segfaults or other errors, try reducing your
23:52:43 -j value.
23:52:43 ************************************************************
build/make/core/soong_config.mk:195: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.
build/make/core/soong_config.mk:196: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=kedge2
TARGET_BUILD_VARIANT=userdebug
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_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-150-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SQ3A.220705.003.A1
OUT_DIR=out
============================================
[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER"     --top "$TOP"     --out "out/soong"     -n "out"     -d "out/soong/build.ninja.d"     -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
audioflinger want to conditional Compile
devicefactory want to conditional Compile
libRkTeeWeaver want to conditional Compile
libaudioclient want to conditional Compile
libaudiohal want to conditional Compile
libeptz want to conditional Compile
libgralloc_priv want to conditional Compile
libmpimmz conditional Compile
librga want to conditional Compile
librknnrt want to conditional Compile
librockx want to conditional Compile
managerdefault want to conditional Compile
Rockchip conditional compile
libeptz enabled on RK3588
libeptz enabled on RK3588
libeptz enabled on RK3588
>>>>>>>>>>>>>>>>>>>>> rk3588
[hardware/rockchip/libgralloc frameworks/native/include system/core/libsync system/core/libsync/include external/libdrm/include/drm] 32
librknnrt enabled on RK3588
librknnrt enabled on RK3588
librknnrt enabled on RK3588
Optee Version: v2
librockx enabled on RK3588
librockx enabled on RK3588
librockx enabled on RK3588
Killed
23:53:55 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

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

@goenjoy

I give up tonight. I will build another machine with 32 gigs for RAM and try again in a day or two.

In the meantime, could someone on your side try to build this from scratch to prove that it’s working? Do you use Ubuntu 16.04 or 18.04?

Thank you.

We have been selling boards for almost a year now. They haven’t encountered compilation errors like yours before. Alternatively, you can try increasing the swap partition.

@goenjoy

Thank you very much for the support.

@goenjoy

Success. The Linux Kernel made the diffenence.

I installed Linux-4.15.0-197-generic-x86_64 on my machine, rebooted into advanced grub, selected Linux-4.15.0-197-generic to boot, and ran make -j1. However, the command that crashes the newer kernel, throws a “DISALLOWED PATH TOOL” WARNING. See below.

Kernel 4.15.0-197-generic:

17:31:49 Disallowed PATH tool "python3.6" used: []string{"python3.6", ".repo/repo/repo", "manifest", "-r", "-o", "out/commit_id.xml"}
17:31:49 See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.

Kernel 5.4.0-150-generic:

error reading available environment file 'out/soong/soong.environment.available': open out/soong/soong.environment.available: no such file or directory

Command in question:

cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER"     --top "$TOP"     --out "out/soong"     -n "out"     -d "out/soong/build.ninja.d"     -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp

What I did to get this to work:

1. Download Linux Kernel 4.15.0-197-generic from the link below into your ~/Downloads directory:
http://archive.ubuntu.com/ubuntu/pool/main/l/linux-signed/linux-image-4.15.0-197-generic_4.15.0-197.208_amd64.deb

2. Install linux-image-4.15.0-197-generic deb package::
# cd ~/Downloads
# sudo apt-get install linux-image-4.15.0-197-generic

3. Boot to grub:
# sudo nano /etc/default/grub

Place a # symbol at the start of line GRUB_HIDDEN_TIMEOUT=0 to comment it out. If that line doesn’t exist, then you can comment out this line instead: # GRUB_TIMEOUT_STYLE=hidden, and then change GRUB_TIMEOUT=0 to GRUB_TIMEOUT=5, for instance, to give the grub menu a 5 second timeout before it automatically logs you in.

#GRUB_HIDDEN_TIMEOUT=0
If that doesn’t exist, comment out:
#GRUB_TIMEOUT_STYLE=hidden
Set timeout to -1 or 5 seconds per above:
GRUB_TIMEOUT=-1
Save
sudo update-grub
reboot
$ cd ~/WORKING_DIRECTORY
$ source build/envsetup.sh
$ lunch kedge2-userdebug
$ make -j1

Thanks again, Jeff.

1 Like