gem install mysql2 で下記のエラー。
[bash]
gem install mysql2 -v ‘0.3.11’
Building native extensions. This could take a while…
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/ruby193/bin/ruby extconf.rb
checking for rb_thread_blocking_region()… yes
checking for rb_wait_for_single_fd()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
—–
mysql.h is missing. please check your installation of mysql and try again.
—–
*** 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=/usr/local/ruby193/bin/ruby
–with-mysql-config
–without-mysql-config
Gem files will remain installed in /usr/local/ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/local/ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
[/bash]
どうやら、mysql.h is missing とのこと。
でも、yumでインストールしたmysqlには、どうしても mysql.h が見つからない。
どうやら、下記のライブラリも必要なようであった。
mysql55-devel
[bash]
yum –enablerepo=ius,epel install mysql55-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.oss.eznetsols.org
* epel: ftp.iij.ad.jp
* extras: ftp.oss.eznetsols.org
* ius: archive.linux.duke.edu
* updates: ftp.oss.eznetsols.org
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package mysql55-devel.x86_64 0:5.5.28-2.ius.el5 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Installing:
mysql55-devel x86_64 5.5.28-2.ius.el5 ius 190 k
Transaction Summary
=====================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 190 k
Is this ok [y/N]: y
Downloading Packages:
mysql55-devel-5.5.28-2.ius.el5.x86_64.rpm | 190 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mysql55-devel 1/1
Installed:
mysql55-devel.x86_64 0:5.5.28-2.ius.el5
Complete!
[/bash]
再び、gem install mysql2。
[bash]
gem install mysql2 -v ‘0.3.11’
Building native extensions. This could take a while…
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11…
Installing RDoc documentation for mysql2-0.3.11…
[/bash]
上手くいったようです。