[flac-dev] Patch for cross compilation with MinGW32

Erik de Castro Lopo mle+la at mega-nerd.com
Sat Jun 23 22:08:59 PDT 2012

Christoph Terasa wrote:

> I had some difficulties compiling the current git ( 
> http://git.xiph.org/?p=flac.git;a=commit;h=a7e3705d051bafd1cae90f6605287cc1d9f2a18d 
> ) using the Ubuntu 12.04 supplied MinGW32 cross compiler:

Oh cool, I've wanted to do this myself but hadn't found time.

> I configured the FLAC build with --host=i586-mingw32msvc 
> --target=i586-mingw32msvc --build=i586-linux but ran into several linker 
> problems. Are these options somehow wrong?

Nope, seems about right.

> First, I moved the implementation of *safe_malloc_mul_2op_ to alloc.h, 
> just like all the other alloc implementations, and removed the thereby 
> obsolete alloc.c implementation from grabbag.

Err, probably not a good idea. I assume you moved it there and made it
inline, but GCC on x86-64 complains that it cannot inline it.

> Second, I just wrapped FLAC__clz_soft_uint32 with an #ifndef __MINGW32__.
> I tested the patch for both Linux and MinGW32 compiles, and both result 
> in functional programs.

I'm pretty sure there were warnings under linux. You should configure with

    ./configure --enable-gcc-werrror

whcih turns all warnings into errors. I'm trying to keep the FLAC code 
warning free.

Erik de Castro Lopo

More information about the flac-dev mailing list