简体   繁体   English

gem install mysql:无法构建gem原生扩展(Mac Lion)

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

I installed MySQL 5.5.27 for Mac OS X Lion (from .dmg). 我为Mac OS X Lion安装了MySQL 5.5.27(来自.dmg)。

Now i try to install the mysql gem: 现在我尝试安装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

How can i fix that? 我该如何解决这个问题?

Okey, here is my solution: 哦,这是我的解决方案:

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

That is all. 就这些。

It looks like the gem installer can't find your MySQL libraries/headers. 看起来gem安装程序无法找到您的MySQL库/标头。

Try specifying the MySQL directory, eg 尝试指定MySQL目录,例如

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

(You might need to figure out where the DMG distribution of MySQL is installed, YMMV.) (您可能需要确定安装MySQL的DMG分布的位置,YMMV。)

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

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

相关问题 MySQL 安装:错误:无法构建 gem 原生扩展 - MySQL Install: ERROR: Failed to build gem native extension 无法在 Mysql Docker 容器中安装 mysql2 gem:无法构建 gem 本机扩展 - Cannot install mysql2 gem inside Mysql Docker container: Failed to build gem native extension mysql2 gem无法在Windows 7上安装:无法生成gem本机扩展 - mysql2 gem failing to install on Windows 7: failed to build gem native extension Ruby - Gem - mysql - 无法构建gem原生扩展 - Ruby - Gem - mysql - Failed to build gem native extension 安装mysql2 gem时出错:无法构建gem原生扩展 - Error installing mysql2 gem: Failed to build gem native extension 错误:安装mysql2时出错:错误:无法构建gem原生扩展。 在Mac 10.12上 - ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. on Mac 10.12 错误:无法构建 gem 原生扩展 - 安装 mysql2 时出错 - ERROR: Failed to build gem native extension - Error installing mysql2 错误:无法构建 gem 本机扩展(rails 3.2.3 上的 mysql2) - ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3) 错误:安装mysql时出错:错误:无法构建gem本机扩展 - ERROR: Error installing mysql: ERROR: Failed to build gem native extension 安装 mysql2 时出错:无法构建 gem 原生扩展 - Error installing mysql2: Failed to build gem native extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM