我正在尝试部署通过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的做法有何不同?
答案 0 :(得分:1)
它可能没有像直接登录那样加载shell环境,因此无法找到mysqlclient库。
通常它希望能够找到可以为其提供信息的mysql_config。如果你能弄清楚如何将--with-mysql-config=/path/to/mysql_config
传递给构建器,我怀疑它可能会有所帮助。我之前就是这样做的:gem install mysql2 -- --with-mysql-config=/path/to/mysql_config
我不确定如何让捆绑商这样做,但我希望这些信息有帮助