我正在尝试在 Windows Server 2003 上安装 Redmine 2.1.4。为了让它工作,我需要安装activerecord-mysql-adapter
gem,而这又似乎依赖于mysql-2.9.0.gem
. 我已经从rubygems下载了后者并执行了:
gem install mysql-2.9.0.gem
给出以下输出:
C:\>gem install mysql-2.9.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql-2.9.0.gem:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... 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:/Ruby193/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:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.0/ext/mysql_api/gem_make.out
我猜,一种可能性是我缺少 MySQL C 连接器库。我已经从http://dev.mysql.com/downloads/connector/c/mysql-connector-c-6.0.2-win32.msi
下载了两者,但是两个安装程序都退出了:
mysql-connector-c-6.0.2-win32-vs2005.msi
我也尝试复制C:\Program Files\MySQL\MySQL Server 5.1\lib\debug\libmysql.dll
到C:\Ruby193\bin
,但也没有解决 mysql-2.9.0.gem 安装问题。
我还能尝试什么?
编辑
从我认为的日志中,Ruby 正在寻找 $RUBY_HOME\lib,而不是 $RUBY_HOME\bin 下的库,如问题中提到的一些来源中所发现的。所以将 libmysql 从 $MySQL_HOME\lib 移动到 $RUBY_HOME\lib 有一点帮助,但现在 Ruby 找不到其他一些库和头文件。所以我猜,我需要使用如下选项:
C:\>gem install mysql-2.9.0.gem --platform=ruby --with-opt-lib="C:/Program Files/MySQL/MySQL Server 5.1/lib" --with-opt-include="C:/Program Files/MySQL/MySQL Server 5.1/include"
这也不起作用(可能是因为路径中有空格)。