2017-01-07 18 views
11

mysql gemのインストールに問題があります。これは私のエラーです:私は、このコマンドsudo gem install mysql -v '2.9.1'をしようとすると、それは作品だ、と私はそれを正当化するために、この行を読んで...Ruby 2.4のMySQL Gemインストールエラー

sudo gem install mysql -v '2.9.1' 
Building native extensions. This could take a while... 
Successfully installed mysql-2.9.1 
Parsing documentation for mysql-2.9.1 
Done installing documentation for mysql after 0 seconds 
1 gem installed 

私は

gem install mysql -v '2.9.1' 
Building native extensions. This could take a while... 
ERROR: Error installing mysql: 
    ERROR: Failed to build gem native extension. 

    current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api 
/usr/local/rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170107-4120-x2dv85.rb extconf.rb 
checking for mysql_ssl_set()... yes 
checking for rb_str_set_len()... yes 
checking for rb_thread_start_timer()... no 
checking for mysql.h... yes 
creating Makefile 

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

    /usr/local/rvm/gems/ruby-2.4.0/extensions/x86_64-linux/2.4.0/mysql-2.9.1/mkmf.log 

current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api 
make "DESTDIR=" clean 

current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api 
make "DESTDIR=" 
compiling mysql.c 
mysql.c: In function ‘stmt_bind_result’: 
mysql.c:1320:74: error: ‘rb_cFixnum’ undeclared (first use in this function) 
    else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum) 
                     ^
mysql.c:1320:74: note: each undeclared identifier is reported only once for each function it appears in 
mysql.c: At top level: 
cc1: warning: unrecognized command line option "-Wno-self-assign" 
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" 
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" 
cc1: warning: unrecognized command line option "-Wno-tautological-compare" 
Makefile:241: recipe for target 'mysql.o' failed 
make: *** [mysql.o] Error 1 

make failed, exit code 2 

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1 for inspection. 
Results logged to /usr/local/rvm/gems/ruby-2.4.0/extensions/x86_64-linux/2.4.0/mysql-2.9.1/gem_make.out 

何が起こったのかを理解し、どのようにしていませんこれを解決しました。誰かが私を助けることができたら...

答えて

13

mysql宝石はRuby 2.4のunification of the integer typesが好きではない多くの宝石の一つです。

残念ながら、mysqlの宝石は実際にはもう管理されていないので、私は更新版のために息を止めません。回避策として、2.4より前のRubyバージョンに切り替えることができます。 Ruby 2.3.3。

また、アクティブに維持されているmysql2 gemに切り替えることができます。mysql宝石と似たAPIを持ち、最新のバージョンではRuby 2.4と互換性があります。

+0

答えていただきありがとうございます。確かに、Rubyのバージョンが問題でした。 mysql2 gemに変更することを確認します。 – Christophe