[llvm-dev] Cross compile x64 to AArch64 issues

Derrick McKee via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 9 08:38:00 PDT 2020


Hi,

I am trying to cross compile release-10.x to AArch64
(target=aarch64-linux-gnu), and the directions listed at [1] are not
completing the initial cmake step.  I'm currently running Manjaro,
with the aarch64-linux-gnu package (and associated binutils, headers,
and glibc packages).  My cmake command is

cmake -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=`realpath
install` -DLLVM_TABLEGEN=`realpath
../build-10.x/install/bin/llvm-tblgen`
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu
-DLLVM_TARGET_ARCH=AArch64 -DLLVM_TARGETS_TO_BUILD=AArch64
-DCMAKE_CXX_FLAGS="-target aarch64-linux-gnu
--sysroot=/usr/aarch64-linux-gnu
-L/usr/lib/gcc/aarch64-linux-gnu/10.1.0" -DCMAKE_C_COMPILER=`realpath
../build-10.x/install/bin/clang` -DCMAKE_CXX_COMPILER=`realpath
../build-10.x/install/bin/clang++`
-DLLVM_ENABLE_PROJECTS="compiler-rt" -DLLVM_ENABLE_ZLIB=False
-DLLVM_INCLUDE_TESTS=False -G Ninja ../llvm

Does anyone see any obvious misconfiguration?  Cmake fails at the
early test for a working CXX compiler:

/usr/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory

I have confirmed that crtbegin.o exists in /usr/lib/gcc/aarch64-linux-gnu/10.1.0

If I copy /usr/lib/gcc/aarch64-linux-gnu/10.1.0/{crtbegin,crtend}.o to
/usr/aarch64-linux-gnu/lib the check passed, but then the
LLVM_LIBSTDCXX_MIN check fails.  However, checking CMakeErrors.log,
the failing program can be compiled with my system
aarch64-linux-gnu-g++.  Barring any misconfiguration, I think that the
build system is not correctly using the sysroot and gcc-toolchain
paths correctly.


[1]: https://llvm.org/docs/HowToCrossCompileLLVM.html


-- 
Derrick McKee
Phone: (703) 957-9362
Email: derrick.mckee at gmail.com


More information about the llvm-dev mailing list