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

Adrian Stutz adrian
Mon Aug 25 15:39:23 CEST 2008


This patch broke compiling on OSX 10.5 against the 10.4 SDK.

The problem seems to be that _XOPEN_SOURCE forces _DARWIN_UNIX03. OSX
Leopard introduced full UNIX 03 compatibility and postfixed all relevant
symbols with $UNIX2003. To compile with backward compatibility,
mmacosx-version-min has to be set to compile against the old not-suffixed

_XOPEN_SOURCE is set in libavcodec/utils.c and forces it to compile against
the UNIX03 symbols. This causes a undefined symbol error when trying to link
> Undefined symbols:
>  "_strtod$UNIX2003", referenced from:
>      _av_parse_video_frame_rate in libavcodec.a(utils.o)
> ld: symbol(s) not found

Removing _XOPEN_SOURCE from utils.c makes libavcodec link correctly again.

Or that's at least what I could gather. Here's some more information:


On Wed, Aug 13, 2008 at 11:40:47PM +0200, Aurelien Jacobs wrote:
> Hi,
> When compiling without _XOPEN_SOURCE defined globally, there are a few
> "implicit function declaration" warnings appearing. This might cause
> serious trouble on 64 bits arch (segfault, etc...).
> Attached patch adds a few define to some files, to ensure the prototypes
> of the following functions are imported:
> - usleep()
> - mkstemp()
> - gethostname()
> - inet_aton()
> With this patch applied, I think that global _XOPEN_SOURCE can definitely
> be dropped, without any kind of trouble.
> Aurel

More information about the ffmpeg-devel mailing list