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

kingask · July 27, 2018 · Last by sanm1992 replied at July 28, 2018 · 1874 hits

[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

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

宝贝儿你先装个 mysql 再试试

找不到 ruby 头文件。

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

You need to Sign in before reply, if you don't have an account, please Sign up first.