[FFmpeg-devel] [PATCH] fix implicit function declarations without _XOPEN_SOURCE
Mon Aug 25 18:03:12 CEST 2008
"Adrian Stutz" <adrian at sttz.ch> writes:
> On Mon, Aug 25, 2008 at 4:58 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
>> strtod() is defined by C99, has been in POSIX since Issue 1, and
>> was included in SVID prior to that. Sounds to me like osx has some
>> catching up to do.
> OSX does have strtod(). That's not the problem.
> To ensure backwards compatibility, the newest version of OSX has
> postfixed all functions that have been adapted to fully comply to
> UNIX03 with "$UNIX2003". All code compiled on OSX 10.5 links to
> those new symbols, while legacy code from 10.4 still links to the
> same old unpostfixed symbols.
This is similar in principle to ELF symbol versioning used in
e.g. glibc. There is nothing wrong with such a scheme, provided it is
completely transparent to the programmer.
> Though you still want to compile 10.4-compatible code on 10.5, that
> doesn't link to the $UNIX2003 postfixed symbols available only on
> 10.5. You can do this with the -mmacosx-version-min compiler
> option. If you set _XOPEN_SOURCE however, OSX ignores that option
> and links to the new functions anyway.
Are you saying the compiler adds the version tag to the symbols?
That's a weird way of doing it.
> Then, when the linker tries to link against the 10.4 SDK, it cannot
> find the postfixed symbols because they weren't defined in older
> versions of OSX.
This situation is known as a version mismatch. In this case, the
linker is using a different library different from what the compiler
expected, and some symbols are missing. You need to figure out how to
make the compiler expect the older library, or how to point the linker
at a newer version.
> The regular not-postfixed symbols are there, however. It's just that the
> compiler ignores that it's compiling for an older version whenever it
> encounters the _XOPEN_SOURCE flag.
Our code conforms to widely accepted standards. Your compiler decides
to replace a few symbols with non-standard names, which the linker
then cannot find. Around here, that's called Your Problem.
> To fix compiling on OSX for older versions, all _XOPEN_SOURCE
> definitions should check for __APPLE__ first.
> #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
> # define _XOPEN_SOURCE 500
In my part of the world, when there's a hole in the road, they don't
require people to mount wings on their cars; they fix the hole. You
should do the same. Or stay home.
mans at mansr.com
More information about the ffmpeg-devel