###前提・実現したいこと
ruby on railsをmysqlで使ってみようと思い、gemにmysql2をインストールしようとしたのですが、異常終了しました。
当方rubyは初心者で、色々検索してみたのですが解決することが出来ず、質問させていただきました。
申し訳ございませんが、解決方法等分かる方がいらっしゃいましたら、お願い致します。
###発生している問題・エラーメッセージ
エラーメッセージ
[vagrant@localhost ~]$ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/vagrant/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20160411-7376-x7sxb2.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
ーーー
Using mysql_config at /usr/bin/mysql_config
ーーー
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
ーーー
Setting libpath to /usr/lib64
ーーー
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling mysql2_ext.c
compiling statement.c
statement.c: In function ‘rb_raise_mysql2_stmt_error’:
statement.c:47: 警告: ISO C90 forbids mixed declarations and code
statement.c:54: 警告: ISO C90 forbids mixed declarations and code
statement.c: In function ‘execute’:
statement.c:227: 警告: ISO C90 forbids mixed declarations and code
statement.c:329: 警告: ISO C90 forbids mixed declarations and code
compiling result.c
compiling client.c
compiling infile.c
linking shared-object mysql2/mysql2.so
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld はステータス 1 で終了しました
make: *** [mysql2.so] エラー 1
make failed, exit code 2
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mysql2-0.4.3 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/mysql2-0.4.3/gem_make.out
###試したこと
検索で見つかったmysql-develのインストールも行いましたが、解決しませんでした。
###補足情報(言語/FW/ツール等のバージョンなど)
[vagrant@localhost ~]$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[vagrant@localhost ~]$ mysql --version
mysql Ver 14.14 Distrib 5.6.20, for Linux (x86_64) using EditLine wrapper
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/18 10:17 編集