From: Rich Felker <dalias@libc.org>
To: "Jörg Krause" <jkrause@posteo.de>
Cc: musl@lists.openwall.com
Subject: Re: why is there no __MUSL__ macro?
Date: Fri, 12 Sep 2014 11:37:32 -0400 [thread overview]
Message-ID: <20140912153732.GQ23797@brightrain.aerifal.cx> (raw)
In-Reply-To: <5412A23A.6080503@posteo.de>
On Fri, Sep 12, 2014 at 09:35:22AM +0200, Jörg Krause wrote:
>
> On 09/11/2014 04:47 PM, Natanael Copa wrote:
> >On Thu, 11 Sep 2014 13:00:09 +0200
> >Jörg Krause <jkrause@posteo.de> wrote:
> >
> >>Hi,
> >>
> >>I am trying to add support for the musl toolchain to FFmpeg.
> >>
> >>FFmpeg needs support for library features defined in POSIX.1-2001 with
> >>XSI extension and the standards below. Currently configure probes the
> >>host and target libc by checking for defined macros like __GLIBC__ and
> >>__UCLIBC__. In case of glibc and uclibc it sets -D_XOPEN_SOURCE=600
> >>properly.
> >>
> >>After this it checks for some combinations of hardware and the probed
> >>libc to set some more compile options, if necessary.
> >>
> >>I know that musl does not have a macro __MUSL__ and I have read the
> >>explanation. However, I don't understand what's meant by "[..] it's a
> >>bug to assume a certain implementation has particular properties rather
> >>than testing." and how does it affect the way FFmpeg probes for the libc.
> >>
> >>What could be a solution which supports musl?
> >>
> >>Many thanks!
> >>Jörg
> >This is what we do on alpine linux:
> >http://git.alpinelinux.org/cgit/aports/tree/main/ffmpeg/fix-defines.patch
> >
> >--- ffmpeg-1.2.2.orig/libavutil/error.c
> >+++ ffmpeg-1.2.2/libavutil/error.c
> >@@ -17,6 +17,7 @@
> > */
> > #undef _GNU_SOURCE
> >+#define _XOPEN_SOURCE 600
> > #include "avutil.h"
> > #include "avstring.h"
> > #include "common.h"
> >
>
> Hi Natanal,
>
> I had a look to alpine already. I submitted this patch to FFmpeg,
> but building FFmpeg with my configuration libavutils/error.c is not
> the only file which needs a feature test macro. The people of FFmpeg
> did not like the idea to have a lot of test macros in there source
> so I stopped with this solution and looked for a way to adopt the
> musl toolchain to their configure file.
It might work to add -D_DEFAULT_SOURCE (note: not available until
recent musl git) or -D_BSD_SOURCE to the global CFLAGS.
What's happening, I think, is that because -std=c99 or similar is in
the CFLAGS, default feature profile is getting suppressed, and
_GNU_SOURCE is the only thing bringing back the usual features (in
addition to lots of _GNU_SOURCE-only stuff, and strerror_r breakage).
Having at least one more feature test macro defined globally would
prevent this.
Note also that modern glibc supports _DEFAULT_SOURCE, with the same
semantics as musl: keeping the default stuff exposed even when a
-std=* option would otherwise suppress it.
Rich
prev parent reply other threads:[~2014-09-12 15:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 11:00 Jörg Krause
2014-09-11 11:09 ` Laurent Bercot
2014-09-11 11:17 ` Szabolcs Nagy
2014-09-11 12:02 ` Jörg Krause
2014-09-11 12:38 ` Szabolcs Nagy
2014-09-11 13:33 ` Jörg Krause
2014-09-11 14:48 ` Szabolcs Nagy
2014-09-11 14:30 ` Christian Neukirchen
2014-09-11 11:17 ` Jens
2014-09-11 12:24 ` Jörg Krause
2014-09-11 14:53 ` Isaac Dunham
2014-09-12 7:39 ` Jörg Krause
2014-09-11 14:47 ` Natanael Copa
2014-09-12 7:35 ` Jörg Krause
2014-09-12 15:37 ` Rich Felker [this message]
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=20140912153732.GQ23797@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=jkrause@posteo.de \
--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).