简体   繁体   English

在OSX上安装Mysql2时出错

[英]Error Installing Mysql2 on OSX

Attempting to install a specific version Mysql2 Gem. 尝试安装特定版本的Mysql2 Gem。 And I get this: 我得到这个:

sudo gem install mysql2 -v '0.3.20'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

    /usr/local/var/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20161017-56699-1dsu6v9.rb extconf.rb
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
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for 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

make "DESTDIR=" clean

make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.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

For reference I ran brew install mysql beforehand and it ran successfully. 作为参考,我事先运行brew install mysql ,它成功运行。 Also I tried uninstalling all versions of brew 's mysql references just in case. 我也尝试卸载brew的mysql参考的所有版本,以防万一。

Is there something im missing? 我缺少什么吗? I've looked around and most pages point back to making sure you run brew install mysql which I have. 我环顾四周,大多数页面都指向确保您运行我拥有的brew install mysql

In case I wasn't more clear with my above explanation, the failure I am getting is after successfully running brew install mysql the error is from trying to install the gem afterwards via gem install mysql2 -v '0.3.20' 如果我对我的上述解释不太清楚,我得到的失败是成功运行brew install mysql的错误,该错误是由于之后尝试通过gem install mysql2 -v '0.3.20'

Any idea? 任何想法? Thanks 谢谢

仅作为参考,最终工作的是xcode-select --install ,它似乎安装了OpenSSL库,该库处理了ld: library not found for -lssl ,该ld: library not found for -lssl问题ld: library not found for -lssl

How to make it work on MacOS Mojave. 如何使其在MacOS Mojave上工作。

Make sure openssl is installed on Mac via Homebrew: 确保通过Homebrew在Mac上安装了openssl

brew install openssl

Then install mysql2 gem following this special way: 然后按照以下特殊方式安装mysql2 gem:

gem install mysql2 -v 'x.x.x' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include

where xxx - specified version of the mysql2 gem. 其中xxx-mysql2 gem的指定版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM