Post date: 2014/07/09 14:54:49
gitlab-gritがgem install charlock_holmes -v=0.6.9.4を必要とするがうまくいかず、結局あきらめた。
Installing Ruby 1.9.3 in Windows with Redcarpet and Github Markdown - A software Author's Website の通りにやればできるのかも知れない。
1.charlock_holmesには、icuが必要なのでhttp://site.icu-project.org/download から最新版のICU4Cをダウンロードし、MinGWにインストールした。
icu/sourceでできあがったdist以下のlib, includeなどを以下のembedded rubyのmingwにコピー
c:/opscode/chef/embedded/mingw
注意:icuin.dll.a を icui18n.a に名前を変える
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/の下にmkmf.logとgem_make.outが
できるが、gem_make.outで、
checking for main() in -licui18n... yes
と出れば、icuはOKだと思われる。
注意: msysにはautomakeをインストールしておく必要がある(確か)
2.ここからが荊の道。
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/extconf.rb を使って、
ruby extconf.rb
を実行する
なぜだかわからないが、gem installの中でrubyを実行する場合はうまくいくのに、rubyを直接たたくと、`which make`がエラーとなる。
仕方ないので添付のextconf.rbのように false && `which make`のようにしてruby extconf.rbを追及する。
extconf.rbの中では、./src/file-5.08.tar.gzを展開し、できたfile-5.08の中で、./configure --disable-shared --enable-static --with-picを実行する。
ここが問題。このconfigureにライブラリパスを渡す方法がわからない。extconf.rbは、gemコマンドでディレクトリごとたんびに生成されるよう
なので、extconf.rbをいじることは容易にできない。(charlock_holmes-0.6.9.4.gemを作り直せばよいのかも知れないがやり方がわからない。)
3.このconfigureで、libgnurxが使われるので、libgnurxをインストールする
Installing Ruby 1.9.3 in Windows with Redcarpet and Github Markdown - A software Author's Website にしたがってlibgnurxにパッチをかける。
regex.hは、c:/Users/seijirom/gcc/x86_64-w64-mingw32/include/にコピー
libregex.a, libgnurx.dll.a, libgnurx.a は、c:/Users/seijirom/gcc/libにコピーした
注意:ldのライブラリパスの見つけ方
gcc -print-search-dirs を実行し、librariesの中から、POSIXではない、Windows形式のディレクトリを見つける。そのうちのどれかにライブラリをコピーする。
configureはいろいろテストして時間がかかるので、途中のテストを削除した添付のcnfgを使った
4.ruby extconf.rbでconfigureは実行できたので、その後の、make -C src installとmake -C magic installをマニュアルで実行してみる
libgnurxをインストールした後gem install charlock_holmesを実行しても以下のエラーで止まる
c:/opscode/chef/embedded/bin/ruby.exe extconf.rb
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
-- tar zxvf file-5.08.tar.gz
-- ./configure --prefix=c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
。。。snip
extconf.rb:7:in `sys': ./configure --prefix=c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
from extconf.rb:60:in `block (2 levels) in <main>'
from extconf.rb:59:in `chdir'
from extconf.rb:59:in `block in <main>'
from extconf.rb:55:in `chdir'
from extconf.rb:55:in `<main>'
make -C src installは正常終了するが、make -C magic installが以下のエラーで止まる。
make -C magic inst
make: Entering directory `/c/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic'
../src/file -C -m magic
make: *** [magic.mgc] Error 53
make: Leaving directory `/c/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic'
make -d -C src installすると、以下のようなエラーであった:
Finished prerequisites of target file `magic.mgc'.
Must remake target `magic.mgc'.
make: Entering directory `/c/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic'
Putting child 0x0a046088 (magic.mgc) PID 28868 on the chain.
Live child 0x0a046088 (magic.mgc) PID 28868
Reaping winning child 0x0a046088 PID 28868
Live child 0x0a046088 (magic.mgc) PID 29420
Reaping winning child 0x0a046088 PID 29420
Live child 0x0a046088 (magic.mgc) PID 29268
Reaping winning child 0x0a046088 PID 29268
../src/file -C -m magic
Live child 0x0a046088 (magic.mgc) PID 29624
Reaping losing child 0x0a046088 PID 29624
make: *** [magic.mgc] Error 53
Removing child 0x0a046088 PID 29624 from chain.
make: Leaving directory `/c/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic'
ここでgive up
メモ:
1.MinGWのgccは64bitを生成できないだけでなく、C言語のc99規格にしたがってないなど問題があるので、32bitを生成する場合でも、MinGW-w64のgccを使うのが一般的なようだ。Windows に MinGW-w64 と MSYS を導入する | 永田 晴久
2.gitlab_gitでは、gritからlibgit2/ruggedに移行しようとしているらしいが、完全移行がいつかはわからない。gitlabはwindowsをサポートしてないようなので、libgit2/ruggedは自力で頑張るしかないかも、と思って少し調べた。
gem install ruggedで、以下のエラーとなった(gem_make.out)
c:/opscode/chef/embedded/bin/ruby.exe extconf.rb
checking for cmake... yes
checking for gmake... no
checking for make... yes
checking for pkg-config... no
ERROR: pkg-config is required to build Rugged.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/opscode/chef/embedded/bin/ruby
cmakeは、windows版を入れたが、pkg-configがわからない。