
當我嘗試安裝 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 環境相當陌生,所以我讓自動機為我做所有事情,並且我遵循指南(在這種情況下這個)
已經透過 apt-get 和 apache 安裝的 mysql 會不會有問題?
PS 這是 raspbian/debian 發行版。
答案1
找到了解決方案
解決我的問題的是這兩個安裝之一(或兩者):
sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient-dev
可能是後一個
我在檢查之前已經安裝了兩者,所以我不能確定