Archive for December, 2007
Building DBD::mysql under MacOS X
Friday, December 7th, 2007There’s a glitch when you try to build Perl’s DBD::mysql under MacOS X.
When I tried to build it, I got a lot of errors that looked like this:
t/40numrows............install_driver(mysql) failed: Can't load '/Users/admin/src/CPAN/build/DBD-mysql-4.005-C3W6F2/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/admin/src/CPAN/build/DBD-mysql-4.005-C3W6F2/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /Users/admin/src/CPAN/build/DBD-mysql-4.005-C3W6F2/blib/arch/auto/DBD/mysql/mysql.bundle
Reason: image not found at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.
It turns out that DBD::mysql was looking for the dynamic library for MySQL in the wrong place. It invokes mysql_config in order to find the location of the libraries, and mysql_config reports /usr/local/mysql/lib/mysql rather than /usr/local/mysql/lib
The easy way to fix it as to do this is to do this command from a Terminal window:
sudo ln -s /usr/local/mysql/lib/ /usr/local/mysql/lib/mysql
The drawback to this solution is that if you install an update to MySQL, you’ll need to remake this link.
You might also either modify mysql_config (it’s just a script, so it’s easy to edit), or to modify DBD::mysql, but the fix I’ve suggested is the simplest.
The real solution is to fix the MySQL distribution for MacOS X to have the correct path in it.
(more…)



RSS





