我正在尝试使用此命令在我的工作站上安装 mysql gem
gem 安装 mysql-2.8.1.gem
输出 :
> Building native extensions. This could take a while...
ERROR: Error installing mysql-2.8.1.gem:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... yes
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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=C:/Ruby187/bin/ruby
--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-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.8.1
for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/ge
m_make.out
因此之前我无法找到“libmysqllib”,直到我将该文件复制到与我手动安装的 gem 相同的目录中。
我使用代理,因此我必须下载 *.gem 文件并从那里安装。
Running XP Sp3
MySQL version : 5.1.53
Ruby Version 1.8.7
Gem list :
actionmailer (2.3.5, 2.3.4)
actionpack (2.3.5, 2.3.4)
activerecord (2.3.5, 2.3.4)
activeresource (2.3.5, 2.3.4)
activesupport (2.3.5, 2.3.4)
hoe (2.7.0)
json_pure (1.4.6)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
rake-compiler (0.7.5)
rubyforge (2.0.4)
请帮忙。
诚挚的问候,诺埃尔。
答案1
您缺少一些编译时依赖项。检查事项
您是否安装了 mysql dev 文件,例如在 Ubuntu 上这是 libmysqlclient15-dev
是否安装了 ruby1.8.7 dev 文件,例如 ruby1.8-dev Ubuntu
您确实不需要复制该库。这表明您可能没有安装 mysqlclient 库。
希望对您有所帮助!
克里斯