2016-06-14 16 views
0

私はmariadb 10.1 serverを使っています。 私はubuntu 16.04にruby 2.3.0をインストールします。 libmariadbd-devとlibmariadbclient-devをインストールします。 私は「宝石のインストールmysql2」、そしてreciveメッセージをしようとすると:Ubuntu 16.04で "mysql2、mariadb 10.1"という宝石をインストールできませんXenial

Building native extensions with: '--with-mysql-dir=/usr/local/mysql' 
This could take a while... 
ERROR: Error installing mysql2: 
     ERROR: Failed to build gem native extension. 

    current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.4/ext/mysql2 
/usr/bin/ruby2.3 -r ./siteconf20160615-5183-kj9yds.rb extconf.rb --with-mysql-dir=/usr/local/mysql 
checking for ruby/thread.h... *** 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/bin/$(RUBY_BASE_NAME)2.3 
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
     from /usr/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for' 
     from /usr/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header' 
     from extconf.rb:16:in `<main>' 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.4 for inspection. 
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out 

そして、私はこの宝石を構築する方法を見つけるcan`t。

+1

可能な重複でそれを行う方が良いです:/ /stackoverflow.com/questions/5795309/gem-install-mysql-fail) –

+0

[gem install railsがubuntuで失敗する可能性があります](http://stackoverflow.com/questions/29317640/gem-install-rails-fails-オン - ubuntu) –

答えて

1

この場合、Gemには3つのパケットが必要です。

sudo apt-get install libnetcdf-dev libssl-dev libcrypto++-dev 
0

これはMac用ですが、パスを変更する必要があります。

gem uninstall mysql2 

はintall mariadb 10.1 andnecesaary SSLパッケージまたは多分これは、ライブラリとtinalフォルダへのパスをチェックし を必要とされていません同じ名前を持つ:

bundle config --local build.mysql2 "--with-mysql-config=/usr/local/Cellar/[email protected]/10.1.29/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include" 

またはSSLパス

012なし

または直接宝石が、あなたはMySQLをffrom来れば(HTTP [失敗宝石インストールのmysql]のバンドル

gem install mysql2 -v 'x.y.z' -- --with-mysql-config=/usr/local/Cellar/[email protected]/10.1.29/bin/mysql_config 

し、最終的に

bundle install 
関連する問題