[Toybox] scripts/llvm-buildall.sh?

Patrick Oppenlander patrick.oppenlander at gmail.com
Tue Aug 3 17:05:02 PDT 2021


Hi Rob,

On Tue, Aug 3, 2021 at 7:08 PM Rob Landley <rob at landley.net> wrote:
>
> In https://landley.net/toybox/faq.html#cross there are three build options listed:
>
> 1) using your linux distro's host toolchain (probably glibc based)
>
> 2) using the Android NDK
>
> 3) using the musl+gcc toolchain I supply a scripts/mcm-buildall.sh to build
>
> (Except for #3 I won't post binaries of because GPLv3 is too toxic for me to
> mess with without a corporate legal department providing cover, which has
> admittedly been a limiting factor.)
>
> Recently I've been poking at adding Qualcomm Hexagon support to the
> https://landley.net/toybox/downloads/binaries/mkroot/latest/ target list, and
> hexagon only has upstream support in llvm, not in vanilla gcc. (Which is
> probably my fault actually; long story, related to
> https://landley.net/notes-2012.html#24-02-2012.)
>
> I started down this path because I found out last month that qemu had an llvm
> build script checked into its test suite, and I went down a longish rathole to
> make that work for me (starting at
> https://lists.nongnu.org/archive/html/qemu-devel/2021-07/msg02992.html and
> https://landley.net/notes-2021.html#12-07-2021 and eventually coming up with a
> working script at https://www.openwall.com/lists/musl/2021/07/25/2).
>
> Then I tried to genericize it to build more llvm targets and the "clang-rt"
> package (their libgcc replacement) is, um... extremely brittle.
> (https://landley.net/notes-2021.html#28-07-2021)
>
> What I'd LIKE to do is create a scripts/llvm-buildall.sh that builds all the
> supported musl+llvm targets the way mcm-buildall.sh does for musl+gcc. And
> getting llvm-project itself to do that was pretty straightforward (it builds
> them all by default). But clang-rt depends on the target libc headers being
> there first (...why?) and then the invocation is... yeah.

I mentioned on the musl list that I've had a go at this too.

Getting the llvm project & musl to play nice together is a pain. In
case you missed it, what I came up with is here:

https://github.com/apexrtos/musl-cross-make/blob/clang/litecross/Makefile.clang

Glossing over the finer details this basically boils down to:
* configure llvm
* do an llvm "distribution" build
* configure musl
* install musl headers
* do an llvm "builtins" build
* build musl
* install kernel headers
* do an llvm "runtimes" build

I also create symlinks & config files so that it looks like a normal
gcc style toolchain.

It would be nice if there was one well maintained place to go for an
llvm/musl build recipe.

> I'm currently reading https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html
> but the OTHER llvm toolchain I've been using is the Android NDK, and THAT
> successfully builds clang-rt for multiple architectures already:
>
>   android-ndk-r21d$ find . -name 'libclang_rt.*.so' | wc
>        22      22    2375
>   android-ndk-r21d$ find . -name 'libclang_rt.*.a' | wc
>        68      68    7284
>
> Plus it's building bionic from source, which would be nice to know how to do.
>
> So I looked at:
>
>   https://android.googlesource.com/platform/manifest/+/master-ndk/
>
> And, um... huh. Well, clang-rt is part of llvm-project so...
>
>   https://android.googlesource.com/toolchain/llvm-project/+/refs/heads/master
>
> Last updated in 2019?
>
> Am I looking in the wrong place?
>
> Confused,
>
> Rob

Patrick



More information about the Toybox mailing list