[Flac-dev] flac/metaflac 32/64 Universal OS X builds
Brian Willoughby
brianw at sounds.wa.com
Mon May 5 17:39:38 PDT 2008
I guess I should add this to the long list of things Apple has broken
that used to work well on NEXTSTEP (the operating system that has
been turned into OS X).
Now that you mention it, I remember having a problem getting flac to
cross-compile in one build step, so I just did the manual lipo glue
that you talked about. I assumed it was only because I was too lazy
to figure out how to get Xcode to work, but from your report it seems
like there is much more to the problem.
From your steps, it seems that it is possible to cross-compile, but
only if you build one architecture at a time and then manually lipo
them together. If I someday find an easy fix for this, I'll let you
know. Then again, Stephen may have figured out the magic incantation
for Xcode to make this work as simply as it should.
So, tell me, Erik: Can you build for Intel on PPC? Can you build for
PPC on Intel? If you're willing to do the manual lipo steps, is that
all you need to do to make a UB? ... or do you actually need both an
Intel Mac and a PowerPC Mac?
Thanks for the report.
Brian Willoughby
Sound Consulting
On May 5, 2008, at 16:38, Erik de Castro Lopo wrote:
> 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
More information about the Flac-dev
mailing list