由于缺少libmysql,在Windows上安装mysql-2.9.0 gem失败 [英] Installing mysql-2.9.0 gem on Windows fails due to lack of libmysql
问题描述
我正在尝试在Windows Server 2003上安装Redmine 2.1.4.要使其正常工作,我需要安装activerecord-mysql-adapter
gem,而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下载了mysql-connector-c-6.0.2-win32.msi
和mysql-connector-c-6.0.2-win32-vs2005.msi
. com/downloads/connector/c/,但两个安装程序均退出:
我还尝试将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无法找到其他一些lib和标头.所以我猜,我需要使用像这样的选项:
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"
也不起作用(可能是由于路径中的空格).
尝试不使用来自 http://dev.mysql.com/downloads/connector/c/并将内容解压缩到根文件夹或没有任何空间的文件夹路径中,然后尝试安装mysql gem >
示例
gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
I'm trying to install Redmine 2.1.4 on Windows Server 2003. For it to work, I need to install activerecord-mysql-adapter
gem, which in turn seems to rely on mysql-2.9.0.gem
. I've downloaded the latter from rubygems and executed:
gem install mysql-2.9.0.gem
which gives the following output:
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
I'm guessing, one possibility is I'm lacking MySQL C Connector library. I've downloaded both mysql-connector-c-6.0.2-win32.msi
and mysql-connector-c-6.0.2-win32-vs2005.msi
from http://dev.mysql.com/downloads/connector/c/, but both installers exited with:
I also tried copying C:\Program Files\MySQL\MySQL Server 5.1\lib\debug\libmysql.dll
to C:\Ruby193\bin
, but it also didn't solve the mysql-2.9.0.gem installation issue.
What else can I try?
EDIT
From the logs I figured, Ruby was looking for libs under, surprise, surprise, $RUBY_HOME\lib, not $RUBY_HOME\bin, as found in some sources mentioned in the question. So moving the libmysql from $MySQL_HOME\lib to $RUBY_HOME\lib helped a little, but now Ruby cannot find some other libs and headers. So I'm guessing, I need to use the an option like:
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"
which won't work either (probably because of spaces in path).
Try with no installer version of connector from http://dev.mysql.com/downloads/connector/c/ and extract the content in root folder or a folder path which does not have any space for and then try to install mysql gem
example
gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
这篇关于由于缺少libmysql,在Windows上安装mysql-2.9.0 gem失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!