LoginSignup
9
9

More than 5 years have passed since last update.

mingw な ruby2.0 を cygwin 上でビルドする

Posted at

事前準備

作業内容

# 必要パッケージのインストール
apt-cyg install gcc-mingw gcc-mingw-g++ make

# 作業用ディレクトリを作成
mkdir ~/ruby-build
cd ~/ruby-build

# ソースを取得
# URL は好きなバージョンのソースで置き換える
# http://www.ruby-lang.org/ja/downloads/
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.bz2
tar vjxf ruby-2.0.0-p247.tar.bz2
cd ruby-2.0.0-p247

# configure
# ruby における target と host の違いがよくわかっていない。
# prefix に cygwin 形式のパスを指定してしまったけど、ここは Windows 形式のパスを
# 指定しなければならないようだ。 make install で C 直下に usr ができてしまった。
# 実行時にもライブラリのロード先などで影響がありそうなものだが、target が mingw のときは
# ライブラリが実行ファイルからの相対パスで読み込まれるらしく、C 直下から移動しても
# 問題なく動いているように見える。
./configure --target=i686-pc-mingw32 --host=i686-pc-mingw32 --enable-shared --prefix=/usr/local/i686-pc-mingw CC=i686-pc-mingw32-gcc.exe CXX=i686-pc-mingw32-g++.exe

# Windows 8 64bit + Cygwin 1.7 のバグ回避
export LANG=C 

# make
make
make install
9
9
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
9
9