Subscribed unsubscribe Subscribe Subscribe

@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

= DBD::mysql をOSX Lionにインストールする

[2012-02-16 21:19:36]

emacs-edbiを使ってみようと思って,DBD::mysqlを入れようとしたら失敗したのでその記録と解決法.

% sudo cpanm DBD::mysql
--> Working on DBD::mysql
Fetching http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz ... OK
Configuring DBD-mysql-4.020 ... OK
Building and testing DBD-mysql-4.020 ... FAIL
! Installing DBD::mysql failed. See /Users/peccu/.cpanm/build.log for details.
% tail -n 15 /Users/peccu/.cpanm/build.log
PERL_DL_NONLAZY=1 /opt/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Bailout called.  Further testing stopped:  Unable to load DBD::mysql

#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 21.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/Users/peccu/.cpanm/work/1329393777.16024/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/peccu/.cpanm/work/1329393777.16024/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /Users/peccu/.cpanm/work/1329393777.16024/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.bundle
#   Reason: image not found at /opt/local/lib/perl5/5.12.3/darwin-multi-2level/DynaLoader.pm line 204.
#  at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255
-> FAIL Installing DBD::mysql failed. See /Users/peccu/.cpanm/build.log for details.

"Library not loaded: libmysqlclient.18.dylib"の解消方法 - yinkywebの日記

ここにあるように,libmysqlclient.18.dylibを/usr/libにリンクすればインストールできました.

% cd /usr/lib
% sudo ln -fs /usr/local/mysql-5.5.20-osx10.6-x86_64/lib/libmysqlclient.18.dylib
% sudo cpanm DBD::mysql
--> Working on DBD::mysql
Fetching http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz ... OK
Configuring DBD-mysql-4.020 ... OK
Building and testing DBD-mysql-4.020 ... OK
Successfully installed DBD-mysql-4.020
1 distribution installed