'How to cross-compile for aarch64 using clang?
I want to cross-compile for aarch64 using clang, but I got an error.
I worked on Ubuntu 16.04.
I compiled the source file with command:
clang -target aarch64 -B/home/xxx/op-tee-v8/toolchains/aarch64/aarch64-linux-gnu/bin/ 1.cpp
1.cpp is the file that I want to cross compile.
Then I got an error:
/home/xxx/op-tee-v8/toolchains/aarch64/aarch64-linux-gnu/bin/ld: unrecognised emulation mode: elf_x86_64
Supported emulations: aarch64linux aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi
collect2: error: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
Solution 1:[1]
Try installing binutils-aarch64-linux-gnu, this installs the right linker needed. You might also need to install libc6-arm64-cross, libc6-dev-arm64-cross, crossbuild-essential-arm64.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aditi Partap |
