[llvm-dev] Cross compiling C++ program

Goran Mekić via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 5 14:47:02 PDT 2017


On Sat, Aug 05, 2017 at 09:19:57AM -0500, Richard Pennington via llvm-dev wrote:
> On 08/05/2017 08:41 AM, Goran Mekić via llvm-dev wrote:
>
> >
> > 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
> It is slightly tricky to compile compile musl and compiler-rt. The bits
> directory is populated when you install musl, but musl needs compiler-rt
> built if you want to build libc.so.
> The solution that works is to first do a "make install-headers" on musl,
> then build compiler-rt, then build musl. If you look at the ELLCC
> make-libraries and build-musl scripts, you'll see how ELLCC does it. Or
> you can disable building the musl shared library.
Thanx for this. I got to libunwind (libcxxabi expects it as dependency) and this is the error I get:

# set -xg CC /tmp/barearm-sysroot/bin/clang-6.0
# set -xg CXX /tmp/barearm-sysroot/bin/clang-6.0
# 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/libunwind
# make -j4 VERBOSE=1
https://gist.github.com/anonymous/b3a211e90808058a2c0b083154ddf5c7

> The other problem you'll run into is that musl is nowhere near bare
> metal. It's whole purpose in life is to turn the C standard library
> calls into Linux system calls. While a baremetal version of musl would
> be very nice to have, it is a non-trivial project.  Baremetal is what
> something like NuttX's C library provides.
I know, but I though that this is how ELLCC is built, too. Baremetal clang build with musl not having much to with libc that NuttX uses. Also, I though this is a way to create sysroot. Am I wrong?
-------------- 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/81dbc7bb/attachment.sig>


More information about the llvm-dev mailing list