mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Detecting musl at compile and/or configure time
Date: Sat, 29 Jun 2019 15:58:59 +0200	[thread overview]
Message-ID: <20190629135859.GA21055@port70.net> (raw)
In-Reply-To: <20425c39-b411-b9bb-1e83-bf26dbcd7d4d@adelielinux.org>

* A. Wilcox <awilfox@adelielinux.org> [2019-06-29 08:27:50 -0500]:
> On 06/29/19 06:48, Chris Hall wrote:
> > 
> > Is there a supported way of detecting that one is building against the
> > musl libc ?
> > 
> > At compile time I can, of course, detect glibc because it sets __GLIBC__
> > etc.  For macOS I can see _DARWIN_FEATURE_xxx macros.  The BSDs mostly
> > give themselves away.  But for musl I have not found anything :-(
> > 
> > Chris
> 
> 
> The musl libc specifically does not have a FTM (feature test macro)
> because it aims to be an exact implementation of C11 / POSIX and
> therefore it has no "quirks" to detect.

that's not entirely true.

there are some standard macros in posix to test optional features.

and musl implements various extensions to the standard.

note that __GLIBC__ does not detect glibc: uclibc defines it too.

you really want to configure check for particular features
instead of detecting the libc (which is a moving target,
ppl can patch it or change it over time)

> 
> If there are bugs in musl libc, the authors prefer if you report them
> and have them fixed, instead of making your software look for __MUSL__
> and then assume all musl versions will always have that bug.
> 
> See here for more information:
> 
> https://wiki.musl-libc.org/faq.html#Q:-Why-is-there-no-%3Ccode%3E__MUSL__%3C/code%3E-macro?
> 
> https://www.openwall.com/lists/musl/2013/03/29/13
> 
> Is there a reason you wish to detect musl at configure/compile time?
> Perhaps if we knew the reason, we could help you make your code more
> portable and/or not require such detection.
> 
> Best to you and yours,
> --arw
> 
> 
> -- 
> A. Wilcox (awilfox)
> Project Lead, Adélie Linux
> https://www.adelielinux.org
> 





  reply	other threads:[~2019-06-29 13:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1561802993.8028.ezmlm@lists.openwall.com>
2019-06-29 11:48 ` Chris Hall
2019-06-29 13:27   ` A. Wilcox
2019-06-29 13:58     ` Szabolcs Nagy [this message]
2019-06-30 11:48       ` Chris Hall
2019-07-07 18:17         ` malloc() alignment and max_align_t Chris Hall
2019-07-07 19:22           ` Markus Wichmann
2019-07-08  0:16             ` Rich Felker
     [not found] <26f5537f-a876-209c-a27c-cd2619f5c834@gmch.uk>
2019-06-30 12:03 ` Fwd: Re: Detecting musl at compile and/or configure time Chris Hall
2019-06-30 12:28   ` Samuel Holland
2019-06-30 14:30     ` Chris Hall
2019-06-30 14:54     ` Jeffrey Walton
2019-07-02 12:19     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190629135859.GA21055@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).