[Toybox] scripts/llvm-buildall.sh?
Rob Landley
rob at landley.net
Wed Aug 4 04:11:23 PDT 2021
On 8/3/21 7:05 PM, Patrick Oppenlander wrote:
>> 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.
Dig dig dig...
https://www.openwall.com/lists/musl/2021/07/26/3
Ooh, very nice. Thanks.
> 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
Let's see...
I made it to the giant span of "foreach" starting on line 49 and had to stop for
health reasons.
> 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
The builtins depending on the libc headers is outright disgusting. (This does,
however, imply that they don't depend on the LINUX headers, which is... My brain
hurts.)
The next question is, of course, WHY compiler-rt depends on the libc headers.
And if it's GOING to depend on a header file:
https://github.com/torvalds/linux/blob/master/tools/include/nolibc/nolibc.h
Says it's MIT licensed right at the top...
By the way, I tried to subscribe to the llvm-dev mailing list but
https://lists.llvm.org/mailman/listinfo/llvm-dev is disabled and emailing that
subscribe@ thing multiple times has not gotten a response. That development
community is approximately as welcoming to outsiders as xfree86 was.
> * 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.
The kernel needs to learn that $CROSS-cc is a good compiler name, and $CROSS-gcc
is not. And:
https://github.com/torvalds/linux/blob/v5.13/Makefile#L434
Is just painful. Unfortunately, I'm not sure how you'd say "use the first of
${CROSS_COMPILE}{clang,gcc,cc} that exists" in Makefile syntax. The foreach
stuff expands ALL of them, doesn't seem to have a "break" construct. (And of
course musl does it in shell script, which is the sane way to do it. :)
> It would be nice if there was one well maintained place to go for an
> llvm/musl build recipe.
I dunno about "well maintained" but if I can get it to work I'm happy to provide
a script, and possibly even host binaries although a gigabyte tarball is a bit
of a stretch for my hosting...
Rob
More information about the Toybox
mailing list