ruby-on-rails - 带有 native 扩展的MySQL2错误:无法构建gem native 扩展。 (Gem::Installer::ExtensionBuildError)

标签 ruby-on-rails rubygems

我正在尝试为安装 gem mysql2 Ruby Enterprise Edition 。我收到错误提示:

    Installing mysql2 (0.2.7) with native extensions /Users/rookieRails/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /Users/vinayashrestha/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... no
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

有谁知道我应该使用什么配置选项,或者需要什么来解决此问题?

最佳答案

试试这个,它对我有用:

sudo apt-get install libmysql-ruby libmysqlclient-dev

关于ruby-on-rails - 带有 native 扩展的MySQL2错误:无法构建gem native 扩展。 (Gem::Installer::ExtensionBuildError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7170722/

相关文章:

ruby - 在 Windows 7 上使用 Ruby 2.3 安装 Mechanize 出现错误

ruby-on-rails - 是否有比蛮力更聪明的 Ruby 算法来查找多维数据中的相关性?

ruby-on-rails - Rails + Gems(一般而言): How do gems work?

ruby-on-rails - 为什么在 Rails 中使用/app/lib 而不是/lib?

ruby-debug-ide 无法在使用 Ruby 2.0 的 Ubuntu 上安装

rubygems - 如何在 RubyMine 中打开 gem 进行编辑?

ruby-on-rails - Rails local_assign 与局部变量

javascript - 是否可以跟踪用户事件 session 中的互联网断开情况?

gem - 为什么使用 .freeze 和 .dup SomeGem::VERSION?

ruby-on-rails - gem 更新: unable to convert "\xE7" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII