3

OSUbuntu12.04。https://github.com/rails/rails.gitからrails4.0.0beta1のクローンを作成しました。私はruby2.0.0p0(2013-02-24リビジョン39474)を使用していますが、「バンドルインストール」を実行しようとすると、次のエラーメッセージが表示されます。

Installing mysql (2.9.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/zergood/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb 
checking for mysql_query()... -lmysqlclient
checking for main() in -lm... yes
checking for mysql_query()... -lmysqlclient
checking for main() in -lz... yes
checking for mysql_query()... -lmysqlclient
checking for main() in -lsocket... no
checking for mysql_query()... -lmysqlclient
checking for main() in -lnsl... yes
checking for mysql_query()... -lmysqlclient
checking for main() in -lmygcc... no
checking for mysql_query()... -lmysqlclient
*** 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/zergood/.rvm/rubies/ruby-2.0.0-p0/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}/
    --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/zergood/.rvm/gems/ruby-2.0.0-p0/gems/mysql-2.9.1 for inspection.
Results logged to /home/zergood/.rvm/gems/ruby-2.0.0-p0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

An error occurred while installing mysql (2.9.1), and Bundler cannot continue.
Make sure that `gem install mysql -v '2.9.1'` succeeds before bundling.

どうすれば解決できますか?

4

3 に答える 3

11

だから、次のようなものを試してください

sudo apt-get install libmysql-ruby libmysqlclient-dev mysql-server \
mysql-client mysql-common

その後

gem install mysql
于 2013-03-13T22:05:57.043 に答える
4

私は非常によく似た問題を抱えていました-Ruby 2.0でMysql 2.9.1エラーをインストールしますが、Mac 10.9.2では

ここで解決策が見つかりました: https://stackoverflow.com/a/4115182/775359

brew install mysql

mysql2 を正しくコンパイルするには、MySQL 開発ヘッダーが必要です。これが必要なのは、機能の多くが C で記述され、その後 MySQL にリンクされているためです。

于 2014-05-03T15:13:45.207 に答える
1

ちょっとした修正:libmysql-ruby は段階的に廃止されるため、ruby-mysql代わりに使用してください --> https://askubuntu.com/questions/641943/e-unable-to-locate-package-libmysql-ruby

したがって、完全なコマンドは次のとおりです。

sudo apt-get install ruby-mysql libmysqlclient-dev mysql-server \ mysql-client mysql-common

その後

gem install mysql

于 2015-09-11T14:59:25.263 に答える