[Flac-dev] flac/metaflac 32/64 Universal OS X builds

Erik de Castro Lopo mle+la at mega-nerd.com
Mon May 5 16:38:29 PDT 2008


Brian Willoughby wrote:

> In my experience, with the gcc compiler, cross-compiling is highly  
> reliable.

Your experience doesn't match mine.

> If your code runs on one processor, then it will run on  
> all.

That can easily break down in all sort of places. For instance, I'm
the main author of libsndfile and when Apple first announced Intel 
based machines I started getting weird bug reports about libsndfile
on Intel macs. After I spent a bunch of my very valuable time the
idiot reporting the issue finally confessed that he was compiling
libsndfile as a universal binary on PPC and then seeing bugs on
Intel.

The result of all this was a FAQ:

    http://www.mega-nerd.com/libsndfile/FAQ.html#Q018

and me adding code to libsndfile to detect when it was being compiled
as a UB and erroring out if it was.

For libsndfile, the *only* reliable way to create a 32 bit intel/
ppc UB is:

 0) configure for intel
 1) make
 2) make check
 3) configure for powerpc
 4) make
 5) make check
 6) use lipo to glue together the test binaries generated in
    steps 1) and 4)

Feel free to add more steps for 64 bit.

> Linking and such might be an issue, which you will discover  
> immediately when the first person tries to run what you've built on  
> their system.

In the libsndfile case it linked fine, but didn't read or write
files correctly. This could easily have resulted in people
losing valuable work.

> It still would be great to run these tests on all four.

I have a saying 'untested code is broken code'. In this case
that should read 'an untested binary is a broken binary'.

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"I've nothing against OO, I do have something against C++. Its a dogs
dinner. Anyone who's (tried) to read Stroustrups book on C++ like I had
the misfortune of doing knows that the man is very intelligent but has
about as much clarity of thought as Timothy Leary on a bad day."
-- NJR in comp.os.linux.development.apps


More information about the Flac-dev mailing list