MySQL和MySQL2 gem在主机上构建,但不通过Capistrano或SSH构建

时间:2011-02-23 03:09:43

标签: mysql ruby rubygems capistrano bundler

我正在尝试部署通过Capistrano使用Bundler的Rails应用程序。

运行cap deploy:cold即可:

** [out :: (my host)] Installing mysql2 (0.2.6)  
** [out :: (my host)] with native extensions  
*** [err :: (my host)] /usr/lib64/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)  
*** [err :: (my host)]  
*** [err :: (my host)] /usr/bin/ruby extconf.rb  
*** [err :: (my host)] checking for rb_thread_blocking_region()... no  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] checking for main() in -lm... yes  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] checking for main() in -lz... yes  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] checking for main() in -lsocket... no  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] checking for main() in -lnsl... yes  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] checking for main() in -lmygcc... no  
*** [err :: (my host)] checking for mysql_query() in -lmysqlclient... no  
*** [err :: (my host)] *** extconf.rb failed ***  
*** [err :: (my host)] Could not create Makefile due to some reason, probably lack of  
*** [err :: (my host)] necessary libraries and/or headers.  Check the mkmf.log file for more  
*** [err :: (my host)] details.  You may need configuration options. 

只需安装mysql-dev软件包或者其他什么?不完全是因为gems(mysql和mysql2)都在使用Bundler的机器上构建而没有任何问题,加上其他gems安装没有任何问题。

Capistrano的做法有何不同?

1 个答案:

答案 0 :(得分:1)

它可能没有像直接登录那样加载shell环境,因此无法找到mysqlclient库。

通常它希望能够找到可以为其提供信息的mysql_config。如果你能弄清楚如何将--with-mysql-config=/path/to/mysql_config传递给构建器,我怀疑它可能会有所帮助。我之前就是这样做的:gem install mysql2 -- --with-mysql-config=/path/to/mysql_config

我不确定如何让捆绑商这样做,但我希望这些信息有帮助