[llvm-dev] Cross compile x64 to AArch64 issues

Tobias Hieta via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 9 21:54:50 PDT 2020


Hello,

I would recommend checking the CMake documentation about cross compiling
and creating a CMake toolchain file.

The current flags you pass are not instructing CMake about the config
checks.

https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html

Hope this helps!

On Tue, Jun 9, 2020, 17:38 Derrick McKee via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200610/d0e2ee89/attachment.html>


More information about the llvm-dev mailing list