当我尝试安装 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
可能是后一个
我在检查之前已经安装了两者,所以我不能确定