Most of the servers I manage are 64-bit. I have one linode box that is 32-bit. I chose 32-bit because it has better memory usage than 64-bit, which is possibly important with a 512MB instance. This was probably a mistake as the management overhead involved with maintaining a 32-bit infrastructure for just one 32-bit machine is silly. No matter – we are where we are…!

I use the fnv_64 user-defined function from maatkit with MySQL. So, I need to build a 32-bit version for use on the 32-bit server.

Here's how to use mock to create a 32-bit build environment (in this case, for CentOS 5) on a 64-bit machine (the host is actually a Fedora 15 server).

The basic strategy as as follows:

  1. Initialise the environment
  2. Install any dependencies
  3. Copy in the code you want to build
  4. chroot into the build shell
  5. Build the code
  6. Exit the build shell
  7. Copy out the results of the build process

Here's what that looks like with mock:

mock -r epel-5-i386 --init
mock -r epel-5-i386 --install mysql-devel
mock -r epel-5-i386 --copyin /
mock -r epel-5-i386 shell
gcc -fPIC -Wall -I/usr/include/mysql -shared -o
mock -r epel-5-i386 --copyout / .

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 


This site uses Akismet to reduce spam. Learn how your comment data is processed.