39

Homebrew でインストールしたすべてのパッケージを更新しました。MySQL は 5.6.12 にアップグレードされました (5.5.27 程度から):

$ mysql --version
mysql  Ver 14.14 Distrib 5.6.12, for osx10.8 (x86_64) using  EditLine wrapper

そして今、mysql2 gem はもうコンパイルされません:

$ gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

        /Users/pupeno/.rvm/rubies/ruby-1.9.3-p429-perf/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
    --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/pupeno/.rvm/rubies/ruby-1.9.3-p429-perf/bin/ruby
    --with-mysql-config
    --without-mysql-config

ファイルmysql.hは にあります/usr/local/Cellar/mysql/5.6.12/include/mysql.h。何が起こっているのですか?

シンボリックリンクが必要以上に深いように見えるため、ファイルmysql.hは表示されません。/usr/local

$ ls -la /usr/local/include/mysql
lrwxr-xr-x  1 pupeno  admin  36 21 Jun 15:18 /usr/local/include/mysql@ -> ../Cellar/mysql/5.6.12/include/mysql

それ以外の

/usr/local/Cellar/mysql/5.6.12/include

そうは言っても、シンボリックリンクを手動で修正しましたが、コンパイルはまだ失敗しました。だから私は立ち往生しています。

4

7 に答える 7

23

ただ ;)

gem install mysql2 -- --with-mysql-config=/usr/local/Cellar/mysql/5.6.10/bin/mysql_config
于 2013-07-05T08:56:28.200 に答える
15

これも私にとってはうまくいくようでした。gem を強制的に 5.6.10 に対してコンパイルします。

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.6.10/bin/mysql_config

関連する回答: https://stackoverflow.com/a/9360181

于 2013-06-25T19:35:58.033 に答える