Archive for the “Server” Category

The basic premise is that if you do a straight “./configure”, “make”, “make install” for your Xserve then the binaries will end up being 32 bit. Apple’s installation is 64 bit but if you want anything custom about Apache or PHP, you’ll need to compile it yourself and you’ll need to know what your doing to make the architecture match. What do you do to make that happen? This post is for Intel Xeon Xserves only. You can modify a few things to get the 64 bit PowerPC version of your software running.

This is not for the faint of heart. If you know at least a little about building and installing packages then you’ll be much better off.

First, you need to execute this command before running any “./configure”

export CFLAGS=”-arch x86_64 -arch i386″

The reason is that when you run configure it embeds these environment variables into your Makefile. This will create both a 32 bit and a 64 bit version of any software you build.

The next thing you need to know is that some packages, especially those that you build into PHP won’t compile multiple architectures “out of the box”. For example, Freetype, GD, and mhash will complain about multiple architectures. So you need to add this to your ./configure options:

./configure –disable-dependency-tracking …(all other options)

The “–disable-dependency-tracking” option will enable you to create multiple architectures. Dependency tracking is apparently not needed to make everything work.

The next step is PHP. This is our php configure list. It’s long but dutiful.

./configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –disable-dependency-tracking –with-apxs2=/usr/sbin/apxs –with-ldap=/usr –with-kerberos=/usr –enable-cli –with-zlib-dir=/usr –enable-trans-sid –with-xml –enable-exif –enable-ftp –enable-mbstring –enable-mbregex –enable-dbx –with-iodbc=/usr –with-curl=/usr –with-config-file-path=/etc –sysconfdir=/private/etc –with-mysql-sock=/var/mysql –with-mysqli=/usr/bin/mysql_config –with-mysql=/usr –with-pdo-mysql=/usr –with-openssl –with-xsl=/usr –with-gd –with-jpeg-dir=/usr –with-mhash –enable-memory-limit –with-freetype-dir=/usr –with-ttf=/usr

Some of these options require external libraries. I will let you figure that out ;) The same rules apply to building those projects for 64 bit and 32 bit. PDO is needed because we use PRADO extensively.

One problem we’ve run into is certain libraries not being 64 bit. Specifically libmysqlclient.dylib and libmygcc.a. This was a tough one to figure out. But eventually we got it working by downloading the 386 and the x86_64 bit version of mysql.tar.gz. These packages come with their respective versions of libmysqlclient.dylib and libmygcc.a. In fact, there are 6 dylibs that we wanted to make into multiple architectures:

  • libmysqlclient.15.0.0.dylib
  • libmysqlclient.15.dylib
  • libmysqlclient.dylib
  • libmysqlclient_r.15.0.0.dylib
  • libmysqlclient_r.15.dylib
  • libmysqlclient_r.dylib

You need to use the “lipo” command to put these binaries together for multiple architectures. Before replacing any libraries in your system you should back them up!

Once you’ve backed up your existing libraries you can do your “lipo”:

lipo -create mysql-5.0.67-osx10.5-x86/lib/libmysqlclient.dylib mysql-5.0.67-osx10.5-x86_64/lib/libmysqlclient.dylib -output libmysqlclient/libmysqlclient.dylib

This will stick the two versions of the dylib together into one dylib. As you can see we have a directory called libmysqlclient and that’s where we are storing the new binaries. Then they can be copied to where they need to go. (Usually they go in /usr/lib/ and would replace what goes in there.)

If you’re only recompiling PHP into your Xserve and not apache then you should be able to do that with all the above. We highly recommend you stick with the Apple Apache build.

If you’re more adventurous and would like to recompile Apache too then you can use these configuration flags.

./configure –prefix=/usr –enable-mods-shared=all –enable-deflate –enable-so –with-ssl –enable-proxy –enable-proxy-balancer –enable-proxy-http –enable-dav –sysconfdir=/etc/apache2 –enable-dav-fs –with-z –libexecdir=/usr/libexec/apache2 –enable-cgi –bindir=/usr/sbin –with-apr=/usr –with-apr-util=/usr
make
make install

The standard Apple Apache installation puts the files in /usr/sbin so this is going to replace the Apple installation.

Comments No Comments »