Redmine のインストール時に mysql2 gem ビルド エラーが発生する

Redmine のインストール時に mysql2 gem ビルド エラーが発生する

Redmine をインストールしようとしたときに、bundle install --without development test 次のビルド エラーが発生しました:

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...................................
Installing rake 10.3.2
...(and so on)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/home/pi/.rubies/ruby-2.1.5/bin/ruby 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()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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.

...

Gem files will remain installed in /home/pi/.gem/ruby/2.1.5/gems/mysql2-0.3.17 for inspection.
Results logged to /home/pi/.gem/ruby/2.1.5/extensions/armv6l-linux/2.1.0-static/mysql2-0.3.17/gem_make.out
An error occurred while installing mysql2 (0.3.17), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.17'` succeeds before bundling.

.gem/ruby/2.1.5/extensions/armv6l-linux/2.1.0-static/mysql2-0.3.17/mkmf.log私が上で投稿した基本出力に存在するものと類似したエラー メッセージを含む gcc コード チェック出力が満載されているものを読んでみました。

エラーメッセージからコマンドを実行しようとしましたが(gem install mysql2 -v '0.3.17')、もちろんこれも同じ結果で失敗しました。これらのエラーの原因は何でしょうか?私はLinux環境に慣れていないので、自動化にすべてを任せ、ガイドに従っています(この場合はこれ

apache と一緒に apt-get によってすでにインストールされている mysql に問題がある可能性はありますか?

PS これはraspbian/debianディストリビューションです。

答え1

解決策を見つけた

私の問題を解決したのは、次の 2 つのインストールのうちの 1 つ (または両方) です。

sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient-dev

おそらく後者だろう

確認する前に両方インストールしたので、確信はありません

関連情報