A post in my user forum made me aware of the fact that in Leopard, some binaries are not just two-way (PPC/Intel) but four-way Universal Binaries. The four variants are Intel 32bit, Intel 64bit, PPC 32bit and PPC 64bit.
Examples are the Apache web server binary and all its modules:
I think it wasn’t that way in Tiger?
Only few of the command line binaries are four-way universal:The graphical end-user apps seem to be two-way too:
The interesting question for me is if I need to start building my PHP5 module as four-way universal binary. That could mean a lot of additional work because not all of the many open source libraries I have to include might even be 64bit-clean.
Update: Apparently I do...
Another observation: While working on a PHP5 module build I stumbled upon what seems to be an inconsistency between architectures in the Apple-suppplied libiconv library. The PHP build fails in the link stage. The linker cannot find the symbol _libiconv in two of the four architectures.
Sure enough, the two 64bit architectures in the fat library do not seem to define this symbol:
The build succeeds if I build my own universal libiconv from source. I wonder why Apple’s PHP5 works with the system-supplied libiconv.
I take it back!
PHP has to be LINKED against a 64 bit capable MYSQL library.
The running mysqld is a separate process which can be a 32 bit.
Marc, just delete this and the previous comment.
[Red face]
I was able to get PHP to compile for x86_64 by modifying the Makefile as follows:
CFLAGS_CLEAN = -g -O2 -I/usr/include -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk
EXTRA_LDFLAGS = -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk
However, I only got it working with --with-apxs2 --without-iconv. I couldn't get it working with --with-mysql since I don't have x86_64 client libraries. I downloaded the mysql source and tried to compile it as x86_64, but I don't know enough about what I'm doing to get that to work. I assume since the Apple supplied mysqld isn't x86_64, that it's not possible at this time to compile it as such? I would assume however, that compiling just the client would work... but I can't figure out how to do that.
One thing I noted was that PHP didn't have to be a 4-way binary to work with the 4-way apache. I only compiled it for the x86_64 arch. Not useful for distribution... But something people might be interested in if rolling your own becomes easier.
|



Marc
I think there is a serious problem.
httpd is started as x86_64 in Leopard on Intel (64 bit)
Mysql is currently only available prebuilt as i386 on Intel (32 bit) .
As these have different architectures, I dont *think* you can make a PHP module which plays nice with both of these at the same time (even if you compile as a 4-way binary).
Correct me if I am wrong.
But I think this means we have to either wait until there's a 64 bit MYSQL, or build one ourselves,
OR
force httpd to run in 32 bit mode.
Comments?