LoginSignup
17
16

More than 5 years have passed since last update.

[決定版]Cygwin(64bit)でBerkshelf v3をインストールする方法

Last updated at Posted at 2014-06-08

超絶に難易度が高くて有名なCygwin環境での Berkshelfのインストールについて、ついにうまく行く方法を発見したのでまとめます。

下記手順に従えば Berkshelf ver 3インストールすることができます。
(2014/6/8現在、v3.1.3が入ります)

環境

Cygwin 64bit
(Windows7でやりましたがWindows8でもたぶんいけると思います)

必要となる前提

  • rbenv , ruby 2.1系
  • apt-cyg

をインストールしておいてください。

http://dqn.sakusakutto.jp/2013/12/cygwin_rbenv_ruby-build_ruby.html
http://dqn.sakusakutto.jp/2013/12/64bit_cygwin_apt-cyg.html

Berkshelfのインストールはなぜ難しいのか?

依存しているgemモジュールの中で、インストールが難しいものがあるからです。
* ffi
* dep-selector-libgecode

逆に言うとこの2つさえインストールできればよいわけです。

berkshelf をインストールする方法

さてインストールしてみましょう!

ffi をインストールする

https://github.com/ffi/ffi/issues/284#issuecomment-33752957
上記のRSmirnovさんのコメント通りにやればいけます。

apt-cyg install libffi6 libffi-devel pkg-config
export PKG_CONFIG_PATH="/lib/pkgconfig"
gem install ffi

dep-selector-libgecode をインストールする

http://qiita.com/yositani2002/items/6e9b765452676a40a2ef
上記の記事どおりにやればいけます。
簡単にまとめると下記のようになります。


# gcc48.exe, g++48.exeという名前のシムリンクを作成
ln -s gcc.exe /usr/bin/gcc48.exe
ln -s g++.exe /usr/bin/g++48.exe

# gecode 3.7.3 を取得して解凍
wget "http://pkgs.fedoraproject.org/repo/pkgs/gecode/gecode-3.7.3.tar.gz/7a5cb9945e0bb48f222992f2106130ac/gecode-3.7.3.tar.gz"
tar xvfz gecode-3.7.3.tar.gz
cd gecode-3.7.3

# コンパイル
./configure CC="gcc48"  --disable-doc-dot --disable-doc-search --disable-doc-tagfile --disable-doc-chm --disable-doc-docset --disable-qt --disable-examples --disable-flatzinc
make
make install
# ライブラリを手動で配置
cp libgecode* /lib/
cp -r gecode/* /usr/include/

berkshelfをインストール

USE_SYSTEM_GECODE=1 gem install berkshelf

インストールできたか確認

$ berks --version
DL is deprecated, please use Fiddle
3.1.3

うまく行きましたか?

先人の偉業に深く感謝です。

17
16
4

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
17
16