mysql2 のインストールで bundle install がコケる (Ubuntu)

Pocket
LINEで送る

この記事の所要時間: 1134

mysql2のインストールでbundle installがコケる (CentOS) | MyNotebook の Ubuntu バージョン。

  • Ubuntu 11.04
  • Ruby on Rails 3.1.0

bundle install しようとするとこんなメッセージが出る。

$ bundle install
etching source index for http://rubygems.org/
Using rake (0.9.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.0) 
Using bcrypt-ruby (3.0.0) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.0) 
Using erubis (2.7.0) 
Using rack (1.3.2) 
Using rack-cache (1.0.3) 
Using rack-mount (0.8.3) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.0.0) 
Using actionpack (3.1.0) 
Using mime-types (1.16) 
Using polyglot (0.3.2) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.1.0) 
Using arel (2.2.1) 
Using tzinfo (0.3.29) 
Using activerecord (3.1.0) 
Using activeresource (3.1.0) 
Using ansi (1.3.0) 
Using bundler (1.0.18) 
Using coffee-script-source (1.1.2) 
Using execjs (1.2.4) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using rdoc (3.9.4) 
Using thor (0.14.6) 
Using railties (3.1.0) 
Using coffee-rails (3.1.0) 
Using jquery-rails (1.0.14) 
Installing mysql2 (0.3.7) with native extensions /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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.

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/noguchi/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
	--with-mysql-config
	--without-mysql-config
	--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-mysqlclientlib
	--without-mysqlclientlib
	--with-mlib
	--without-mlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-zlib
	--without-zlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-socketlib
	--without-socketlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-nsllib
	--without-nsllib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-mygcclib
	--without-mygcclib
	--with-mysqlclientlib
	--without-mysqlclientlib


Gem files will remain installed in /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/mysql2-0.3.7 for inspection.
Results logged to /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/mysql2-0.3.7/ext/mysql2/gem_make.out
	from /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
	from /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
	from /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
	from /home/noguchi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `block in install'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/source.rb:91:in `install'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/installer.rb:58:in `block (2 levels) in run'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/installer.rb:57:in `block in run'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/gems/bundler-1.0.18/bin/bundle:13:in `'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/bin/bundle:19:in `load'
	from /home/noguchi/.rvm/gems/ruby-1.9.2-p180@rails3.1/bin/bundle:19:in `
'

以下のようにすれば解決。
aptitude 入れてない人は apt-get でもいけると思う。

$ sudo aptitude -y install libmysqlclient-dev
$ bundle install

投稿者紹介

株式会社ユニキャスト
私たちは、テクノロジに魅せられた個性あふれるメンバーによって構成された茨城県日立市に本社を構えるベンチャー企業です。
”テクノロジを通して「驚き」と「感動」を創造し、人々の「夢」と「笑顔」を支えます。” の経営理念をモットーに明るい未来を描き、ワクワクする企画提案を続けて参ります。

人気の記事

コメント

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

PAGE TOP

%d人のブロガーが「いいね」をつけました。