Bug #30160 Perl API - DBD::mysql tests not looking for shared library in right place
Submitted: 31 Jul 2007 22:04 Modified: 1 Aug 2007 11:05
Reporter: Daniel Barker Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S2 (Serious)
Version:4.005 OS:Mac OS X (Intel)
Assigned to: CPU Architecture:Any

[31 Jul 2007 22:04] Daniel Barker
Description:
Dear Sir or Madam,

I have been unable to install DBD::mysql in the manner described on the MySQL Web site and CPAN. There are many failures at the "make test" stage. I believe this is because the tests are looking for the libmysqlclient.15.dylib library in the wrong place.

perl Makefile.PL comes up with promising settings:

***

I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/usr/local/mysql/include -Os -arch i386 -fno-common
  embedded      (mysql_config) = 
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm
  mysql_config  (guessed     ) = mysql_config

***

And "make" seems successful. However the "make tests" tests fail often, due to looking for the dynamic library in the wrong place, different from what is suggested above (/usr/local/mysql/lib/mysql/libmysqlclient.15.dylib when perhaps it should be /usr/local/mysql/lib/libmysqlclient.15.dylib), e.g. as follows:

***

t/30insertfetch......install_driver(mysql) failed: Can't load '/Users/db60/DBD-mysql-4.005/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/db60/DBD-mysql-4.005/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
  Referenced from: /Users/db60/DBD-mysql-4.005/blib/arch/auto/DBD/mysql/mysql.bundle
  Reason: image not found at /System/Library/Perl/5.8.6/darwin-thread-multi-2level/DynaLoader.pm line 230.
 at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
 at t/30insertfetch.t line 21
# Looks like your test died before it could output anything.

***

How to repeat:
perl Makefile.PL
make
make test

with DBD-mysql-4.005. (Problem also occurs with perl -MCPAN).

Suggested fix:
I thought of making a symbolic /usr/local/mysql/lib/mysql, to /usr/local/mysql/lib. Do you anticipate any problems from this?
[1 Aug 2007 7:28] Sveta Smirnova
Thank you for the report.

Please provide output of `which mysql_config` and `mysql_config` commands.

Also there is packaging Bug #13450. Please indicate version of MySQL server you use and provide output of `find / -name libmysqlclient.15.dylib 2>/dev/null`.
[1 Aug 2007 10:49] Daniel Barker
Dear Sveta Smirnova,

Thank you for your prompt reply. Here are the details you requested, plus a couple of others.

***

$ which mysql_config
/usr/local/mysql/bin/mysql_config
$ mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include -Os -arch i386 -fno-common]
        --include        [-I/usr/local/mysql/include]
        --libs           [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
        --libs_r         [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [5.0.45]
        --libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]
$ find / -name libmysqlclient.15.dylib 2>/dev/null
/usr/local/mysql-5.0.45-osx10.4-i686/lib/libmysqlclient.15.dylib
$ mysql --version
mysql  Ver 14.12 Distrib 5.0.45, for apple-darwin8.5.1 (i686) using readline 5.0
$ find / -name libmysqlclient.dylib 2>/dev/null
/usr/local/mysql-5.0.45-osx10.4-i686/lib/libmysqlclient.dylib
$ ls -Flo /usr/local/
total 8
lrwxr-xr-x    1 root  wheel  -  25 Jul 31 19:30 mysql@ -> mysql-5.0.45-osx10.4-i686
drwxr-xr-x   19 root  wheel  - 646 Jul  4 18:54 mysql-5.0.45-osx10.4-i686/
$

***

Best regards,

Daniel
[1 Aug 2007 11:05] Sveta Smirnova
Thakn you for the feedback.

Your problem is duplicate of Bug #28544. Please wait next release.

Workaround: "sudo ln -s /usr/local/mysql/lib/mysql /usr/local/mysql/lib".
[4 Sep 2007 11:38] Jonathan Share
It seems the arguments to the workaround are in the wrong order 

"sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql"

solved the issue for me