[Flac-dev] Build issues and fixes

Ben Wilhelm zorba-libflac at pavlovian.net
Tue Feb 8 04:20:35 PST 2011



I've been putting some work into building Libflac into a game engine I'm 
working on. I ran into a few small issues in the process, and was able 
to fix them, so I thought I'd post with my fixes. These aren't generally 
applicable - I'm taking a "shortest path to functionality" approach - 
but with a little work could probably be turned into general patches.

First, I'm occasionally building under MingW, via the Windows headers. 
LibFlac makes use of a constant SIZE_T_MAX, which, under MSVC, is 
defined as UINT_MAX. Unfortunately MSVC isn't the determining factor 
here, the Windows headers are, and so MingW results in an error. My 
simple fix was to remove the MSVC check - if SIZE_T_MAX doesn't exist, 
it *always* defines it as UINT_MAX. That's line 38 in include/share/alloc.h.

Second, I'm occasionally building under OSX. I ran into a bunch of 
problems with OSX thanks to its weird 32bit/64bit setup, but I don't 
currently care about 64bit so I just did what was necessary to force it 
to 32bit. The final issue ended up being the assembly routines, which 
don't understand OSX's "macho" format. In src/libFLAC/ia32/nasm.h, I 
replaced "%error unsupported object format!" with "%define 
FLAC__PUBLIC_NEEDS_UNDERSCORE" and everything worked beautifully. 
Obviously in a real situation you'd want to create an %elifdef 
OBJ_FORMAT_macho block.

Unless I've completely botched my test program, which is always 
possible, both builds now work flawlessly.

Hope this helps someone :)

-Ben





More information about the Flac-dev mailing list