aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mthumb’

546 views Asked by At

I'm collecting tee.bin for aarm64 rockchip-rk3399. Set the environment variable: compiler, platform. But during assembly it complains about errors. https://optee.readthedocs.io

Download the code for build. Installed the environment
cd /opt
git clone https://github.com/OP-TEE/optee_os.git
cd ./optee_os
user@ubuntu#export
declare -x CFG_TEE_CORE_LOG_LEVEL="4"
declare -x CROSS_COMPILE="/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
declare -x PATH="/usr/lib/:/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux- gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
declare -x PLATFORM="rockchip-rk3399"
Start the build
user@ubuntu# make
.....
CHK out/arm-plat-rockchip/conf.mk
CHK out/arm-plat-rockchip/include/generated/conf.h
CHK out/arm-plat-rockchip/core/include/generated/asm-defines.h
CC out/arm-plat-rockchip/ta_arm32-lib/libdl/dlfcn.o
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mthumb’
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-unaligned-access’; did you mean ‘-Wno-aligned-new’?
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mfloat-abi=hard’
make: *** [mk/compile.mk:165: out/arm-plat-rockchip/ta_arm32-lib/libdl/dlfcn.o] Error 1

Run build install custom CROSS_COMPILE

make CROSS_COMPILE=/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin

3min build and error

OBJDUMP out/arm-plat-rockchip/core/tee.dmp
GEN out/arm-plat-rockchip/core/tee.bin
GEN out/arm-plat-rockchip/core/tee-header_v2.bin
GEN out/arm-plat-rockchip/core/tee-pager_v2.bin
GEN out/arm-plat-rockchip/core/tee-pageable_v2.bin
GEN out/arm-plat-rockchip/core/tee.symb_sizes
GEN out/arm-plat-rockchip/core/tee-raw.bin
OBJDUMP out/arm-plat-rockchip/ldelf/ldelf.dmp
CC out/arm-plat-rockchip/ta_arm32-lib/libdl/dlfcn.o
bash: line 1: /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bingcc: No such file or directory
make: *** [mk/compile.mk:165: out/arm-plat-rockchip/ta_arm32-lib/libdl/dlfcn.o] Error 127

3

There are 3 answers

2
DJ_Davey On

It could be a missing dependency, maybe try running sudo apt-get update && sudo apt-get upgrade first.

1
DJ_Davey On

I can only assume something is missing here. The '-m..' errors could be missing maths dependencies. gcc - am I right in thinking that is the gnu c++ compiler? Maybe the compiler lacks a library? You can try adding -lm to the end of your gcc command to include the maths library.

1
Ivan Baranov On

compiled successfully using the clang-12.0.0 compiler