Xia Zhou via llvm-dev
2019-Aug-07 13:39 UTC
[llvm-dev] Compiling compiler-rt for baremetal CortexM on Ubuntu Linux
Hello, I want to build LLVM/Compiler-rt for baremetal targets like Cortex-M3. By adopting CMake options from http://llvm.1065342.n5.nabble.com/llvm-dev-Compiling-for-baremetal-ARMv4-on-Ubuntu-Linux-tp124226p124500.html, 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". My CMake options are: 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 with echo $ARMEABI5GCC /home/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi Does anyone know how to fix this problem? Thanks in advance! Xia Zhou -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190807/b3184e78/attachment.html>
Peter Smith via llvm-dev
2019-Aug-09 09:58 UTC
[llvm-dev] Compiling compiler-rt for baremetal CortexM on Ubuntu Linux
On Fri, 9 Aug 2019 at 00:14, Xia Zhou via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hello, > I want to build LLVM/Compiler-rt for baremetal targets like Cortex-M3. By adopting CMake options from http://llvm.1065342.n5.nabble.com/llvm-dev-Compiling-for-baremetal-ARMv4-on-Ubuntu-Linux-tp124226p124500.html, 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". > > My CMake options are: > 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 > > with > echo $ARMEABI5GCC > /home/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi > > Does anyone know how to fix this problem?I can get you a bit further but it looks like that particular CMake recipe has bitrotted as it doesn't work at all with the monorepo layout, and looks like it has some problems even with the old directory layout. Going from a monorepo I did the following: cd /path/to/llvm-project/llvm/runtimes ln -s /path/to/llvm-project/compiler-rt compiler-rt cd /path/to/llvm-project/llvm/tools ln -s /path/to/llvm-project/clang clang ln -s /path/to/llvm-project/lld lld cmake -G Ninja DBAREMETAL_ARMV6M_SYSROOT=${ARMEABI5GCC} -DBAREMETAL_ARMV7M_SYSROOT=${ARMEABI5GCC} -DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABI5GCC} -DCMAKE_BUILD_TYPE=Release -C/path/to/llvm-project/clang/cmake/caches/BaremetalARM.cmake /path/to/llvm-project/llvm This will attempt to build the builtins for cortex-m, unfortunately it will fail due to a couple of reasons: - Several CMAKE variables passed in by the recipe are ignored by the builtins, which is likely the root cause of the failures. - The -DCMAKE_SYSROOT= $ARMEABI5GCC is passed through correctly, unfortunately this doesn't result in a --sysroot=$ARMEABI5GCC being passed to the compile commands so they fail with can't find stddef.h I strongly recommend not using the recipe and instead feeding the CMake for the builtins directly. There is some information in https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html Peter> Thanks in advance! > Xia Zhou > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Xia Zhou via llvm-dev
2019-Aug-17 14:33 UTC
[llvm-dev] Compiling compiler-rt for baremetal CortexM on Ubuntu Linux
Thanks for the info. On Fri, Aug 9, 2019 at 5:58 PM Peter Smith <peter.smith at linaro.org> wrote:> On Fri, 9 Aug 2019 at 00:14, Xia Zhou via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Hello, > > I want to build LLVM/Compiler-rt for baremetal targets like Cortex-M3. > By adopting CMake options from > http://llvm.1065342.n5.nabble.com/llvm-dev-Compiling-for-baremetal-ARMv4-on-Ubuntu-Linux-tp124226p124500.html, > 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". > > > > My CMake options are: > > 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 > > > > with > > echo $ARMEABI5GCC > > /home/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi > > > > Does anyone know how to fix this problem? > > I can get you a bit further but it looks like that particular CMake > recipe has bitrotted as it doesn't work at all with the monorepo > layout, and looks like it has some problems even with the old > directory layout. > > Going from a monorepo I did the following: > cd /path/to/llvm-project/llvm/runtimes > ln -s /path/to/llvm-project/compiler-rt compiler-rt > cd /path/to/llvm-project/llvm/tools > ln -s /path/to/llvm-project/clang clang > ln -s /path/to/llvm-project/lld lld > cmake -G Ninja DBAREMETAL_ARMV6M_SYSROOT=${ARMEABI5GCC} > -DBAREMETAL_ARMV7M_SYSROOT=${ARMEABI5GCC} > -DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABI5GCC} -DCMAKE_BUILD_TYPE=Release > -C/path/to/llvm-project/clang/cmake/caches/BaremetalARM.cmake > /path/to/llvm-project/llvm > > This will attempt to build the builtins for cortex-m, unfortunately it > will fail due to a couple of reasons: > - Several CMAKE variables passed in by the recipe are ignored by the > builtins, which is likely the root cause of the failures. > - The -DCMAKE_SYSROOT= $ARMEABI5GCC is passed through correctly, > unfortunately this doesn't result in a --sysroot=$ARMEABI5GCC being > passed to the compile commands so they fail with can't find stddef.h > > I strongly recommend not using the recipe and instead feeding the > CMake for the builtins directly. There is some information in > https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html > > Peter > > > Thanks in advance! > > Xia Zhou > > _______________________________________________ > > 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/20190817/08e1feb6/attachment-0001.html>