2011-08-22 12 views
3

我试图安装DBD :: mysql使用大多数流行的方法,包括sudo cpanm -S DBD::mysql。但是,我遇到了一些严重的问题,我开始认为它可能是我的处理器。我已经在许多计算机上成功安装了它,但自从我的IT部门给我这台i5 MacBook Pro以来,每一次都没有运气。其他人能够在i5上安装DBD :: mysql吗?我正在运行Mac OS 10.6.8。任何人都可以在Mac Snow Leopard上使用i5处理器安装DBD :: mysql?

这是运行cpanm后的build.log。任何帮助,将不胜感激。谢谢!

cpanm (App::cpanminus) 1.4008 on perl 5.010000 built for darwin-thread-multi-2level 
Work directory is /Users/jerickson/.cpanm/work/1314049977.98062 
You have make /usr/bin/make 
You have LWP 5.813 
You have /usr/bin/tar: bsdtar 2.6.2 - libarchive 2.6.2 
You have /usr/bin/unzip 
Searching DBD::mysql on cpanmetadb ... 
--> Working on DBD::mysql 
Fetching http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz 
-> OK 
Unpacking DBD-mysql-4.020.tar.gz 
Entering DBD-mysql-4.020 
Checking configure dependencies from META.yml 
Checking if you have DBI 1.08 ... Yes (1.616) 
Configuring DBD-mysql-4.020 
Running Makefile.PL 


PLEASE NOTE: 

For 'make test' to run properly, you must ensure that the 
database user 'root' can connect to your MySQL server 
and has the proper privileges that these tests require such 
as 'drop table', 'create table', 'drop procedure', 'create procedure' 
as well as others. 

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t'; 

You can also optionally set the user to run 'make test' with: 

perl Makefile.PL --testuser=username 

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 (default ) = 
    testsocket (default ) = 
    testuser  (guessed ) = root 

To change these settings, see 'perl Makefile.PL --help' and 
'perldoc INSTALL'. 

Checking if your kit is complete... 
Looks good 
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 
Writing MYMETA.yml and MYMETA.json 
-> OK 
Checking dependencies from MYMETA.yml ... 
Finding PREREQ from Makefile ... 
Checking if you have Data::Dumper 0 ... Yes (2.121_14) 
Checking if you have DBI 1.08 ... Yes (1.616) 
Checking if you have Test::More 0 ... Yes (0.98) 
Checking if you have Test::More 0 ... Yes (0.98) 
Checking if you have Data::Dumper 0 ... Yes (2.121_14) 
Checking if you have DBI 1.08 ... Yes (1.616) 
Building and testing DBD-mysql-4.020 
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm 
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm 
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod 
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm 
gcc-4.2 -c -I/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -Os -DVERSION=\"4.020\" -DXS_VERSION=\"4.020\" "-I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE" dbdimp.c 
dbdimp.c: In function ‘alloc_param’: 
dbdimp.c:223: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_bind’: 
dbdimp.c:241: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbind’: 
dbdimp.c:257: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbuffer’: 
dbdimp.c:272: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘parse_params’: 
dbdimp.c:589: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘my_login’: 
dbdimp.c:1996: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_describe’: 
dbdimp.c:3605: warning: assignment from incompatible pointer type 
dbdimp.c:3606: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_st_fetch’: 
dbdimp.c:3798: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_param’: 
dbdimp.c:223: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_bind’: 
dbdimp.c:241: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbind’: 
dbdimp.c:257: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbuffer’: 
dbdimp.c:272: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘parse_params’: 
dbdimp.c:589: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘my_login’: 
dbdimp.c:1996: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_describe’: 
dbdimp.c:3605: warning: assignment from incompatible pointer type 
dbdimp.c:3606: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_st_fetch’: 
dbdimp.c:3798: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_param’: 
dbdimp.c:223: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_bind’: 
dbdimp.c:241: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbind’: 
dbdimp.c:257: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘alloc_fbuffer’: 
dbdimp.c:272: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘parse_params’: 
dbdimp.c:589: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘my_login’: 
dbdimp.c:1996: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_describe’: 
dbdimp.c:3605: warning: assignment from incompatible pointer type 
dbdimp.c:3606: warning: format not a string literal and no format arguments 
dbdimp.c: In function ‘mysql_st_fetch’: 
dbdimp.c:3798: warning: format not a string literal and no format arguments 
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/Driver.xst > mysql.xsi 
/usr/bin/perl /Library/Perl/Updates/5.10.0/ExtUtils/xsubpp -typemap /System/Library/Perl/5.10.0/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c 
Warning: duplicate function definition 'do' detected in mysql.xs, line 242 
Warning: duplicate function definition 'rows' detected in mysql.xs, line 751 
gcc-4.2 -c -I/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -Os -DVERSION=\"4.020\" -DXS_VERSION=\"4.020\" "-I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE" mysql.c 
mysql.xs: In function ‘XS_DBD__mysql__db_do’: 
mysql.xs:307: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘struct SV *’ 
mysql.xs:364: warning: format not a string literal and no format arguments 
mysql.xs:365: warning: format not a string literal and no format arguments 
mysql.xs:366: warning: format not a string literal and no format arguments 
mysql.xs:525: warning: format not a string literal and no format arguments 
mysql.xs: In function ‘XS_DBD__mysql__GetInfo_dbd_mysql_get_info’: 
mysql.xs:930: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘struct SV *’ 
mysql.xs: In function ‘XS_DBD__mysql__db_do’: 
mysql.xs:307: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘struct SV *’ 
mysql.xs:364: warning: format not a string literal and no format arguments 
mysql.xs:365: warning: format not a string literal and no format arguments 
mysql.xs:366: warning: format not a string literal and no format arguments 
mysql.xs:525: warning: format not a string literal and no format arguments 
mysql.xs: In function ‘XS_DBD__mysql__GetInfo_dbd_mysql_get_info’: 
mysql.xs:930: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘struct SV *’ 
mysql.xs: In function ‘XS_DBD__mysql__db_do’: 
mysql.xs:307: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘struct SV *’ 
mysql.xs:364: warning: format not a string literal and no format arguments 
mysql.xs:365: warning: format not a string literal and no format arguments 
mysql.xs:366: warning: format not a string literal and no format arguments 
mysql.xs:525: warning: format not a string literal and no format arguments 
mysql.xs: In function ‘XS_DBD__mysql__GetInfo_dbd_mysql_get_info’: 
mysql.xs:930: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘struct SV *’ 
Running Mkbootstrap for DBD::mysql() 
chmod 644 mysql.bs 
rm -f blib/arch/auto/DBD/mysql/mysql.bundle 
LD_RUN_PATH="/usr/local/mysql/lib:/usr/lib" /usr/bin/perl myld gcc-4.2 -mmacosx-version-min=10.6.3 -arch x86_64 -arch i386 -arch ppc -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle  \ 
     -L/usr/local/mysql/lib -lmysqlclient -lpthread \ 

chmod 755 blib/arch/auto/DBD/mysql/mysql.bundle 
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs 
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs 
Manifying blib/man3/DBD::mysql.3pm 
Manifying blib/man3/DBD::mysql::INSTALL.3pm 
Manifying blib/man3/Bundle::DBD::mysql.3pm 
PERL_DL_NONLAZY=1 /usr/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/jerickson/.cpanm/work/1314049977.98062/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/jerickson/.cpanm/work/1314049977.98062/DBD-mysql-4.020/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib 
# Referenced from: /Users/jerickson/.cpanm/work/1314049977.98062/DBD-mysql-4.020/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 255 
-> FAIL Installing DBD::mysql failed. See /Users/jerickson/.cpanm/build.log for details. 

我自从尝试了sudo cpanm -Sf DBD::mysql。使用强制标志,cpanm说,它已成功安装,但尝试运行包括连接到MySQL数据库的结果与这个错误的脚本:

Running... 
install_driver(mysql) failed: Can't load '/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib 
    Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/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 6) line 3 
Compilation failed in require at (eval 6) line 3. 
Perhaps a required shared library or dll isn't installed where expected 
at roster_generate.pl line 33 
+0

FWIW,我已经打了相同的一般发行并强制安装DBD :: MySQL在自公开测试每一个OS X和它的工作罚款之后。我意识到这不是“正确”的建议,但它在10年内一遍又一遍地没有让我感到悲伤。 – Ashley

+0

@Ashley我试图用-Sf标志强制安装它,它说它已成功安装,但是我仍然无法在Perl脚本中使用它。请参阅修改后的帖子。 –

回答

4

啊,我是能够通过添加

修复它

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

我的.bash_profile。我在一些随机博客上发现了这个。任何人都知道为什么这工作?

+0

以下是来源:http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/ –

+1

非常感谢!这帮助我完成我的Mysql <-> DBD安装! – BaL

+0

正确的链接现在是http://c.kat.pe/post/how-to-fix-mysql-load-issues-on-mac-os-x/ – kgpdeveloper

0

我最近试图将自己安装在一个完全不同的机器上的DBD :: mysql包中,并且有相同的错误。安装程序需要来自mysql-devel软件包的某些库,遗憾的是它并没有告诉你这一点。用yum安装这个mysql-devel包后,安装过程没有任何问题。

我猜想通过设置DYLD_LIBRARY_PATH变量,安装程序也在/usr/local/mysql/lib/中查找以找到所需的库。

2

我得到了以下工作在雪豹。这是来自黑暗时代的称为符号链接的旧式Linux技巧。

cd/usr/lib sudo ln -sv /usr/local/mysql/lib/*.dylib。

不要乱搞设置环境变量DYLD_LIBRARY_PATH,因为sudo不会尊重,并给你一个pissy消息来引导。

我能够(最终)编译DBD :: mysql和其他一些东西。

祝你好运。

1

对于任何使用Mac OSX Mavericks的人,以下是我用于最终获得此模块工作的步骤。

首先,卸载DBD :: mysql(如果已安装)。

​​

运行以下命令来链接MySQL lib文件。正如jjohn所提到的,设置变量DYLD_LIBRARY_PATH将不起作用。

cd /usr/lib 
sudo ln -sv /usr/local/mysql/lib/*.dylib . 

重新安装DBD :: mysql(-n标志跳过测试阶段)。

sudo cpanm -n DBD::mysql 

就是这样!

为了更好的衡量,我还配置了Perl以32位模式运行,并重新启动了Apache。但是,我不确定是否需要这些步骤。下面是分别要做到这一点,命令:

defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes 
sudo apachectl restart 
相关问题