簡體   English   中英

gem install mysql:無法構建gem原生擴展(Mac Lion)

[英]gem install mysql: Failed to build gem native extension (Mac Lion)

我為Mac OS X Lion安裝了MySQL 5.5.27(來自.dmg)。

現在我嘗試安裝mysql gem:

$ gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/Users/serg/.rvm/rubies/ree-1.8.7-head/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/serg/.rvm/rubies/ree-1.8.7-head/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib


Gem files will remain installed in /Users/serg/.rvm/gems/ree-1.8.7-head/gems/mysql-2.8.1 for inspection.
Results logged to /Users/serg/.rvm/gems/ree-1.8.7-head/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

我該如何解決這個問題?

哦,這是我的解決方案:

1) I installed homebrew.
2) $ brew install mysql
3) $ gem install mysql

就這些。

看起來gem安裝程序無法找到您的MySQL庫/標頭。

嘗試指定MySQL目錄,例如

gem install mysql -- --with-mysql-dir=/usr/local/mysql

(您可能需要確定安裝MySQL的DMG分布的位置,YMMV。)

gem install mysql -- --with-mysql-dir=/usr/local/mysql

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM