[英]OSX dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
I installed mysql (5.6.27), the newest mysql version at this time(5.7..). 我安装了mysql(5.6.27),这是当前最新的mysql版本(5.7 ..)。
I have mysql2 gem installed with version - 0.3.14 我安装了mysql2 gem-版本0.3.14
When i try to run rake db:create
i get error message: 当我尝试运行
rake db:create
出现错误消息:
Karliss-Air:gostyling myuser$ rake db:create
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Users/myuser/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Users/myuser/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
Expected in: flat namespace
BUT the wierd thing is when i run nm -gU
it shows that the dylib is there: 但是更奇怪的是,当我运行
nm -gU
它表明dylib在其中:
Karliss-Air:gostyling myuser$ nm -gU /usr/local/lib/libmysqlclient.18.dylib | grep _mysql_get_client_info
0000000000002ff5 T _mysql_get_client_info
Karliss-Air:gostyling myuser$
I have tryed to define mysql path when instsalling the gem 安装gem时,我尝试定义mysql路径
gem pristine mysql2 -v '0.3.14' -- --with-mysql-dir=/usr/local/Cellar/mysql56/5.6.27 -–with-mysql-config=/usr/local/Cellar/mysql56/5.6.27/bin/mysql_config
It doesnt help. 它没有帮助。
I would really appriciate the help! 我真的很乐意提供帮助!
If you are using rvm/without rvm(just use sudo) then please use the following command which solve the issues. 如果您使用的是rvm /不带rvm(只需使用sudo),则请使用以下命令解决问题。
rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib
else try,uninstalling mysql2 gem and then installing gem with sudo would solve it sometimes. 否则,尝试卸载mysql2 gem,然后使用sudo安装gem有时会解决。
sudo gem uninstall mysql2
sudo gem install mysql2
or look into this: Lazy symbol binding failed when creating ruby db 或者看一下: 创建Ruby数据库时,懒惰符号绑定失败
Resolved the issue by reinstalling my macbook. 通过重新安装Macbook解决了该问题。 The problem, i think, was that i installed mysql5.7 first, then tryed to use mysql56.
我认为问题是我先安装了mysql5.7,然后尝试使用mysql56。 After reinstall i installed mysql56 straight away and everything worked just fine.
重新安装后,我立即安装了mysql56,一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.