在Linux和Ruby 1.9.2上安装MySQL-Ruby


0

我在使用Ruby 1.9.2在RedHat 4上安装MySQL-Ruby时遇到了非常困难的困难。我是一个公司代理的背后,几乎可以防止任何包工具连接到外部存储库,因此“gem install mysql”不会削减它。我已尝试在本地安装mysql-ruby gem,但它失败并带有一个神秘的:

$gem install 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.

/ns/local/apps/internal/SWS/MetricsPublisher/ruby/bin/ruby extconf.rb
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. 

我也尝试按照附带的自述文件自己构建模块。结果:

$ruby extconf.rb --with-mysql-include=/path_to_my_sql_headers/mysql/include/ --with-mysql-lib=/path_to_my_sql_lib/mysql/lib/
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-Ruby是否有效,我只想通过ruby 1.9中的ruby调用连接到MySQL数据库。谢谢。


pkg-config找不到-lmysqlclient的样子
RobotHumans

Answers:


0

bundler通常会在rails中为我选择合适的包...我在之前安装的ubuntu上遇到了同样的问题,似乎我需要指定ruby版本,架构和mysql版本作为gem名称的一部分来使其映射到我正确的库版本。还要确保在搜索路径和ld路径中安装了所有正确的依赖项


注意:我现在也改用了rvm和ree。
RobotHumans
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.