Search code examples
ruby-on-railsubuntucapistrano3linode

Rails deploy on Ubuntu with capistrano error: Could not create Makefile due to some reason, probably lack of necessary


I use Ubuntu 14.04 LTS on Linode, rails4.1, ruby2.1.2, capistrano 3.2.0.

I installed Nginx and passenger on VPS. It'S work definitely. But, when I deploy my rails application by input cap production deploy in terminal. It showed the error I couldn't fix.

Actually, I followed the guide: https://gorails.com/deploy/ubuntu/14.04


eorror: https://gist.github.com/ryanyangtw/fa97c36a723d30860602

DEBUG[27933387] Finished in 0.179 seconds with exit status 0 (successful).
INFO[5a5a76ae] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/ryan/artstore/shared/bin --path /home/ryan/artstore/shared/bundle --without development test --deployment --quiet on 106.185.32.71
DEBUG[5a5a76ae] Command: cd /home/ryan/artstore/releases/20140809143256 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/ryan/artstore/shared/bin --path /home/ryan/artstore/shared/bundle --without development test --deployment --quiet
DEBUG[5a5a76ae]     Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
DEBUG[5a5a76ae]
DEBUG[5a5a76ae]         /home/ryan/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
DEBUG[5a5a76ae]     *** extconf.rb failed ***
DEBUG[5a5a76ae]     Could not create Makefile due to some reason, probably lack of necessary
DEBUG[5a5a76ae]     libraries and/or headers.  Check the mkmf.log file for more details.  You may
DEBUG[5a5a76ae]     need configuration options.
DEBUG[5a5a76ae]
DEBUG[5a5a76ae]     Provided configuration options:
DEBUG[5a5a76ae]         --with-opt-dir
DEBUG[5a5a76ae]         --without-opt-dir
DEBUG[5a5a76ae]         --with-opt-include
DEBUG[5a5a76ae]         --without-opt-include=${opt-dir}/include
DEBUG[5a5a76ae]         --with-opt-lib
DEBUG[5a5a76ae]         --without-opt-lib=${opt-dir}/lib
DEBUG[5a5a76ae]         --with-make-prog
DEBUG[5a5a76ae]         --without-make-prog
DEBUG[5a5a76ae]         --srcdir=.
DEBUG[5a5a76ae]         --curdir
DEBUG[5a5a76ae]         --ruby=/home/ryan/.rvm/rubies/ruby-2.1.2/bin/ruby
DEBUG[5a5a76ae]     /home/ryan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory @ rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
DEBUG[5a5a76ae]         from /home/ryan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
DEBUG[5a5a76ae]         from /home/ryan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
DEBUG[5a5a76ae]         from /home/ryan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
DEBUG[5a5a76ae]         from /home/ryan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
DEBUG[5a5a76ae]         from extconf.rb:83:in `block in <main>'
DEBUG[5a5a76ae]         from extconf.rb:82:in `each'
DEBUG[5a5a76ae]         from extconf.rb:82:in `<main>'
DEBUG[5a5a76ae]
DEBUG[5a5a76ae]     extconf failed, exit code 1
DEBUG[5a5a76ae]
DEBUG[5a5a76ae]     Gem files will remain installed in /home/ryan/artstore/shared/bundle/ruby/2.1.0/gems/debugger-1.6.8 for inspection.
DEBUG[5a5a76ae]     Results logged to /home/ryan/artstore/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/debugger-1.6.8/gem_make.out
DEBUG[5a5a76ae]     An error occurred while installing debugger (1.6.8), and Bundler cannot
DEBUG[5a5a76ae]     continue.
DEBUG[5a5a76ae]     Make sure that `gem install debugger -v '1.6.8'` succeeds before bundling.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 106.185.32.71: bundle exit status: 5
bundle stdout: Nothing written
bundle stderr: Nothing written
/Users/Ryan/.rvm/gems/ruby-2.0.0-p451/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/Users/Ryan/.rvm/gems/ruby-2.0.0-p451/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/Users/Ryan/.rvm/gems/ruby-2.0.0-p451/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/Ryan/.rvm/gems/ruby-2.0.0-p451/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/Ryan/.rvm/gems/ruby-2.0.0-p451/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'

I have two mkmf.log file:

  1. /home/ryan/artstore/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/bcrypt-3.1.7/mkmf.log
  2. /home/ryan/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/nokogiri-1.6.3.1/mkmf.log

In /home/ryan/artstore/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/bcrypt-3.1.7/mkmf.log:

    have_header: checking for ruby/util.h... -------------------- yes

    "gcc -o conftest -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/x86_64-linux -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/ruby/backward -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0 -I.     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/home/ryan/.rvm/rubies/ruby-2.1.2/lib -Wl,-R/home/ryan/.rvm/rubies/ruby-2.1.2/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R -Wl,'/../lib' -L'/../lib' -lruby  -lpthread -ldl -lcrypt -lm   -lc"
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: int main(int argc, char **argv)
    4: {
    5:   return 0;
    6: }
    /* end */

    "gcc -E -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/x86_64-linux -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/ruby/backward -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0 -I.     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC  conftest.c -o conftest.i"
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: #include <ruby/util.h>
    /* end */

In /home/ryan/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/nokogiri-1.6.3.1/mkmf.log:

have_header: checking for iconv.h... -------------------- yes

"gcc -o conftest -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/x86_64-linux -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/ruby/backward -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0 -I. -I/usr/include     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c  -L. -L/home/ryan/.rvm/rubies/ruby-2.1.2/lib -Wl,-R/home/ryan/.rvm/rubies/ruby-2.1.2/lib -L/usr/lib -Wl,-R/usr/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     -Wl,-rpath,'/../lib' -Wl,-R -Wl,'/../lib' -L'/../lib' -lruby  -lpthread -ldl -lcrypt -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -E -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/x86_64-linux -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0/ruby/backward -I/home/ryan/.rvm/rubies/ruby-2.1.2/include/ruby-2.1.0 -I. -I/usr/include     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <iconv.h>
/* end */                                                                                                              

My gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]


#customize gem
#gem 'pry', '~> 0.10.0'
gem 'pry-rails'
gem 'pry-plus'
gem "simple_form", "3.1.0rc1"
gem 'bootstrap-sass', '~> 3.2.0.0'
#The bootstrap-sass-rails gem is deprecated starting with version 3.1.0.0.
#gem 'bootstrap-sass-rails', '~> 3.1.0.0'
gem 'will_paginate' , '~> 3.0'
gem 'will_paginate-bootstrap' 
gem 'devise' , '~> 3.2'
gem 'carrierwave'
gem 'mini_magick', '~> 3.7.0'
gem 'cocoon', '~> 1.2.6'
gem 'settingslogic', '~> 2.0.9'
gem 'aasm', '~> 3.3.1'
gem 'stripe'
gem 'roadie'
gem 'ransack', github: 'activerecord-hackery/ransack', branch: 'rails-4.1'

# add for snipper 
gem 'jquery-ui-rails', '~> 5.0.0'

# add for sidekiq
gem 'sidekiq', '~> 3.2.1'
gem 'sinatra', require: false
gem 'slim'

#add for capistrano
gem 'capistrano', '~> 3.2.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rvm', github: "capistrano/rvm"

gem 'mysql2'

group :developmet, :test do
    gem 'guard-livereload'
    gem 'annotate', '~> 2.6.5'
    gem 'letter_opener', '~> 1.2.0'
end

please help me. I will appreciate it. Thanks!


Solution

  • In production environment, you don't need to debug the application. debugger is dependency of pry-rails. So, you should specify that rails should install pry-rails gem only in development and test environment.

    In your Gemfile replace

    gem 'pry-rails'
    gem 'pry-plus'
    

    with

    group :development do
      gem 'pry-rails'
      gem 'pry-plus'
    end
    

    Then run bundle install and push your latest changes to your repo.

    Now deploy code again:

    cap production deploy