Problem installing DBD::mysql on Panther
I've successfully installed MySQL and the Perl DBI module, but when I try to install DBD::mysql, it keeps failing like this:
-------------------- (from the CPAN shell) ---------------------
....
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/lib" /usr/bin/perl myld MACOSX_DEPLOYMENT_TARGET=10.3 cc
-bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o
-o blib/arch/auto/DBD/mysql/mysql.bundle -L/usr/local/mysql/lib
-lmysqlclient -lz -lm
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
cpan>
----------------------------------------------------------------
I've been doing a little Perl programming for a while now, but I'm far from an expert, and I've been relying on simply using whatever was already installed on my web hosting system, where the DBI and DBD::mysql modules were pre-installed without me having to do a thing to get them there.
I don't even have a clue where to start in evaluating what this installation error is about. I'm just trying to follow instructions that I've founding Googling around for help on installing Perl packages on a Mac OS X system, and none of that help covers what to do when an installation like this fails for God knows what reason.
Just in case you're wondering, I've got the latest Developer Tools installed.
Code:
-------------------- (from the CPAN shell) ---------------------
....
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/lib" /usr/bin/perl myld MACOSX_DEPLOYMENT_TARGET=10.3 cc
-bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o
-o blib/arch/auto/DBD/mysql/mysql.bundle -L/usr/local/mysql/lib
-lmysqlclient -lz -lm
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
cpan>
----------------------------------------------------------------
I've been doing a little Perl programming for a while now, but I'm far from an expert, and I've been relying on simply using whatever was already installed on my web hosting system, where the DBI and DBD::mysql modules were pre-installed without me having to do a thing to get them there.
I don't even have a clue where to start in evaluating what this installation error is about. I'm just trying to follow instructions that I've founding Googling around for help on installing Perl packages on a Mac OS X system, and none of that help covers what to do when an installation like this fails for God knows what reason.
Just in case you're wondering, I've got the latest Developer Tools installed.
Comments
Originally posted by torifile
I don't know how to help, but please post back here if you find out somewhere else. A while back, when I was just starting with mysql, I had been using perl for my cgi. Since I could never get past the DBD thing, I switched to php. But I'd still like to know how to do it.... Good luck.
Did you just as far as I did before getting stuck? It would be interesting if DBD::mysql specifically is a common sticking point.
I found out that I can at least syntax check my Perl code with nothing but "use DBI;" declared. The lack of DBD::mysql only comes up as a run-time error.
For now, I still have to FTP to my web site (a Linux system) and ssh in to test the database parts of my code.
Originally posted by shetline
Did you just as far as I did before getting stuck? It would be interesting if DBD::mysql specifically is a common sticking point.
Not far at all. When I was doing this, I was using DP4 and I didn't have the dev tools and I had no way of getting them. So, I had to learn something else. At the time, there wasn't really anything out there about OS X and UNIX tools. Sorry I can't be of more help.
Apache
Still in terminal, we need to edit our Apache config file. We are basically going to allow for cgi scripts to be executed on the Mac. By default CGI Scripts are located in /Library/WebServer/CGI-Executables/. We need to uncomment the line in the httpd.conf file that reads # AddHandler cgi-script .cgi. I am going to explain how to do it using the vi text editor, but you are more than welcome to use your favorite editor of choice.
sudo vi /etc/httpd/httpd.conf
Go down to the line we want to edit
Remove the # AddHandler by pressing the x key.
:wq
sudo apachectl graceful
The last command simply restarts the apache server without having to restart your system. Oh, the power of Unix.
Perl Modules
Before we can install the DBI and DBD modules, we need to edit a Perl configuration file deep inside OS X to allow the modules to compile. The bug was discovered after OS X was sent to manufacturing, so the only way to repair it at the moment is in the command line.
sudo vi /System/Library/Perl/5.8.1/darwin-thread-multi-2level/Config.pm
Change ld='MACOSX_DEVELOPMENT_TARGET=10.3 cc' to ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'
Now that we have fixed one of the few shortcomings of Panther, we can get back to work.
Remember that we downloaded the DBI and DBD files earlier. I had them unzipped to my desktop, but you can easily alter these commands to match the location you saved the files.
cd ~/Desktop/
pushd DBI-1.30
perl Makefile.PL
make
make test
sudo make install
popd
pushd pushes a directory name onto the directory stack. popd removes the element from the stack. Other than that, it is just simply compiling the DBI module and installing it onto the system. Simple stuff.
pushd DBD-mysql-2.1028
perl Makefile.PL
perl -pi -e's/MACOSX/env MACOSX/' Makefile
make
make test
sudo make install
popd
Now that we have our perl modules setup, we can celebrate. We are over halfway to our goal!
It says that you have to change some perl configuration file, but the problem appears to be fixed in my installation. YMMV. After doing this, I seem to have a working DBD installation. HTH.
Originally posted by torifile
perl Makefile.PL
perl -pi -e's/MACOSX/env MACOSX/' Makefile
make
make test
sudo make install
My own experience is that this is all you need to do. After performing this I was able to install DBD::mysql without further hickups...
Greetings,
durandal