碰到一个问题,缠了我一天多了!问下大家有没有人碰到过类似情况
环境: 阿里云 centos 6.5 ruby 2.2.5 rails 5.1.4
想配置 nginx+puma+mina 的一个 rails 环境,但是在 mina 部分出了问题,大家帮忙看看
我这边直接用 yum 装的 mysql5.6
mina 主要配置部分如下
task :remote_environment do
invoke :'rvm:use', 'ruby-2.2.5@default'
end
desc "Deploys the current version to the server."
task :deploy do
deploy do
comment "Deploying #{fetch(:application_name)} to #{fetch(:domain)}:#{fetch(:deploy_to)}"
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
end
在 bundle install 的时候有如下报错:
Fetching mysql2 0.4.9
Installing mysql2 0.4.9 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/xxx/www/xxx/shared/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.9/ext/mysql2
/home/xxx/.rvm/rubies/ruby-2.2.5/bin/ruby -r
./siteconf20171217-27165-1vu49lh.rb extconf.rb --with-mysql-config=/etc/my.cnf
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Cannot execute mysql_config at /etc/my.cnf
-----
*** 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=/home/bingxin/.rvm/rubies/ruby-2.2.5/bin/$(RUBY_BASE_NAME)
--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-mysql-config
这里提到
Cannot execute mysql_config at /etc/my.cnf
但是直接执行
gem install mysql2
是可以成功安装的。
这里有个问题我比较怀疑, 服务器上我是用 rvm 装的 ruby2.2.5.。但是在 mina bundle install 的时候,在 shared/vendor/bundle 中生成的 ruby 是 2.2.0 的。但是在 mina 当中的确是设置了 rvm,并且 mysql 的报错中也能看出来设置已经生效,这是什么情况???为什么是 2.2.0?。
不知道大家有没有遇到过类似情况?