ld.lld: error: undefined symbol: __stack_chk_guard while compiling android 13

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ld.lld: error: undefined symbol: __stack_chk_guard while compiling android 13

跳至解决方案
9,058 次查看
xiayanfire
Contributor III

I am trying to compile android 13.0.0_1.2.0 for i.mx8m plus board. I executed these commands :

source ./imx-android-13.0.0_1.2.0/imx_android_setup.sh
source build/envsetup.sh
lunch evk_8mp-userdebug
./imx-make.sh kernel -j4 2>&1 | tee build-log.txt

Please check the detail build log info from build-log.txt in the attachment

key error log is:

LTO vmlinux.o
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.btf
ld.lld: error: undefined symbol: __stack_chk_guard
>>> referenced by irq-sun6i-r.c:309 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:309)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced by irq-sun6i-r.c:311 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:311)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced by irq-sun6i-r.c:0 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:0)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced 39331 more times
BTF .btf.vmlinux.bin.o
LD .tmp_vmlinux.kallsyms1
ld.lld: error: undefined symbol: __stack_chk_guard
>>> referenced by irq-sun6i-r.c:309 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:309)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced by irq-sun6i-r.c:311 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:311)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced by irq-sun6i-r.c:0 (/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/drivers/irqchip/irq-sun6i-r.c:0)
>>> vmlinux.o:(sun6i_r_intc_init)
>>> referenced 39331 more times
make[2]: *** [/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx/Makefile:1277: vmlinux] Error 1
make[2]: Leaving directory '/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/out/target/product/evk_8mq/obj/KERNEL_OBJ'
make[1]: *** [Makefile:237: __sub-make] Error 2
make[1]: Leaving directory '/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/vendor/nxp-opensource/kernel_imx'
make: *** [/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/device/nxp/common/build/kernel.mk:197: /home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build/out/target/product/evk_8mq/obj/KERNEL_OBJ/arch/arm64/boot/Image.lz4] Error 2
make: Leaving directory '/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/android_build'

0 项奖励
回复
1 解答
8,311 次查看
xiayanfire
Contributor III

ANDROID_ROOT、CROSS_COMPILE、DISCIMAGE、KERNELDIR was definded with error path。

Problem resolved when I clean them

在原帖中查看解决方案

0 项奖励
回复
8 回复数
9,038 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hi @xiayanfire 

From the error log, it seems telling compile env on your host not set properly. The steps that you shared look fine, but one might need to confirm the step "1. Prepare the build environment for U-Boot and Linux kernel." 

 

Best regards

Harvey

0 项奖励
回复
9,006 次查看
xiayanfire
Contributor III

Thanks for your reply.

As the step "1. Prepare the build environment for U-Boot and Linux kernel."  

I have set the value of AARCH64_GCC_CROSS_COMPILE and CLANG_PATH

AARCH64_GCC_CROSS_COMPILE=/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

CLANG_PATH=/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/prebuilt-android-clang/linux-x86

All the environment value is saved in env.txt in the attachment 

 

Best regards

xiayanfire

0 项奖励
回复
8,312 次查看
xiayanfire
Contributor III

ANDROID_ROOT、CROSS_COMPILE、DISCIMAGE、KERNELDIR was definded with error path。

Problem resolved when I clean them

0 项奖励
回复
8,970 次查看
Harvey021
NXP TechSupport
NXP TechSupport

I think the version for GCC same as guide be better, and the path for clang is not correct.

 

Best regards

Havey

0 项奖励
回复
8,957 次查看
xiayanfire
Contributor III

I tried the same  version for GCC as guide :

ARCH64_GCC_CROSS_COMPILE=/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

But it still shows the same error when I compile the kernel。

That is why I wanted to change the version of gcc to gcc-arm-10.3。

Besides, the path of clang(CLANG_PATH=/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/prebuilt-android-clang/linux-x86) is correct,because I did not rename the path of clang. The detail info of clang is showed as belong:

/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/prebuilt-android-clang/linux-x86$ ls -l
total 192
-rw-rw-r-- 1 xiayan xiayan 10907 5月 12 17:31 Android.bp
-rw-rw-r-- 1 xiayan xiayan 4748 5月 12 17:27 BINUTILS_KERNEL_DEPRECATION.md
-rw-rw-r-- 1 xiayan xiayan 12581 5月 12 17:31 BUILD.bazel
-rw-rw-r-- 1 xiayan xiayan 16759 5月 12 17:31 cc_toolchain_config.bzl
-rw-rw-r-- 1 xiayan xiayan 7534 5月 12 17:31 cc_toolchain_constants.bzl
-rw-rw-r-- 1 xiayan xiayan 52500 5月 12 17:31 cc_toolchain_features.bzl
drwxrwxr-x 6 xiayan xiayan 4096 5月 12 17:27 clang-3289846
drwxrwxr-x 12 xiayan xiayan 4096 5月 12 17:31 clang-r416183b
drwxrwxr-x 11 xiayan xiayan 4096 5月 12 17:32 clang-r450784d
drwxrwxr-x 11 xiayan xiayan 4096 5月 12 17:27 clang-r450784e
drwxrwxr-x 5 xiayan xiayan 4096 5月 12 17:32 clang-stable
-rw-rw-r-- 1 xiayan xiayan 2467 5月 12 17:27 CleanSpec.mk
drwxrwxr-x 2 xiayan xiayan 4096 5月 12 17:32 docs
-rw-rw-r-- 1 xiayan xiayan 1244 5月 12 17:27 GCC_4_9_DEPRECATION.md
-rw-rw-r-- 1 xiayan xiayan 623 5月 12 17:29 go.mod
drwxrwxr-x 2 xiayan xiayan 4096 5月 12 17:32 llvm-binutils-stable
-rw-rw-r-- 1 xiayan xiayan 1277 5月 12 17:27 METADATA
-rw-rw-r-- 1 xiayan xiayan 377 5月 12 17:27 OWNERS
drwxrwxr-x 2 xiayan xiayan 4096 5月 12 17:32 profiles
-rw-rw-r-- 1 xiayan xiayan 12220 5月 12 17:31 README.md
-rw-rw-r-- 1 xiayan xiayan 7017 5月 12 17:27 RELEASE_NOTES.md
drwxrwxr-x 2 xiayan xiayan 4096 5月 12 17:32 soong

/home2/xiayan/workspace/leopard/imx-android-13.0.0_1.2.0/tools/prebuilt-android-clang/linux-x86$ git status
HEAD detached at 0fc0715d9
nothing to commit, working tree clean

 

I think that I had set the correct path of AARCH64_GCC_CROSS_COMPILE and CLANG_PATH。

Is there any other wrong env variant ?

Best regards

xiayanfire

0 项奖励
回复
8,949 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hope you have followed up the 2.1 Setting up your computer. 

if still problems, would suggest to have clean build. 

 

Best regards

Harvey

0 项奖励
回复
8,843 次查看
xiayanfire
Contributor III

@Harvey021 Is there other suggestion?

0 项奖励
回复
8,945 次查看
xiayanfire
Contributor III

Yes, I have followed up the "2.1 Setting up your computer".

My machine is a x86 physical machine with enough hardware resource.

And I have installed all the packages requested in guide again and again .

But the version of Ubuntu is different, it is 20.04.1 64-bit,not 18.04 64-bit. Does this have any effect?

I can not change the version of this machine, because many other people need to use it.

 

Best regards

xiayanfire

0 项奖励
回复