Monday, April 7, 2008

Installing DBD::mysql on OS X Leopard 10.5.2

One of those minor nightmare installs. I need this though, so I've gotta work for a while.

Here is the problem that shows up:

~/.cpan/build/DBD-mysql-4.006-j5Hpiv> prove -v -l t/00base.t
t/00base......
1..5
ok 1
ok 2
ok 3
install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /Users/dhosek/.cpan/build/DBD-mysql-4.006-j5Hpiv/lib /Users/dhosek/.cpan/build/DBD-mysql-4.006-j5Hpiv/lib /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a module that DBD::mysql requires hasn't been fully installed
at t/00base.t line 38
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/5 subtests

Test Summary Report
-------------------
t/00base.t (Wstat: 512 Tests: 3 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 5 tests but ran 3.


First step, is that I'm finding that the blib/arch/auto/DBD/mysql/mysql.so file is not being created.

Actually, that's not the problem! Looking closer, I'm seeing that the .bs and .bundle files are apparently the ones that apply now. Interestingly using prove -b t/00base.t does in fact work. But make test has the same test fail...

Ignoring that issue, I move on to the next test:

prove -b t/10connect.t
t/10connect......dyld: lazy symbol binding failed: Symbol not found: _mysql_server_init
Referenced from: /Users/dhosek/.cpan/build/DBD-mysql-4.006-j5Hpiv/blib/arch/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

dyld: Symbol not found: _mysql_server_init
Referenced from: /Users/dhosek/.cpan/build/DBD-mysql-4.006-j5Hpiv/blib/arch/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

t/10connect...... Failed 2/2 subtests

Test Summary Report
-------------------
t/10connect.t (Wstat: 5 Tests: 0 Failed: 0)
Parse errors: Bad plan. You planned 2 tests but ran 0.
Files=1, Tests=0, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.04 cusr 0.00 csys = 0.05 CPU)
Result: FAIL


Update: 11 April 2008 The problem has its roots in using the pre-compiled distribution of mysql from mysql.com rather than building from source. This resulted in getting incompatible libraries between what was compiled for DBD::mysql and what I had in the mysql directory. Building from source resolved the problem. Good instructions on doing the job are available at HiveLogic.

No comments: