Search code examples
androidlinux-kernelclangubuntu-18.04android-11

/usr/bin/as: unrecognized option '-EL' clang-11: error: assembler command failed with exit code 1 (use -v to see invocation)


After build u-boot success, I'm trying to build kernel for android 11.5.4 by ubuntu 18.04 but it's getting an error that can't continue. As you can see the error is on the line:

"

/usr/bin/as: unrecognized option '-EL'
clang-11: error: assembler command failed with exit code 1 (use -v to see invocation)

".

I installed the environment:

"sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools"

i tried installing clang 11 and llvm 11 but it didn't help at all. Can I refer to more buildable environments?

Thank you.

Here is my log:

===== Build Kernel =====>
CONFIG_KERNEL_VERSION: 5.4
------device/amlogic/vnptt_smb_3/build.config.meson.arm64.trunk-----
KERNEL_DEVICETREE: s4_s905y4_ap222_drm
=====ab update & vendor boot mode=====
=================================
========================================================
= build config: /media/thanhchung/data/s905y4_r_fw/device/amlogic/vnptt_smb_3/build.config.meson.arm64.trunk
. common/build.config.common
. common/build.config.aarch64
. device/amlogic/common/kernelbuild/build.config.common

DEFCONFIG=meson64_a64_defconfig
EXTRA_CMDS=''

#It is a must to set GPU driver's version
GPU_DRV_VERSION=r25p0

KERNEL_DEVICETREE=s4_s905y4_ap222_drm
KERNEL_DEVICETREE_DDR_1G=s4_s905y4_ap222_drm_1g
DTBO_DEVICETREE=android_overlay_dt
PRODUCT_DIRNAME=device/amlogic/vnptt_smb_3
BOARD_DEVICENAME=vnptt_smb_3

ENABLE_KASAN=false

# Not saving any kernel images. This build step is meant purely to generate the .kos.
FILES=""


EXT_MODULES="
vendor/amlogic/common/wifi_bt/wifi/configs/5_4
vendor/amlogic/common/wifi_bt/bluetooth/configs/5_4
vendor/amlogic/common/gpu/bifrost
vendor/amlogic/common/tdk_linuxdriver
hardware/amlogic/media_modules
device/amlogic/common/dolby_ms12/kmod
"

STOP_SHIP_TRACEPRINTK=1

PATH=/media/thanhchung/data/s905y4_r_fw/build/build-tools/path/linux-x86:/media/thanhchung/data/s905y4_r_fw/prebuilts/clang/host/linux-x86/clang-r383902/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

========================================================
 Setting up for build
+ '[' ']'
+ '[' '' == true ']'
+ '[' -n '' ']'
+ cp common/arch/arm64/configs/meson64_a64_R_defconfig common/arch/arm64/configs/meson64_a64_gki_defconfig
+ '[' '!' -z '' ']'
+ '[' '' == user ']'
+ cd common
+ make CC=clang HOSTCC=clang LD=ld.lld NM=llvm-nm OBJCOPY=llvm-objcopy O=/media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common meson64_a64_gki_defconfig
make[1]: Entering directory '/media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common'
  GEN     Makefile
#
# No change to .config
#
make[1]: Leaving directory '/media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common'
+ rm -fr common/arch/arm64/configs/meson64_a64_gki_defconfig
+ set +x
========================================================
 Building kernel
+ grep '\.ko$'
+ find /media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common/ -type f
+ xargs rm -fr
+ '[' ']'
+ cd /media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common
+ make O=/media/thanhchung/data/s905y4_r_fw/out/android11-5.4/common CC=clang HOSTCC=clang LD=ld.lld NM=llvm-nm OBJCOPY=llvm-objcopy
arch/arm64/Makefile:52: Detected assembler with broken .inst; disassembly will be unreliable
  GEN     Makefile
grep: /media/thanhchung/data/s905y4_r_fw/common/.config: No such file or directory
  CC      scripts/mod/empty.o
/usr/bin/as: unrecognized option '-EL'
clang-11: error: assembler command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/media/thanhchung/data/s905y4_r_fw/common/scripts/Makefile.build:283: scripts/mod/empty.o] Error 1
make[1]: *** [/media/thanhchung/data/s905y4_r_fw/common/Makefile:1229: prepare0] Error 2
make[1]: *** Waiting for unfinished jobs....
  DTC     arch/arm64/boot/dts/amlogic/s4_s905y4_ap222_drm.dtb
make: *** [/media/thanhchung/data/s905y4_r_fw/common/Makefile:179: sub-make] Error 2
build kernel error

Solution

  • My mistake. I was working on the wrong build environment.

    you need get install environment in Official AOSP build guide : Establishing a build environment | Android Open Source Project and following command on terminal:

    sudo apt-get install gcc-aarch64-linux-gnu