【发布时间】:2014-05-27 17:42:23
【问题描述】:
当我尝试运行一个 ruby 文件“ruby DisplayWishes.rb”时,我收到一个要求加载错误。 我安装了以下 mysql 包,看看它是否有帮助,目前没有任何效果:
sudo apt-get install ruby-mysql
sudo apt-get install ruby-mysql2
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require':cannot load such file -- mysql(LoadError)
from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from DisplayWishes.rb:3:in '<main>'
当我尝试 gem install mysql & mysql2
sudo gem install mysql2
Fetching: mysql2-0.3.15.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby 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()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
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... yes
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.
【问题讨论】:
-
你安装了 MySQL gem 和 MySQL Server 吗?
-
我安装了 mysql 服务器,但我认为我没有安装 mysql gem。
-
只是让你知道,它不是 ruby on rails。
-
做
gem install mysql && gem install mysql2 -
我在尝试安装两者时收到错误消息。 extconf.rb 失败 - 由于某种原因无法创建 makefile,可能缺少必要的库和/或头文件。检查 mkmf.log 文件以获取更多详细信息。您可能需要配置选项