[FFmpeg-devel] Problem with cross compilation / need guidance for patch submission
Måns Rullgård
mans
Sun Oct 12 18:31:28 CEST 2008
Edouard Gomez <ed.gomez at free.fr> writes:
> Hello,
>
> I will need some help from diego or mans, as they're listed s being
> build system maintainers.
>
> 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 compilation.
>
> 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
> #else
> # ifndef FAACAPI
> # define FAACAPI
> # endif
> #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.
I don't like this approach.
> - add -DWIN32 when compiling for the win32 platform. Requires
> adding a CFLAG during configure.
This would be acceptable, provided it doesn't break something else.
It should only need one additional line in the win32 sections.
A question worth asking is, why does faac not simply go with the
compiler defaults?
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list