[FFmpeg-devel] [PATCH] fix implicit function declarations without _XOPEN_SOURCE

Adrian Stutz adrian
Mon Aug 25 17:43:41 CEST 2008


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.<https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel>


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.

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.
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.

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.

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
#endif

--
Adrian




More information about the ffmpeg-devel mailing list