<html><head></head><body><div class="gmail_quote">Ben Wilhelm <zorba-libflac@pavlovian.net> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="white-space: pre-wrap; word-wrap:break-word; ">
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<hr />Flac-dev mailing list
Flac-dev@xiph.org
<a href="http://lists.xiph.org/mailman/listinfo/flac-dev">http://lists.xiph.org/mailman/listinfo/flac-dev</a>
</div></blockquote></div><br clear="all">See here: http://www.schleef.org/blog/2011/02/03/flac-code-mirror/<br>
<br>
I use the patch branch in there to cross compile my game engine which indirectly uses libflac.<br>
-- Sven-Hendrik</body></html>