私はmysql2をインストールしようとしています:
sudo gem install mysql2 -v '0.2.7' -- --with-mysql-config=/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
次のエラーが表示されます。
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb -- with-mysql-config=/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
checking for rb_thread_blocking_region()... no
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.
私のmysqlのインストールはbrewを介しているため、mysql.hファイルは次の場所にあります。
/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
これが with-mysql-config フラグがある理由です
mysql_config ファイルは、次の mysql.h ファイルを探しています。
$basedir/include/mysql/mysql.h
gemfileをから更新したことを追加する必要があります
宝石 'mysql2
gem 'mysql2', '0.2.7' へ
なぜなら、mysql2 0.3.* にはアクティブなレコードのサポートがないという事実について、非推奨の警告が表示されていたからです。したがって、Rails を 3.1 にアップグレードするか、mysql2 をダウングレードする必要があります。私は後者を選びました。
mysql_config を編集する必要がありますか、またはこれを修正するために他にできることはありますか? 助けてくれてありがとう。