[Speex-dev] [patch] Mac Universal Binaries

Peter Grayson jpgrayson at gmail.com
Thu May 3 18:25:14 PDT 2007

On 5/3/07, Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:
> Peter Grayson wrote:
> Personally I think universal binaries are a bad idea.

They have obviously served some purpose, but I tend to agree that the
concept does not seem to scale well once outside the Apple microcosm.

> For one of my projects, libsndfile, endian issues is not the only
> think that breaks in univesal binaries. The problem is that I
> detect cpu features other than just endian-ness at configure time;
> things that cannot be detected purely from compiler flags.
> See:
>    http://www.mega-nerd.com/libsndfile/FAQ.html#Q018

Can you elaborate on what kind of CPU vagaries come into play besides
endianess? Do they affect all code or just highly-optimized code? I
have built several open source projects as universal binaries and they
basically function. If you know of specific risks to look out for,
your experiences would help a lot of people.

> However, my biggest objection to universal binaries for libsndfile
> is that libsndfile has a huge and comprehensive test suite and
> running the test suite during a universal build will only test
> the native build, not the cross-compiled build. As far as I am
> concerned, cross-compiled code that isn't tested is worse than
> native code that isn't tested and I consider native code that
> isn't tested to be broken code.

Is it just the endianess issue or is it other ill-detected CPU
features that cause the libsndfile test suite to fail? Again, your
experience would be greatly appreciated.

> > My strong suspicion is that testing __BIG_ENDIAN__ at compile-time
> > will work for all relevant unix-like platforms. Even icc supports
> > this.
> Yep, gcc and icc support it. How many others do? Is suspect
> its very close to zero.

You are probably right. My argument here was bogus. Although, didn't
some features get into the C and POSIX standards by first being
non-standard, but useful? In this case, these macros are clearly an
insufficient to be regarded as a solution to the problem, but they
have proven useful to a number of people, including myself.

Thanks for your feedback.


More information about the Speex-dev mailing list