Aaron Bannert wrote:
Hi Everyone, I've been testing our code on Darwin 9/Leopard:
Good news: it works and we can actually create universal binaries:
.libs/libapr-1.0.dylib: Mach-O universal binary with 3 architectures
.libs/libapr-1.0.dylib (for architecture ppc7400): Mach-O dynamically
linked shared library ppc
.libs/libapr-1.0.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
.libs/libapr-1.0.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64
Funky :)
Bad news:
1) The autoconf code that selects the int_value and long_value aren't
consistent for all three architectures (ppc/i386/x86_64). It should be
choosing long_value="long long" but it's picking "long" instead,
probably because that would also be correct on my i386/x86_64 machine.
That'll need to be fixed.
Three architectures, three autoconf's is my gut reaction. That said, it's
possible we make an apr.hdarwin that determines some of these fields by
compiler-driven flags (not by user controllable flags). So there would
not be any side effects from the way the user chooses to build, but it
would bend depending on architecture.
I *presume* the compiler physically runs 3x against the very same header
files when compiling a three-platform universal binary?
2) The atomics code breaks presumably because the compiler/linker tries
to link the same asm in all three architectures. Workaround:
--enable-nonportable-atomics=no
Was this after I shifted ppc.c atomics to the end of the file, in order to
attempt to fall in proximity of the relocation stubs? Perhaps list the
-arch ppc last?
What were the exact error messages?
How did I do it:
./buildconf
CFLAGS="-arch ppc -arch i386 -arch x86_64 -pipe -Wall -g" \
LDFLAGS="-arch ppc -arch i386 -arch x86_64 -pipe" \
./configure --enable-nonportable-atomics=no
make clean
make
make install
Simple enough.