rroonga > Windows用gemの作り方メモ > 1.1.0 ver2

「rroonga/Windows用gemの作り方メモ/1.1.0 ver2」の編集履歴(バックアップ)一覧はこちら

rroonga/Windows用gemの作り方メモ/1.1.0 ver2」(2011/02/16 (水) 00:56:17) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

[[ktou>http://twitter.com/#!/ktou]]さんに教えてもらった新設定 * 用意するもの - ruby - [[RubyInstaller for Windows>http://rubyinstaller.org/]] (mingw32) -- インストール先は、c:/app/ruby187-mingw32 を想定 - cygwin - 1.7.7-1 * gitからチェックアウト #highlight(bash){ # 読み書き可能(要管理権限) $ git clone git@github.com:ongaeshi/rroonga.git # 読み込み専用 $ git clone git://github.com/ongaeshi/rroonga.git } * extconf.rb(失敗する) #highlight(bash){ $ ruby extconf.rb checking for groonga version (>= 1.1.0)... no downloading http://groonga.org/files/groonga/groonga-1.1.0.tar.gz... done extracting... done configuring... failed *** 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. } vendor/groonga-1.1.0 が出来ているはずなので、そっちから先に片付ける。 * groongaのコンパイル &bold(){&color(red){new!!}} configureの設定 #highlight(bash){ $ cd vendor/groonga-1.1.0 $ ./configure --host=i686-w64-mingw32 --prefix='/c/users/ongaeshi/work/rroonga/vendor/local' } rubyのヘッダを一部修正する c:/app/ruby187-mingw32/lib/ruby/1.8/i386-mingw32/win32/win32.h #highlight(c){ #ifdef __MINGW32__ // struct timezone { // int tz_minuteswest; // int tz_dsttime; // }; } src/Makefile 125行目 #highlight(make){ # @todo # LDFLAGS = LDFLAGS = -L/usr/i686-w64-mingw32/sys-root/mingw/lib -L/usr/lib } &bold(){&color(red){new!!}} lib/Makefile修正 #highlight(makefile){ -LIBS = -lm -ladvapi32 -lws2_32 +LIBS = -lm -ladvapi32 -lws2_32 -lpthread } make #highlight(bash){ $ make . . . } make install #highlight(bash){ $ make install Making install in include make[1]: Entering directory `/c/users/ongaeshi/work/rroonga_new/vendor/groonga-1.1.0/include' Making install in groonga make[2]: Entering directory `/c/users/ongaeshi/work/rroonga_new/vendor/groonga-1.1.0/include/groonga' . . } これで、''vendor/local'' 以下に ''bin/libgroonga-0.dll'' 等が作られたら成功。 rroongaのコンパイルに戻る。 * rroonga-1.1.0-x86-mingw32.gem を作る #highlight(bash){ $ cd ~/work/rroonga } rake native gem #highlight(bash){ $ rake native gem rake-compiler must be configured first to enable cross-compilation cd tmp/i386-mingw32/groonga/1.8.7 (in c:/users/ongaeshi/work/rroonga_new) make Makefile:121: *** target pattern contains no `%'. Stop. } エラーが起きるのでmakefileを修正する tmp/i386-mingw32/groonga/1.8.7/Makefile #highlight(bash){ C: → /c c: → /c に変換(どちらも小文字の''c''にする必要があることに注意) } もう一箇所修正 tmp/i386-mingw32/groonga/1.8.7/Makefile #highlight(bash){ # 42行目 gcc → i686-w64-mingw32-gcc # CC = gcc CC = i686-w64-mingw32-gcc . . # 51行目 : -mo-cygwin追加 # CFLAGS = -mno-cygwin -g -O2 -DFD_SETSIZE=256 $(cflags) -I../../../../vendor/local/include/groonga CFLAGS = -g -O2 -DFD_SETSIZE=256 $(cflags) -I../../../../vendor/local/include/groonga . . # 62行目 : gcc → i686-w64-mingw32-gcc # LDSHARED = gcc -shared -s LDSHARED = i686-w64-mingw32-gcc -shared -s } rake native gem #highlight(bash){ $ rake native gem cp tmp/i386-mingw32/groonga/1.8.7/groonga.so lib/groonga.so mkdir -p pkg rm -f pkg/rroonga-1.1.0/AUTHORS ln AUTHORS pkg/rroonga-1.1.0/AUTHORS rm -f pkg/rroonga-1.1.0/NEWS.ja.rdoc ln NEWS.ja.rdoc pkg/rroonga-1.1.0/NEWS.ja.rdoc rm -f pkg/rroonga-1.1.0/NEWS.rdoc ln NEWS.rdoc pkg/rroonga-1.1.0/NEWS.rdoc rm -f pkg/rroonga-1.1.0/README.ja.rdoc ln README.ja.rdoc pkg/rroonga-1.1.0/README.ja.rdoc . . } pkg/rroonga-1.1.0-x86-mingw32.gem が出来ていれば成功 #highlight(bash){ $ cd pkg $ ls -la total 6532 drwx------+ 1 ongaeshi 0 Dec 30 17:41 . drwx------+ 1 ongaeshi 0 Dec 30 17:41 .. drwx------+ 1 ongaeshi 0 Dec 30 17:40 rroonga-1.1.0 -rwx------+ 1 ongaeshi 3370496 Dec 30 17:41 rroonga-1.1.0-x86-mingw32.gem -rwx------+ 1 ongaeshi 3316736 Dec 30 17:41 rroonga-1.1.0.gem } * インストール .gemファイルを直接指定 #highlight(bash){ $ gem install rroonga-1.1.0-x86-mingw32.gem Enclosing class/module 'mGrn' for class Accessor not known Enclosing class/module 'mGrn' for class ArrayCursor not known Enclosing class/module 'mGrn' for class Array not known Enclosing class/module 'mGrn' for class Column not known . . } * 動作確認 テスト、モジュールが無いと怒られる。 #highlight(bash){ $ gem install gren # rroongaを使っているアプリ PostInstall.txt Successfully installed gren-0.3.1 1 gem installed Installing ri documentation for gren-0.3.1... Installing RDoc documentation for gren-0.3.1... $ mkgrendb.bat c:/app/ruby187-mingw32/lib/ruby/gems/1.8/gems/rroonga-1.1.0-x86-mingw32/lib/groonga.so: 126: 指定されたモジュールが見つかりません。 - c:/app/ruby187-mingw32/lib/ruby/gems/1.8/gems/rroonga-1.1.0-x86-mingw32/lib/groonga.so (LoadError) from c:/app/ruby187-mingw32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from c:/app/ruby187-mingw32/lib/ruby/gems/1.8/gems/rroonga-1.1.0-x86-mingw32/lib/groonga.rb:44 . . } あと一息、コマンドプロンプトで実行すると、pthreadGC2.dllが無いと怒られる。 問題はpthreadGC2.dllがgroonga.soから見つけられないことなので、pthreadGC2.dllをパスの通った場所へ置けば良い。 &bold(){cygwin持ってる人} #highlight(bash){ $ cp -v /c/cygwin/usr/i686-w64-mingw32/sys-root/mingw/bin/pthreadGC2.dll /c/WINDOWS/system32/ } &bold(){cygwin持ってない人} 手っ取り早くやるには、MinGW32からコンパイル済みのpthreadGC2.dllを持ってくれば動くと思う(多分) #highlight(bash){ $ wget http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/pthreads/pthreads-20100604.zip/download . . $ unzip pthreads-20100604.zip . . $ cd pthreads-20100604/mingw32/ $ unzip pthreads-w32.zip . . $ cp -v bin/pthreadGC2-w32.dll /c/WINDOWS/system32/pthreadGC2.dll `bin/pthreadGC2-w32.dll' -> `/c/WINDOWS/system32/pthreadGC2.dll' } もう一回テスト #highlight(bash){ $ mkgrendb.bat mkgrendb INPUT_YAML1 [INPUT_YAML2 ...] --ddb, --default-db Create or Update default DB. (Plase set ENV['GRENDB_DEFAULT_DB']) --full Full update DB. (Delete and create) --delete Delete DB. (Not delete yaml) --dump Dump DB. --report Database Report. } 動いたよー。 ----

表示オプション

横に並べて表示:
変化行の前後のみ表示:
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。