0
votes

I'm using Ubuntu 20.04 and compiling the kernel for Pixel 3XL (crosshatch).

Adding LD=ld.gold to my script command doesn't fix the issue and gives the same error. Also, LLVMgold.so is inside the clang directory here: ~/KERNEL_DIRECTORY/linux-x86/clang-r353983c/lib64 (this is the path I'm using for LD_LIBRARY_PATH). I've copied LLVMgold.so to /usr/local/lib and other recommended locations with no luck. As always, thank you for reading and if you need more information, I'll be happy to share it with you.

Error:

  AR      arch/arm64/lib/lib.a
  EXPORTS arch/arm64/lib/lib-ksyms.o
/home/jherwig/KERNEL_DIRECTORY/aarch64-linux-android-4.9/bin
/aarch64-linux-android-ld.gold: error: LLVMgold.so: could not load plugin     
library: LLVMgold.so: cannot open shared object file: No such file or 
directory
make[2]: *** [../scripts/Makefile.build:591: arch/arm64/lib/lib-ksyms.o] Error 1
make[1]: *** [/home/jherwig/KERNEL_DIRECTORY/crosshatch-msm-10  
/Makefile:1123: arch/arm64/lib] Error 2
make[1]: Leaving directory '/home/jherwig/KERNEL_DIRECTORY /crosshatch-msm-10/out'
make: *** [Makefile:152: sub-make] Error 2

Script command with path:

rm -rf out && export PATH=~/WORKING_DIRECTORY/out/host/linux-x86/bin:/usr/bin:$PATH && export
 DTC_EXT=dtc && export PATH=~/KERNEL_DIRECTORY/linux-x86/clang-r353983c/bin:$PATH && export 
CLANG_TRIPLE=aarch64-linux-gnu- && export CROSS_COMPILE=~/KERNEL_DIRECTORY/aarch64-linux-
android-4.9/bin/aarch64-linux-android- && export CROSS_COMPILE_ARM32=~/KERNEL_DIRECTORY/arm-
linux-androideabi-4.9/bin/arm-linux-androideabi- && LD_LIBRARY_PATH=~/KERNEL_DIRECTORY/linux-
x86/clang-r353983c/lib64:$LD_LIBRARY_PATH && DEFCONFIG="b1c1_defconfig" && make O=out CC=clang 
ARCH=arm64 $DEFCONFIG && make ARCH=arm64 CC=clang NM=llvm-nm OBJCOPY=llvm-objcopy O=out

ld.gold version:

jherwig@jh:~/KERNEL_DIRECTORY/crosshatch-msm-10$  /home/jherwig/KERNEL_DIRECTORY/aarch64-linux-
android-4.9/bin/aarch64-linux-android-ld.gold -v
GNU gold (binutils-2.27-bd24d23f 2.27.0.20170315) 1.12

ld.gold accepts plugins:

jherwig@jh:~/KERNEL_DIRECTORY/crosshatch-msm-10$  /home/jherwig/KERNEL_DIRECTORY/aarch64-linux-
android-4.9/bin/aarch64-linux-android-ld.gold -plugin
/home/jherwig/KERNEL_DIRECTORY/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld.gold: 
-plugin: missing argument
/home/jherwig/KERNEL_DIRECTORY/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld.gold: use 
the --help option for usage information
2
nvm.. pretty sure I'm just missing "export" before LD_LIBRARY_PATH in my script command - John Herwig

2 Answers

0
votes

I'm using Ubuntu 18.04 and compiling the kernel for Pixel 4 (flame). Thanks for your posting. It really helps me a lot.

Unfortunately I still got an error as below: GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o AR init/built-in.o AR built-in.o LTO vmlinux.o ../scripts/link-vmlinux.sh: line 101: 18716 Killed ${LD} ${LDFLAGS} -r -o ${1} $(modversions) ${objects} /home/dongtaotao/msm/Makefile:1134: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 137 make[1]: Leaving directory '/home/dongtaotao/msm/out' Makefile:146: recipe for target 'sub-make' failed make: *** [sub-make] Error 2

Any suggestions?

0
votes

This was too long for a comment so had to post as an answer:

My Pixel 4 Command where WORKING_DIRECTORY/out/host/linux-x86/bin/ contains some of my AOSP build tools (after running "repo init" and "repo sync" for the latest aosp branch for pixel 4, run "mmma system/libufdt/utils/src" instead of make). The main differences are the floral defconfig file and the specified LD=ld.lld linker

rm -rf out && export PATH=~/WORKING_DIRECTORY/out/host
/linux-x86/bin/:/usr/bin:$PATH && export DTC_EXT=dtc && 
export PATH=~/KERNEL_DIRECTORY/linux-x86/clang-r383902
/bin:$PATH && export CLANG_TRIPLE=aarch64-linux-gnu- && 
export CROSS_COMPILE=~/KERNEL_DIRECTORY/aarch64-linux-
android-4.9/bin/aarch64-linux-android- && export 
CROSS_COMPILE_ARM32=~/KERNEL_DIRECTORY/arm-linux-
androideabi-4.9/bin/arm-linux-androideabi- && export 
LD_LIBRARY_PATH=~/KERNEL_DIRECTORY/linux-x86/clang-r383902
/lib64:$LD_LIBRARY_PATH && export LD=ld.lld && 
DEFCONFIG="floral_defconfig" && make O=out CC=clang 
ARCH=arm64 $DEFCONFIG && make ARCH=arm64 CC=clang LD=ld.lld
NM=llvm-nm OBJCOPY=llvm-objcopy O=out