<div dir="auto">Hello,<div dir="auto"><br></div><div dir="auto">I would recommend checking the CMake documentation about cross compiling and creating a CMake toolchain file.</div><div dir="auto"><br></div><div dir="auto">The current flags you pass are not instructing CMake about the config checks.</div><div dir="auto"><br></div><div dir="auto"><a href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html">https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html</a><br></div><div dir="auto"><br></div><div dir="auto">Hope this helps!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 9, 2020, 17:38 Derrick McKee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am trying to cross compile release-10.x to AArch64<br>
(target=aarch64-linux-gnu), and the directions listed at [1] are not<br>
completing the initial cmake step.  I'm currently running Manjaro,<br>
with the aarch64-linux-gnu package (and associated binutils, headers,<br>
and glibc packages).  My cmake command is<br>
<br>
cmake -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=`realpath<br>
install` -DLLVM_TABLEGEN=`realpath<br>
../build-10.x/install/bin/llvm-tblgen`<br>
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu<br>
-DLLVM_TARGET_ARCH=AArch64 -DLLVM_TARGETS_TO_BUILD=AArch64<br>
-DCMAKE_CXX_FLAGS="-target aarch64-linux-gnu<br>
--sysroot=/usr/aarch64-linux-gnu<br>
-L/usr/lib/gcc/aarch64-linux-gnu/10.1.0" -DCMAKE_C_COMPILER=`realpath<br>
../build-10.x/install/bin/clang` -DCMAKE_CXX_COMPILER=`realpath<br>
../build-10.x/install/bin/clang++`<br>
-DLLVM_ENABLE_PROJECTS="compiler-rt" -DLLVM_ENABLE_ZLIB=False<br>
-DLLVM_INCLUDE_TESTS=False -G Ninja ../llvm<br>
<br>
Does anyone see any obvious misconfiguration?  Cmake fails at the<br>
early test for a working CXX compiler:<br>
<br>
/usr/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory<br>
<br>
I have confirmed that crtbegin.o exists in /usr/lib/gcc/aarch64-linux-gnu/10.1.0<br>
<br>
If I copy /usr/lib/gcc/aarch64-linux-gnu/10.1.0/{crtbegin,crtend}.o to<br>
/usr/aarch64-linux-gnu/lib the check passed, but then the<br>
LLVM_LIBSTDCXX_MIN check fails.  However, checking CMakeErrors.log,<br>
the failing program can be compiled with my system<br>
aarch64-linux-gnu-g++.  Barring any misconfiguration, I think that the<br>
build system is not correctly using the sysroot and gcc-toolchain<br>
paths correctly.<br>
<br>
<br>
[1]: <a href="https://llvm.org/docs/HowToCrossCompileLLVM.html" rel="noreferrer noreferrer" target="_blank">https://llvm.org/docs/HowToCrossCompileLLVM.html</a><br>
<br>
<br>
-- <br>
Derrick McKee<br>
Phone: (703) 957-9362<br>
Email: <a href="mailto:derrick.mckee@gmail.com" target="_blank" rel="noreferrer">derrick.mckee@gmail.com</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>