Thursday, April 22, 2010

DBD::mysql - Do you need to predeclare BAIL_OUT?

I was installing DBD::mysql from CPAN on a Solaris 10 8/07 Sparc today.
The install command failed with the infamous

Running make test                                                                                                                            
PERL_DL_NONLAZY=1 /usr/perl5/5.8.4/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t                  
t/00base....................String found where operator expected at t/00base.t line 20, near "BAIL_OUT "Unable to load DBI""                 
        (Do you need to predeclare BAIL_OUT?)                                                                                                
String found where operator expected at t/00base.t line 21, near "BAIL_OUT "Unable to load DBD::mysql""                                      
        (Do you need to predeclare BAIL_OUT?)                                                                                                
syntax error at t/00base.t line 20, near "BAIL_OUT "Unable to load DBI""                                                                     
syntax error at t/00base.t line 21, near "BAIL_OUT "Unable to load DBD::mysql""                                                              
BEGIN not safe after errors--compilation aborted at t/00base.t line 22.                                                                      
# Looks like your test died before it could output anything.                                                                                 
t/00base....................dubious                                                                                                          
        Test returned status 2 (wstat 512, 0x200)                                                                                            
DIED. FAILED tests 1-6                                                                                                                       
        Failed 6/6 tests, 0.00% okay

Googling for help revealed tons of people with the same problem and the lucky ones who resolved it did so by giving up CPAN and installing from rpm/whatever else.

I finaly found answer here, or rather here.

The Test module was outdated ... so to solve it:

cpan> install Test::Simple 
isn't it simple?

But that was not the end. The next issue was:

#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 21.
t/00base....................NOK 2#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/.cpan/build/DBD-mysql-4.014/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: ld.so.1: perl: fatal: relocation error: file /.cpan/build/DBD-mysql-4.014/blib/arch/auto/DBD/mysql/mysql.so: symbol mysql_real_escape_string: referenced symbol not found at /usr/perl5/5.8.4/lib/sun4-solaris-64int/DynaLoader.pm line 230.


I guess this is due to the fact mysql is 64 bit while perl is 32 bit. Let me investigate later.

No comments:

Post a Comment