cpan安装的DBD :: mysql测试失败,未找到符号。 OSX Mojave [英] cpan install of DBD::mysql failing on tests and symbol not found. OSX Mojave

查看:110
本文介绍了cpan安装的DBD :: mysql测试失败,未找到符号。 OSX Mojave的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来已经存在多年了-但是我找不到与Mac相关的最新消息,仅安装CPAN模块DBD :: mysql就已经涉足了几天。

 ##t / 00base.t第15行测试'use DBD :: mysql;'
#失败。
#尝试使用'DBD :: mysql'。
#错误:无法为模块DBD :: mysql加载'/Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle' :dlopen(/Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle,2):找不到符号:_mysql_affected_rows
#引用自:/Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle
#预期存在于:扁平名称空间
#在/ Users中/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle位于/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0 /darwin-thread-multi-2level/DynaLoader.pm第197行。
#^ @在t / 00base.t第15行。
#编译在t / 00base.t第15行中require失败。 b $ b#BEGIN失败-在t / 00base.t第15行中,编译中止。
调用了紧急救助。进一步的测试已停止:无法加载DBD :: mysql
失败-进一步的测试已停止:无法加载DBD :: mysql
make:*** [test_dynamic]错误255
->失败安装DBD :: mysql失败。有关详细信息,请参见/Users/robert/.cpanm/work/1542100720.91387/build.log。使用--force重试以强制安装它。

这是我正在使用的cpanm行。

  sudo cpanm --configure-args =-libs ='-L / usr / local / opt / openssl / lib -L ​​/ usr / local / lib -L ​​/ usr / local / Cellar / mysql / 8.0.12 / lib'--cflags ='-I / usr / local / opt / openssl / include -I / usr / local / include / mysql -I / usr / local / Cellar / mysql / 8.0.12 / include / mysql' DBD :: mysql 

我已经用Homebrew安装了mysql ,以及与此相关的所有其他信息。我什至已经将几个库复制到系统目录中-但是似乎没有什么想要让这个cpan模块安装和工作的。线。
让我们尝试手工制作软件包

  sudo perl Makefile.PL --libs =- L / usr / local / opt / openssl / lib -L ​​/ usr / local / lib -L ​​/ usr / local / Cellar / mysql / 8.0.12 / lib -lssl -lcrypto 

制作结果。看起来不错。我在这里没有看到错误。显然所有库都可以编译。

  zeus:DBD-mysql-4.048-0 robert $ sudo perl Makefile.PL --libs =-L / usr / local / opt / openssl / lib -lssl -lcrypto -L / usr / local / lib -L ​​/ usr / local / Cellar / mysql / 8.0.12 / lib 
我将使用以下设置进行编译和测试:

cflags(mysql_config)= -I / usr / local / Cellar / mysql / 8.0.12 / include / mysql
嵌入式(猜测)=
libs(用户选择)= -L / usr / local / opt / openssl / lib -lssl -lcrypto -L / usr / local / lib -L ​​/ usr / local / Cellar / mysql / 8.0.12 / lib
mysql_config(用户选择)= mysql_config
nocatchstderr(默认)= 0
nofoundrows(默认)= 0
nossl(默认)= 0
testdb(用户的选择)=测试
testhost(默认)=
testpassword(默认)=
testport(默认)=
testsocket(默认)=
testuser(用户的选择)= root

要更改这些设置,请参见 perl Makefile.PL --help和
perldoc DBD :: mysql :: INSTALL。

检查库是否可用于编译...
看起来不错。

检查您的套件是否完整...
看起来不错
使用安装在/ usr / local /中的DBI 1.642(在darwin-thread-multi-2level上的perl 5.028000)地窖/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/auto/DBI/
生成Unix风格的Makefile
为DBD编写Makefile :: mysql
编写MYMETA.yml和MYMETA.json
zeus:DBD-mysql-4.048-0 robert $

现在让我们看看 make 是否有效。



看起来不错。 1条关于WIDEST_UTYPE的警告,但这仅是警告...



然后,制作了mysql.bundle

  chmod 755 blib / arch / auto / DBD / mysql / mysql.bundle 
整理3个pod文档

好,现在是一个巨大的考验。 进行测试



...并且失败。

  zeus:DBD-mysql-4.048-0 robert $ sudo make test 
/usr/local/Cellar/perl/5.28.0/bin/perl -MExtUtils :: Command :: MM -e'cp_nonempty'-mysql.bs blib / arch / auto / DBD / mysql / mysql.bs 644
PERL_DL_NONLAZY = 1 /usr/local/Cellar/perl/5.28.0/bin/perl -MExtUtils :: Command :: MM -MTest :: Harness -e undef * Test :: Harness :: Switches; test_harness(0,'blib / lib','blib / arch') t / * .t
t / 00base.t .............................. 1/6
#失败在t / 00base.t第15行测试'use DBD :: mysql;'
#。
#尝试使用'DBD :: mysql'。
#错误:无法为模块DBD :: mysql加载'/Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle' :dlopen(/Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle,2):找不到符号:_mysql_affected_rows
#引用自:/Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle
#预期存在于:/ Users中的平面命名空间
# /robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle位于/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0 /darwin-thread-multi-2level/DynaLoader.pm第197行。
#在t / 00base.t第15行。
#编译在t / 00base.t第15行中require失败。 b#BEGIN失败-在t / 00base.t第15行中,编译中止。
调用了Bailout。进一步的测试已停止:无法加载DBD :: mysql
失败-进一步的测试已停止:无法加载DBD :: mysql
make:*** [test_dynamic]错误255

...就在那里。同样的错误。现在我还尝试了MariaDB-结果相同,尽管错误消息略有不同。



我在这里缺少什么。

解决方案

所以我终于找到了它。当然,它是在查找库并正确包含文件。



所以我进入了系统上的cpan目录

  /Users/robert/.cpan/build/DBD-mysql-4.048-0 

检查一下opensl和mysql的Brew安装位置之后,我醒了。

  sudo perl Makefile.PL --libs =-L / usr / local / opt / openssl / lib -lssl -lcrypto -L / usr / local / lib -L ​​/ usr / local / Cellar / mysql / 8.0.12 / lib -lmysqlclient 

现在。之所以起作用,是因为在查看mysaql lib目录之后,我看到该库是 mysqlclient而不是mysql。如上面所见。



现在可以像上面那样工作Makefile.PL了。



然后'make工作。如上。没有显示任何错误...如上所述



然后 sudo make test有效-这次。

 所有测试成功。 
文件= 73,测试= 9、11壁钟秒(0.24 usr 0.15 sys + 8.25 cusr 1.23 csys = 9.87 CPU)
结果:PASS

最后-安装。

  zeus:DBD-mysql-4.048-0 robert $ sudo make install 
/ usr / local / Cellar /perl/5.28.0/bin/perl -MExtUtils :: Command :: MM -e'cp_nonempty'-mysql.bs blib / arch / auto / DBD / mysql / mysql.bs 644
整理3个窗格文档
在blib / arch中找到的文件:将blib / lib中的文件安装到依赖于体系结构的库树
安装/usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0 /darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
安装/usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread- multi-2level / Bundle / DBD / mysql.pm
安装/usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql .pm
安装/usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql/INSTALL.pod
安装/usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql/GetInfo.pm
安装/ usr / local / Cellar / perl / 5.28。 0 / share / man / man3 / Bundle :: DBD :: mysql.3
安装/usr/local/Cellar/perl/5.28.0/share/man/man3/DBD::mysql::INSTALL.3
安装/usr/local/Cellar/perl/5.28.0/share/man/man3/DBD::mysql.3
将安装信息追加到/usr/local/Cellar/perl/5.28.0 /lib/perl5/5.28.0/darwin-thread-multi-2level/perllocal.pod
zeus:DBD-mysql-4.048-0 robert $ pwd
/Users/robert/.cpan/build/ DBD-mysql-4.048-0

最后。现在我为什么要这个?我不记得了。


This looks like it's been around for years - but I can't find anything recent and related to Mac, and dealing only with just installing the CPAN module DBD::mysql I've been trawling the internet for days now...

#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 15.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Symbol not found: _mysql_affected_rows
#   Referenced from: /Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle
#   Expected in: flat namespace
#  in /Users/robert/.cpanm/work/1542100720.91387/DBD-mysql-4.048/blib/arch/auto/DBD/mysql/mysql.bundle at /usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/DynaLoader.pm line 197.
# ^@ at t/00base.t line 15.
# Compilation failed in require at t/00base.t line 15.
# BEGIN failed--compilation aborted at t/00base.t line 15.
Bailout called.  Further testing stopped:  Unable to load DBD::mysql
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255
-> FAIL Installing DBD::mysql failed. See /Users/robert/.cpanm/work/1542100720.91387/build.log for details. Retry with --force to force install it.

This is the cpanm line I'm using.

sudo cpanm  --configure-args="--libs='-L/usr/local/opt/openssl/lib -L/usr/local/lib -L/usr/local/Cellar/mysql/8.0.12/lib' --cflags='-I/usr/local/opt/openssl/include -I/usr/local/include/mysql -I/usr/local/Cellar/mysql/8.0.12/include/mysql'" DBD::mysql

I have installed mysql with Homebrew, and everything else for that matter. I've even copied a few libs into system directories - but nothing seems to want to get this cpan module to install and work.

EDIT: Additions after this line. Let's try Making the package by hand

sudo perl Makefile.PL --libs="-L/usr/local/opt/openssl/lib -L/usr/local/lib -L/usr/local/Cellar/mysql/8.0.12/lib -lssl -lcrypto"

The Result of Make. Looking good. I see no errors here.Apparently all libs are available for compiling.

zeus:DBD-mysql-4.048-0 robert$ sudo perl Makefile.PL --libs="-L/usr/local/opt/openssl/lib -lssl -lcrypto -L/usr/local/lib -L/usr/local/Cellar/mysql/8.0.12/lib"
I will use the following settings for compiling and testing:

  cflags        (mysql_config ) = -I/usr/local/Cellar/mysql/8.0.12/include/mysql
  embedded      (guessed      ) = 
  libs          (User's choice) = -L/usr/local/opt/openssl/lib -lssl -lcrypto -L/usr/local/lib -L/usr/local/Cellar/mysql/8.0.12/lib
  mysql_config  (Users choice ) = mysql_config
  nocatchstderr (default      ) = 0
  nofoundrows   (default      ) = 0
  nossl         (default      ) = 0
  testdb        (User's choice) = test
  testhost      (default      ) = 
  testpassword  (default      ) = 
  testport      (default      ) = 
  testsocket    (default      ) = 
  testuser      (User's choice) = root

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

Checking if libs are available for compiling...
Looks good.

Checking if your kit is complete...
Looks good
Using DBI 1.642 (for perl 5.028000 on darwin-thread-multi-2level) installed in /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/auto/DBI/
Generating a Unix-style Makefile
Writing Makefile for DBD::mysql
Writing MYMETA.yml and MYMETA.json
zeus:DBD-mysql-4.048-0 robert$ 

Now let's see if a make works.

Looking good. 1 warning about WIDEST_UTYPE but it's only a warning...

Then, mysql.bundle is made

chmod 755 blib/arch/auto/DBD/mysql/mysql.bundle
Manifying 3 pod documents

Ok, now the big test. make test.

... and it fails.

zeus:DBD-mysql-4.048-0 robert$ sudo make test
"/usr/local/Cellar/perl/5.28.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- mysql.bs blib/arch/auto/DBD/mysql/mysql.bs 644
PERL_DL_NONLAZY=1 "/usr/local/Cellar/perl/5.28.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.t .............................. 1/6 
#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 15.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Symbol not found: _mysql_affected_rows
#   Referenced from: /Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle
#   Expected in: flat namespace
#  in /Users/robert/.cpan/build/DBD-mysql-4.048-0/blib/arch/auto/DBD/mysql/mysql.bundle at /usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/DynaLoader.pm line 197.
#  at t/00base.t line 15.
# Compilation failed in require at t/00base.t line 15.
# BEGIN failed--compilation aborted at t/00base.t line 15.
Bailout called.  Further testing stopped:  Unable to load DBD::mysql
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255

... and there it is. The same error. Now I also tried MariaDB - same result, although slightly different error messages.

What am I missing here.

解决方案

So I finally found it. Of course, it was locating the libraries and include files properly.

So I went into the cpan directory on my system

/Users/robert/.cpan/build/DBD-mysql-4.048-0

After checking just where the brew installations were for both openssl and mysql, I woke up.

sudo perl Makefile.PL --libs="-L/usr/local/opt/openssl/lib -lssl -lcrypto -L/usr/local/lib -L/usr/local/Cellar/mysql/8.0.12/lib -lmysqlclient"

Now. that worked because after looking in the mysaql lib directory, I see that the library is 'mysqlclient' and not mysql. As you see above.

Now that worked doing the Makefile.PL thing as above.

Then 'make' worked. As above. Not showing any errors... as above

Then sudo make test worked - this time.

All tests successful.
Files=73, Tests=9, 11 wallclock secs ( 0.24 usr  0.15 sys +  8.25 cusr  1.23 csys =  9.87 CPU)
Result: PASS

Finally - make install. Worked

zeus:DBD-mysql-4.048-0 robert$ sudo make install
"/usr/local/Cellar/perl/5.28.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- mysql.bs blib/arch/auto/DBD/mysql/mysql.bs 644
Manifying 3 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Installing /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/Bundle/DBD/mysql.pm
Installing /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql.pm
Installing /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql/INSTALL.pod
Installing /usr/local/Cellar/perl/5.28.0/lib/perl5/site_perl/5.28.0/darwin-thread-multi-2level/DBD/mysql/GetInfo.pm
Installing /usr/local/Cellar/perl/5.28.0/share/man/man3/Bundle::DBD::mysql.3
Installing /usr/local/Cellar/perl/5.28.0/share/man/man3/DBD::mysql::INSTALL.3
Installing /usr/local/Cellar/perl/5.28.0/share/man/man3/DBD::mysql.3
Appending installation info to /usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/perllocal.pod
zeus:DBD-mysql-4.048-0 robert$ pwd
/Users/robert/.cpan/build/DBD-mysql-4.048-0

Well finally. Now why did I want this? I can't remember.

这篇关于cpan安装的DBD :: mysql测试失败,未找到符号。 OSX Mojave的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆