I was trying to get Bugzilla installed to act as my task manager on my local machine. It’s a new project that I’m trying out as part of my New Year’s Resolution of spending two hours everyday on a project of my own choice. It will help me to be organized, and give me an idea of priority over the tasks that I need to complete. It will also work better for me than using iCal or another calendar-based todo system. I’ve tried, they never work.
In the process, since Bugzilla is a Perl based application, I needed to make sure to update my CPAN modules to the appropriate versions necessary for Bugzilla. It was generally smooth sailing until I ran into DBD::mysql. It won’t install naturally from CPAN, and getting it to work from the command line takes a bit of finessing as well. I thought I should write up what I found in case anyone else runs into this problem. This solution is based on Perl 5.8.6, MySQL 5.0.45, and Bugzilla 3.0.2.
First, it turns out that the 5.* binary builds of the MySQL disk image distributed by the the MySQL Foundation for Mac OS X don’t come with shared libraries. Without these libraries, it seems that DBD::mysql won’t play along nicely. To build the shared libraries, you’re going to need the source directory for your version of MySQL, which for 5.0.45 can be found here. A very nice set of instructions for how to properly build these files is found here.
I’m not sure why DBD::Sponge is required, but without this package the tests failed, and make didn’t complete successfully. As a result, you’ll need to go ahead and run the following command to install DBD::Sponge
sudo perl -MCPAN -e “install DBD::Sponge”
At this point the following is assumed
- That you’ve got the MySQL shared libraries built.
- The DBI package is already installed
- That the DBD::Sponge package has also been installed
Go ahead and try to install DBD::mysql using the following command
sudo perl -MCPAN -e “install DBD::mysql”
It will attempt to install, but fail when it’s unable to complete the test steps. Next you’ll need to manually configure the Makefile parameters, and then run the make tools again. If you setup CPAN and MySQL to work with all of the default values, then the following set of commands should work for you. Also, as a note, this script assumes that your database user is root without a password with a database called test in the MySQL system. Otherwise, just change the directories as they are appropriate to your directory structure.
cd ~/.cpan/build/DBD-mysql-4.005-{*}
sudo perl Makefile.PL \
–cflags=”-I/usr/local/mysql/include -Os -arch i386 -fno-common” \
–libs=”-L/usr/local/mysql/lib -lmysqlclient -lz -lm” \
–testuser=root
sudo make
sudo make test
sudo make install
The {*} is a catch-all because I noticed that every time I tried to run DBD::mysql through CPAN it created a new random String that it appended to the end of the directory name. A simple tab at the point where you’ve reached the {*} should be enough.
Run these set of commands in your Terminal application and you should be off and ready to go with the DBD::mysql module on Mac OS X.