[FFmpeg-devel] Problem with cross compilation / need guidance for patch submission

Edouard Gomez ed.gomez
Sun Oct 12 18:14:55 CEST 2008


I will need some help from diego or mans, as they're listed s being build system

I got some problems getting libavcodec linking with vlc lately when cross
compiling it. libavcodec was refering to faac symbols as being __cdecl instead
of __stdcall.

I narrowed the problem down to the -std=c99 flag that is now used during ffmpeg

The following commands show what the problem is:
A simple test like this prove my sayings:
$ touch blah.c
$ i386-mingw32-gcc -dM -E blah.c | grep WIN32
#define _WIN32 1
#define __WIN32 1
#define __WIN32__ 1
#define WIN32 1
$ i386-mingw32-gcc -std=c99 -dM -E blah.c | grep WIN32
#define _WIN32 1
#define __WIN32 1
#define __WIN32__ 1

As you see gcc is following the C99 standard by forcing all
system defines being prefixed by at least one underscore.

Couple that with the fact that faac.h has this kind of code:
#ifdef WIN32
# ifndef FAACAPI
#  define FAACAPI __stdcall
# endif
# ifndef FAACAPI
#  define FAACAPI
# endif

And you get a win32 cross compiled libavcodec that has deps on unknown symbols
because faac is compiled with WIN32 defined.

There are two solutions:
 - add a #define WIN32 when _WIN32 is defined in the required
   files, as of today, i think only libfaac requires it. But libxvid, 
   libmp3lame etc... need some review to make sure they don't depend on the 
   define as well.
 - add -DWIN32 when compiling for the win32 platform. Requires adding a CFLAG 
   during configure.

Please give me some advise on which method you prefer and i'll submit a patch.

Edouard Gomez

More information about the ffmpeg-devel mailing list