[llvm-dev] Cross compiling C++ program
Goran Mekić via llvm-dev
llvm-dev at lists.llvm.org
Sat Aug 5 06:41:25 PDT 2017
On Fri, Aug 04, 2017 at 04:40:44PM -0600, Jonathan Roelofs wrote:
> Might be a helpful exercise for you to try building vanilla clang with
> runtimes for the host, before worrying about how to build everything for
> your baremetal case:
> http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary
So I did. :o) It was fun realizing how much Release type reduces LD memory usage :o)
Anyway, just to be clear what "I did" means:
- llvm sources from trunk and projects/tools repos checkout under llvm
- clang-6.0 compiles "Hello World"
- make check-all fails (not sure I'm not causing it)
- make install creates everything under PREFIX
# cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX=/tmp/x86-sysroot ../../source/llvm
# make -j4
# make install
It was fun learning how to manualy compile compiler for the first time. Now how to cross compile for bare? Given that I have musl-1.1.16 directory and that I'm preseeding sysroot with:
# rm -rf /tmp/barearm-sysroot
# mkdir -p /tmp/barearm-sysroot
# cp -r musl-1.1.16/include /tmp/barearm-sysroot/ # Thanx for the tip!
So I tried to use it, and clang/llvm build, but compiler-rt fails:
# cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DBAREMETAL_ARMV7EM_SYSROOT=/tmp/barearm-sysroot -DCMAKE_INSTALL_PREFIX=/tmp/barearm-sysroot -C ../../source/llvm/cmake/caches/BaremetalARM.cmake ../../source/llvm
# make -j4
https://gist.github.com/anonymous/85cd5081a6d46a63731d970ee95b20b4
This is the BaremetalARM.cmake:
https://gist.github.com/anonymous/ff3248f08ddc99361dcc009e9f4c1020
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170805/d256baa8/attachment.sig>
More information about the llvm-dev
mailing list