config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support for musl


From: Henri
Subject: Re: Support for musl
Date: Thu, 25 Jan 2018 17:35:10 +1300

On Thu, 2018-01-25 at 16:14 +1300, Henri wrote:
> On Thu, 2018-01-25 at 13:58 +1100, Ben Elliston wrote:
> > 
> > On Thu, Jan 25, 2018 at 03:46:59PM +1300, Henri wrote:
> > 
> > > 
> > > 
> > > The config.guess script currently only checks for the glibc, uclibc,
> > > and dietlibc libraries. The attached patch adds support for the musl
> > > C library. Unfortunately, features.h in musl does not define a
> > > __MUSL__ macro (or similar) which is why this has to be the new
> > > default case instead of glibc. If features.h or a C compiler are not
> > > available it will default to gnu as before.
> > I'm not crash hot on this patch, sorry.  The next time we get a new C
> > library that also fails to identify itself through some means, we're
> > hosed as we won't be able to distinguish it from MUSL.
> >  
> > Can you please add some mechanism to MUSL and then we can check for
> > that?  Obviously there will be a period where old MUSL versions won't
> > be guessed, but the user can specify those with --build, --host or
> > --target.
> Sorry, I am not a musl developer and their policy strictly forbids identifying
> itself, see the
> section "Why is there no __MUSL__ macro?" in the FAQ at https://wiki.musl-libc
> .org/faq.html
> 
> Another option to determine the libc version would be to parse the output of
> "ldd --version".  On
> Ubuntu this gives
> 
> $ ldd --version
> ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23
> ...
> 
> And on the musl-based Alpine Linux
> 
> $ ldd --version
> musl libc (x86_64)
> Version 1.1.18
> ...
> 
> However I am neither sure whether ldd is required by POSIX nor whether it is
> required to report the
> libc version.

I just found that GCC is able to produce the desired version info by itself

On Ubuntu:
$ gcc -dumpmachine
x86_64-linux-gnu

On Alpine:
$ gcc -dumpmachine
x86_64-alpine-linux-musl

This would not add any additional dependency, because GCC is required already.
It also dates back to GCC 3.0 which was released on June 18, 2001.
https://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_3.html#IDX287

Unfortunately the output is a bit non-deterministic.

On Debian 32-bit:
$ gcc -dumpmachine
i686-linux-gnu

On Alpine 32-bit:
$ gcc -dumpmachine
i586-alpine-linux-musl

Not only does Alpine add its own name, it also chooses i586 instead of i686.
I'll take a look at their GCC build script to see whether this is done
deliberately.

> 
> Best regards, Henri
> 
> > 
> > 
> > Cheers, Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]