[英]El Capitan perl DBD unsafe use of relative path
I encountered the following error while trying to run a perl script that uses DBI
after upgrading to El Capitan (typical!): 尝试运行升级到El Capitan后使用
DBI
的perl脚本时遇到以下错误(典型!):
install_driver(mysql) failed: Can't load '/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Reason: unsafe use of relative rpath libmysqlclient.18.dylib in /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle with restricted binary at /System/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 194.
After seeing a solution posted for a similar problem in python here I have posted the same solution for Perl below. 看到贴在Python中的类似问题的解决方案后, 在这里我已经发布了以下的Perl相同的解决方案。
El Capitan's system integrity protection prevents programs in protected locations (in this case /usr) from calling a shared library that uses a relative reference to another shared library. El Capitan的系统完整性保护可防止受保护位置(在本例中为/ usr)中的程序调用使用对另一个共享库的相对引用的共享库。 The following solved it for me.
以下为我解决了这个问题。 Note, my mysql is installed via brew.
注意,我的mysql是通过brew安装的。
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/Cellar/mysql/5.6.26/lib/libmysqlclient.18.dylib /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
You can also install mysql, or its open source alternative mariadb, with the "brew" tool. 您还可以使用“brew”工具安装mysql或其开源替代mariadb。 This avoids giving the above issue on El Capitan
这避免了在El Capitan上提出上述问题
$ brew install mysql
or 要么
$ brew install mariadb
You can find brew at http://brew.sh/ 你可以在http://brew.sh/找到brew。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.