我的应用正在使用pg gem
,但我遇到了一些问题,因此我从pg
切换到mysql
,但是当我运行bundle
时,它会导致错误。
我的gem file
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.13'
# Use pg as the database for Active Record
# gem 'pg'
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass'
gem 'sass-rails', '~> 5.0'
# 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'
# for user authentication
gem 'devise', '~> 3.2'
# Use materialize css
gem 'materialize-sass'
gem 'material_icons'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
#For authorization
gem 'the_role'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development do
gem 'binding_of_caller'
gem 'better_errors'
gem 'byebug'
end
这是我的日志:
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Using i18n 0.7.0
Using minitest 4.7.5
Using multi_json 1.11.2
Using thread_safe 0.3.5
Using tzinfo 0.3.45
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.5
Using mime-types 2.6.2
Using activerecord-deprecated_finders 1.0.4
Using arel 4.0.2
Using execjs 2.6.0
Using json 1.8.3
Using bcrypt 3.1.10
Using coderay 1.1.0
Using debug_inspector 0.0.2
Using sass 3.4.18
Using bundler 1.11.2
Using byebug 8.2.1
Using coffee-script-source 1.9.1.1
Using thor 0.19.1
Using orm_adapter 0.5.0
Using tilt 2.0.1
Installing mysql2 0.4.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/vinay/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160116-12648-1cquvr6.rb extconf.rb
checking for ruby/thread.h... *** 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/vinay/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
/home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /home/vinay/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:16:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/vinay/.rvm/gems/ruby-2.2.1@rails4/gems/mysql2-0.4.2 for inspection.
Results logged to /home/vinay/.rvm/gems/ruby-2.2.1@rails4/extensions/x86-linux/2.2.0/mysql2-0.4.2/gem_make.out
Using rdoc 4.2.0
Using temple 0.7.6
Using activesupport 4.0.13
Using rack-test 0.6.3
Using warden 1.2.3
Using sprockets 3.3.5
Using mail 2.6.3
Using autoprefixer-rails 6.1.2
Using uglifier 2.7.2
Using better_errors 2.1.1
Using binding_of_caller 0.7.2
Using materialize-sass 0.97.1
Using coffee-script 2.4.1
Using haml 4.0.7
An error occurred while installing mysql2 (0.4.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.2'` succeeds before bundling.
我不确定是什么问题。任何人都可以帮助我。 提前谢谢。