[英]Error installing mysql2 gem on Ubuntu 16.04LTS
I tried sudo gem install mysql2 -v '0.4.4' and got error. 我尝试了sudo gem install mysql2 -v'0.4.4'并收到错误。 Checking /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log:
检查/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log:
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
So it seems to me ruby.h was the problem. 在我看来,ruby.h就是问题所在。 But I can find it in:
但我可以在以下位置找到它:
/usr/include/ruby-2.3.0/ruby/ruby.h
/usr/include/ruby-2.3.0/ruby.h
I checked Error while installing json gem 'mkmf.rb can't find header files for ruby' but in fact I have installed ruby development. 我在安装json gem时检查了错误'mkmf.rb找不到ruby的头文件',但实际上我已经安装了ruby开发。
sudo dpkg -l | sudo dpkg -l | grep ruby also shows I have:
grep ruby还显示我有:
sudo dpkg -l | grep ruby
ii libruby2.3:amd64 2.3.1-2~16.04 amd64 Libraries necessary to run Ruby 2.3
ii rake 10.5.0-2 all ruby make-like utility
ii ruby 1:2.3.0+1 all Interpreter of object-oriented scripting language Ruby (default version)
ii ruby-bundler 1.11.2-1 all Manage Ruby application dependencies (runtime)
ii ruby-dev:amd64 1:2.3.0+1 amd64 Header files for compiling extension modules for Ruby (default version)
ii ruby-did-you-mean 1.0.0-2 all smart error messages for Ruby > 2.3
ii ruby-eventmachine 1.0.7-3build3 amd64 Ruby/EventMachine library
ii ruby-minitest 5.8.4-2 all Ruby test tools supporting TDD, BDD, mocking, and benchmarking
ii ruby-molinillo 0.4.3-1 all generic dependency resolution algorithm
ii ruby-mysql 2.9.1-1ubuntu1 amd64 MySQL module for Ruby
ii ruby-mysql2 0.4.3-2ubuntu2 amd64 simple, fast MySQL library for Ruby
ii ruby-net-http-persistent 2.9.4-1 all Manages persistent connections using Net::HTTP
ii ruby-net-telnet 0.1.1-2 all telnet client library
ii ruby-power-assert 0.2.7-1 all library showing values of variables and method calls in an expression
ii ruby-test-unit 3.1.7-2 all unit testing framework for Ruby
ii ruby-thor 0.19.1-2 all Ruby scripting framework
ii ruby2.3 2.3.1-2~16.04 amd64 Interpreter of object-oriented scripting language Ruby
ii ruby2.3-dev:amd64 2.3.1-2~16.04 amd64 Header files for compiling extension modules for the Ruby 2.3
ii rubygems-integration 1.10 all integration of Debian Ruby packages with Rubygems
So how can I fix this? 那么我该如何解决呢?
Try install gcc and make. 尝试安装gcc并制作。 This work for me.
这项工作对我来说。
apt-get install gcc make
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.