<div dir="ltr"><div dir="ltr">Thanks for the info. <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 9, 2019 at 5:58 PM Peter Smith <<a href="mailto:peter.smith@linaro.org">peter.smith@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 9 Aug 2019 at 00:14, Xia Zhou via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hello,<br>
> I want to build LLVM/Compiler-rt for baremetal targets like Cortex-M3. By adopting CMake options from <a href="http://llvm.1065342.n5.nabble.com/llvm-dev-Compiling-for-baremetal-ARMv4-on-Ubuntu-Linux-tp124226p124500.html" rel="noreferrer" target="_blank">http://llvm.1065342.n5.nabble.com/llvm-dev-Compiling-for-baremetal-ARMv4-on-Ubuntu-Linux-tp124226p124500.html</a>, I can only build "libclang_rt.builtins-x86_64.a" in lib/linux, but what I want to build is "libclang_rt.builtins.arm.a".<br>
><br>
> My CMake options are:<br>
> cmake -G Ninja DBAREMETAL_ARMV6M_SYSROOT=${ARMEABI5GCC} -DBAREMETAL_ARMV7M_SYSROOT=${ARMEABI5GCC} -DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABI5GCC} -DCMAKE_BUILD_TYPE=Release -C/home/llvm-project/clang/cmake/caches/BaremetalARM.cmake /home/llvm-project/llvm/runtimes/compiler-rt<br>
><br>
> with<br>
> echo $ARMEABI5GCC<br>
> /home/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi<br>
><br>
> Does anyone know how to fix this problem?<br>
<br>
I can get you a bit further but it looks like that particular CMake<br>
recipe has bitrotted as it doesn't work at all with the monorepo<br>
layout, and looks like it has some problems even with the old<br>
directory layout.<br>
<br>
Going from a monorepo I did the following:<br>
cd /path/to/llvm-project/llvm/runtimes<br>
ln -s /path/to/llvm-project/compiler-rt compiler-rt<br>
cd /path/to/llvm-project/llvm/tools<br>
ln -s /path/to/llvm-project/clang clang<br>
ln -s /path/to/llvm-project/lld lld<br>
cmake -G Ninja DBAREMETAL_ARMV6M_SYSROOT=${ARMEABI5GCC}<br>
-DBAREMETAL_ARMV7M_SYSROOT=${ARMEABI5GCC}<br>
-DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABI5GCC} -DCMAKE_BUILD_TYPE=Release<br>
-C/path/to/llvm-project/clang/cmake/caches/BaremetalARM.cmake<br>
/path/to/llvm-project/llvm<br>
<br>
This will attempt to build the builtins for cortex-m, unfortunately it<br>
will fail due to a couple of reasons:<br>
- Several CMAKE variables passed in by the recipe are ignored by the<br>
builtins, which is likely the root cause of the failures.<br>
- The -DCMAKE_SYSROOT= $ARMEABI5GCC is passed through correctly,<br>
unfortunately this doesn't result in a --sysroot=$ARMEABI5GCC being<br>
passed to the compile commands so they fail with can't find stddef.h<br>
<br>
I strongly recommend not using the recipe and instead feeding the<br>
CMake for the builtins directly. There is some information in<br>
<a href="https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html" rel="noreferrer" target="_blank">https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html</a><br>
<br>
Peter<br>
<br>
> Thanks in advance!<br>
> Xia Zhou<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>