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

もう一押し、ktouさんと協力してpthreadへの依存をなくす

用意するもの


gitからチェックアウト

# 読み書き可能(要管理権限)
$ git clone  git@github.com:ongaeshi/rroonga.git
# 読み込み専用
$ git clone git://github.com/ongaeshi/rroonga.git
 

extconf.rb(失敗する)

$ 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 が出来ているはずなので、そっちから先に片付ける。
※ この時は例外的に、ktouさんからパッチを当てた最新版のgroonga-1.1.0を頂く

groongaのコンパイル


new!! configureの設定
$ 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
#ifdef __MINGW32__
// struct timezone {
//   int tz_minuteswest;
//   int tz_dsttime;
// };
 

src/Makefile 125行目
# @todo
# LDFLAGS = 
LDFLAGS = -L/usr/i686-w64-mingw32/sys-root/mingw/lib -L/usr/lib
 

make
$ make
.
.
.
 

make install
$ 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 を作る


$ cd ~/work/rroonga
 

rake native gem
$ 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
C: → /c
c: → /c
 
に変換(どちらも小文字の''c''にする必要があることに注意)
 

もう一箇所修正
tmp/i386-mingw32/groonga/1.8.7/Makefile
# 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
$ 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 が出来ていれば成功
$ 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ファイルを直接指定
$ 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
.
.
 

動作確認

$ 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.
 

もうpthreadGC2.dllは要らない!!万歳!!





















タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2011年02月18日 02:22
ツールボックス

下から選んでください:

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