新手问题 gem install mysql2 安装不上 环境在 fedora 和 centos 都试过

kingask · 2018年07月27日 · 最后由 sanm1992 回复于 2018年07月28日 · 1218 次阅读

[root@localhost ~]# gem install mysql2

Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

current directory: /usr/local/share/gems/gems/mysql2-0.5.2/ext/mysql2 /usr/bin/ruby -r ./siteconf20180727-4443-m9s83b.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/mysql2-0.5.2 for inspection. Results logged to /usr/local/lib64/gems/ruby/mysql2-0.5.2/gem_make.out [root@localhost ~]# gem install mysql2 -v 0.5.1 Fetching: mysql2-0.5.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

current directory: /usr/local/share/gems/gems/mysql2-0.5.1/ext/mysql2 /usr/bin/ruby -r ./siteconf20180727-4452-1pfveel.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/mysql2-0.5.1 for inspection. Results logged to /usr/local/lib64/gems/ruby/mysql2-0.5.1/gem_make.out

共收到 4 条回复

缺少 mysql 的 lib 库? 试试 sudo yum install mysql-devel

宝贝儿你先装个 mysql 再试试

找不到 ruby 头文件。

安装完 mysql 就可以了,我貌似和我最近重装虚拟机后遇到的问题一样

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册