OS X Lion で XAMPP インストールの MySQL をレールの mysql2 gem と連携させる方法を見つけようとして困っています。
これが私が試したことです:
- XAMPP 開発キットをインストールしました
- ポートと醸造の両方でmysql5-serverをインストールしました。どちらも今アンインストールしました。問題が解決しなかったためです。
- DMG ファイルから mysql5 コミュニティ エディションをインストールしました。問題が解決しないため、アンインストールしました。
- mysql5 コミュニティ エディションの 32 ビット バージョンを tar としてダウンロードしました。フォルダを「/var/mysql」に展開
インストールを試みるために実行しているコマンドは次のとおりです。
gem install mysql2 -- --with-mysql-dir=/var/mysql --with-mysql-include=
/var/mysql/include --with-mysql-lib=/var/mysql/lib --with-mysql-config=
/Applications/XAMPP/xamppfiles/bin/mysql_config
これを機能させる方法がわかりません。私が考えることができる唯一のことは、どういうわけかディレクトリを正しく指していないということです。/include/、/mysql/、および /lib/ を with-mysql-include、with-mysql-dir、および with-mysql-lib 構成オプションから削除しようとしました。それは運が悪い。それらをXAMPPインストールに向けてみました。まだ運がありません。
返されるエラーは次のとおりです。
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-mysql-dir=/var/mysql --with-mysql-include=/var/mysql/include --with-mysql-lib=/var/mysql --with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config
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
--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=/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out