[英]Error Installing Mysql2 on OSX
嘗試安裝特定版本的Mysql2 Gem。 我得到這個:
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
作為參考,我事先運行brew install mysql
,它成功運行。 我也嘗試卸載brew
的mysql參考的所有版本,以防萬一。
我缺少什么嗎? 我環顧四周,大多數頁面都指向確保您運行我擁有的brew install mysql
。
如果我對我的上述解釋不太清楚,我得到的失敗是成功運行brew install mysql
的錯誤,該錯誤是由於之后嘗試通過gem install mysql2 -v '0.3.20'
任何想法? 謝謝
僅作為參考,最終工作的是xcode-select --install
,它似乎安裝了OpenSSL庫,該庫處理了ld: library not found for -lssl
,該ld: library not found for -lssl
問題ld: library not found for -lssl
。
如何使其在MacOS Mojave上工作。
確保通過Homebrew在Mac上安裝了openssl
:
brew install openssl
然后按照以下特殊方式安裝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
其中xxx-mysql2 gem的指定版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.