我正在尝试让 DBD::MySQL 在 Snow Leopard (v10.6.6) 上工作。操作系统自带的默认 Perl 版本是 v5.10.0。由于我已经阅读了 64 位版本,因此我继续下载并安装了 64 位版本的 MySQL (mysql-5.5.8-osx10.6-x86_64)。
安装和设置 MySQL 很顺利,这是我的配置和版本号供参考。
我使用 CPAN 下载 DBI 和 DBD::MySQL 驱动程序。我然后:
- 安装的 DBI
- 设置 Makefile.PL
- 从命令行运行make命令
Makefile.PL 表示它将使用以下设置进行编译和测试:
I will use the following settings for compiling and testing:
cflags (mysql_config ) = -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64
embedded (mysql_config ) =
libs (mysql_config ) = -L/usr/local/mysql/lib -lmysqlclient -lpthread
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (User's choice) = r00t!
testsocket (default ) =
testuser (User's choice) = root
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 907
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
一切似乎都很好,直到我尝试运行make test:
t/00base....................NOK 2/6# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.16.dylib
# Referenced from: /Users/swm/.cpan/build/DBD-mysql-4.018-Pnd2qz/blib/arch/auto/DBD/mysql/mysql.bundle
# Reason: image not found at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/DynaLoader.pm line 207.
# 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 9
它失败了,因为它似乎找不到 DBD 的 mysql.bundle。有没有人遇到过这个问题?或者可以指出我下一步要尝试什么的正确方向?我的新工作需要 DBI/DBD::MySQL,我正在努力寻找解决方案。
提前谢谢了。