2012-07-25 106 views
2

我有git clone git://github.com/jalagrange/excel_test_app.git 捆綁安裝時出現以下錯誤,這不會發生在其他我的應用程序中。bundle install:無法構建gem原生擴展

以下錯誤

Installing mysql2 (0.3.6) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb 
checking for rb_thread_blocking_region()... yes 
checking for main() in -llibmysql... no 
*** 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. 

的Gemfile

source 'http://rubygems.org' 

gem 'rails', '3.1.0' 

# Bundle edge Rails instead: 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3' 
gem "spreadsheet" 
gem "carrierwave" 
gem "mini_magick" 
gem 'flash_cookie_session' 
gem "pry" 
gem "haml" 
gem 'fog' 

# To use Delayed_job 
gem 'daemons' 
gem 'delayed_job_active_record' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', " ~> 3.1.0" 
    gem 'coffee-rails', "~> 3.1.0" 
    gem 'uglifier' 
end 

gem 'jquery-rails' 

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

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 

group :test do 
    # Pretty printed test output 
    gem 'turn', :require => false 
end 


group :development, :test do 
    gem "mysql2", "0.3.6" 
    gem "letter_opener" 
    gem "pry" 
end 

這個問題和答案不工作我的問題.. gem install: Failed to build gem native extension (can't find header files)

問題解決了, 我已經運行包更新.. thx all ..

回答

3

運行以下命令和安裝包再次

sudo apt-get install libmysql-ruby libmysqlclient-dev

+0

版本沒有解決,請參閱這個線程的接受答案,這是非常相似的公關你正面臨的問題.. http://stackoverflow.com/questions/5841406/cannot-install-mysql2-gem – Kalpesh 2012-07-25 15:29:46

+0

我得到了下面的錯誤,而安裝gem安裝mysql2 -v = 0.3.6但沒有錯誤gem install mysql2 – 2012-07-25 16:15:27

+0

好的,你有沒有試過「gem install mysql2 -v = 0.3.6」? – Kalpesh 2012-07-25 16:17:21

0
sudo apt-get install libmysqlclient-dev 

然後

gem install mysql2 -v=X.X.x 

其中xxx是你需要
然後捆綁,如果它仍然安裝

相關問題