1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rhel7にruby-develをインストール

Last updated at Posted at 2017-02-17

なんのためruby-develを入れたのか

  • rubyの開発環境を構築していく中でgemのインストールがうまくいかなかった。よく見るこのエラー
$ sudo gem install mysql
Fetching: mysql-2.9.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h


Gem files will remain installed in /usr/local/share/gems/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/share/gems/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
  • 調べてみるとruby-develをいれろーと。

ruby-develをインストールする方法

  • 開発環境
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

$ ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

原因はoptionalのレポジトリはenable=0(false)だった。それをenable=1(true)にしてあげたら行けた
# 該当レポジトリを検索。[]に入ってるのがrepo-id
$ grep -B1 -i optional /etc/yum.repos.d/*

# enableをONにする
$ yum-config-manager --enable <repo-id>

# 必須かはわからないがやっておく。キャッシュ
$ sudo yum makecache

# インストール
$ sudo yum install ruby-devel
...
インストール:
  ruby-devel.x86_64 0:2.0.0.648-29.el7

完了しました!

これで本題

$ gem install mysql
Building native extensions.  This could take a while...
Successfully installed mysql-2.9.1
Parsing documentation for mysql-2.9.1
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/mysql/mysql_api.so, skipping
Installing ri documentation for mysql-2.9.1
1 gem installed
$ gem list

*** LOCAL GEMS ***
...省略...
mysql (2.9.1)

バンザイ

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?