微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

错误:安装mysql2时出错:错误:无法构建gem原生扩展.在Mac 10.12上

I tried every solution similar to the question:

最近,我从ubuntu转移到Mac,我试图在Sierra上安装mysql gem,之后我安装了Ruby,Rails,MysqL,

我也输入brew install MysqL,它可以下载MysqL而不是gem,所以我的问题并不相似.

我输入了这个MysqL –version

我使用EditLine包装器为osx10.12(x86_64)获得了MysqL Ver 14.14 distrib 5.7.16

我试图安装MysqL2 gem for rails来构建一个新的应用程序

我输入了这个sudo gem install MysqL2并得到了这个错误

Password:
Building native extensions.  This Could take a while...
ERROR:  Error installing MysqL2:
ERROR: Failed to build gem native extension.

current directory: /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/MysqL2-0.4.5/ext/MysqL2
/Users/mohammed.elias/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170102-2045-18gcs95.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using MysqL_config at /usr/local/bin/MysqL_config
-----
checking for MysqL.h... yes
checking for SSL_MODE_disABLED in MysqL.h... yes
checking for SSL_MODE_PREFERRED in MysqL.h... yes
checking for SSL_MODE_required in MysqL.h... yes
checking for SSL_MODE_VERIFY_CA in MysqL.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in MysqL.h... yes
checking for errmsg.h... yes
checking for MysqLd_error.h... yes
-----
Don't kNow how to set rpath on your system, if MysqL libraries are not in path MysqL2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/MysqL/5.7.16/lib
-----
creating Makefile

To see why this extension Failed to compile, please check the mkmf.log which can be found here:

  /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0-static/MysqL2-0.4.5/mkmf.log

current directory:     /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/MysqL2-0.4.5/ext/MysqL2
make "DESTDIR=" clean

current directory:     /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/MysqL2-0.4.5/ext/MysqL2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling MysqL2_ext.c
compiling result.c
compiling statement.c
linking shared-object MysqL2/MysqL2.bundle
ld: library not found for -lssl
clang: error: linker command Failed with exit code 1 (use -v to see invocation)
make: *** [MysqL2.bundle] Error 1

make Failed, exit code 2

Gem files will remain installed in     /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mysq l2-0.4.5 for inspection.
Results logged to     /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0-static/MysqL2-0.4.5/gem_make.out

解决方法:

我的问题很好的答案,感谢@Holger只是在githup ld: library not found for -lssl` after Mac OS Sierra upgrade上引用这个问题

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐