From: "NARUSE, Yui" Date: 2010-02-27T13:55:10+09:00 Subject: [ruby-dev:40520] Re: [ruby-cvs:33760] Ruby:r26545 (trunk): Wed Feb 3 10:12:09 2010 Aaron Patterson アーロン宛です。 成瀬です。 (2010/02/27 12:41), U.Nakamura wrote: > In message "[ruby-dev:40511] Re: [ruby-cvs:33760] Ruby:r26545 (trunk): Wed Feb 3 10:12:09 2010 Aaron Patterson " > on Feb.27,2010 10:01:24, wrote: >> 2010/2/25 NARUSE, Yui : >>> その後 Aaron さんから特に反応がないので ext/dl 下を巻き戻しました。 >>> 再マージの際には mswin32/mswin64 でビルド出来る事が期待されます。 >> >> お手数ですが、メイルの先頭に、「アーロン宛」と記述して下さると、大変助かります。 >> 日本語で返事を書くのは私にとってかなり時間がかかるので、頻繁に返事をしない事を先にお詫びしておきます。 >> 皆さんと同じなように、私も沢山のメイルを毎日扱っていますので、今後見落としがない為にも宜しくお願いします。 RubyInstaller/sqlite3-ruby の Luis Lavena さんも興味を持っているようですから、 ruby-core に投げ直してもいいかなと思っています。 >> ところで、実際にlibffiをMSVC++でコンパイルされた方はおりますか?Luis Lavena (the One-Click >> installer maintainer) によると、libffiはMSVC++でコンパイルするそうです。 >> >>   http://twitter.com/luislavena/status/9650556934 > > 現在リリースされているバージョン(3.0.9)のlibffiはVCをまったく > サポートしていません。 > > > 以上で結論ということで話を打ち切ってもいいんですが、私もDLの > libffi化を完全に否定してるわけでもないので、もうちょっと時間 > をつぎ込んで調べてみると、gitリポジトリでは今年の1月16日頃に > VCサポートっぽい変更が加えられています。 > # ちなみに、CC(およびCPP)、LDのみcl.exeとlink.exeを使い、後は > # shとかmakeとかいった関連ツールは全てcygwinあたりで用意する > # ことが前提のようです。 > > というわけで、取ってきて試してみましたが、 > > * VC6ではサポートされていないコマンドラインオプションを使用 > しようとするのでエラーが出て一切先に進まない > > * VC8でもパス区切りとしての\の扱いに問題があるようでやっぱ > り先に進まない VC9で試しましたが、これはパス区切りを / にしないといけないらしいので、 configure 後に 生成された libtool 中の fix_srcfile_path の cygpath -w を cygpath -u に変えたら、 ここは通過しました。 > * というわけなので、x64に関しては調べる気も起きない > > という状況で、なんか条件をそろえて頑張ってビルドツール類をデ > バッグすれば先に進めるのかもしれないけれど、現時点でこれが「 > コンパイルできる」という状態であると言い切るのは無理がある、 > という感じです。 わたしは MSYS の sh.exe とかを cmd.exe から使いました。 で、結局後述のようなエラーで諦めました。 > しかし、別にlibffi自体をVCでコンパイルできる必要なんか全然な > くて、Windowsで正しく動くlibffiのバイナリがありさえすれば、あ > とはrubyの構築時に必要なファイル群(ヘッダとライブラリファイル) > さえ用意可能なら問題ないと言えないこともありません。 > libffiを動的リンクするならmingw版libffiのDLLからインポートラ > イブラリを作りさえすればいいような気もするんですが、誰かそっ > ちの方向でアプローチしてたりしませんかね? > たぶん現状のlibffiのVCサポートをhack & debugした上でlibffi側 > にアプローチするより、こっちの方が遥かに楽だろうと思います。 アプローチしました。 MSYS からやはり git HEAD をビルドしたところ、libffi.dll.a ができたので、 ffi.lib にリネームして、ffi.h と ffitarget.h と合わせて ext/dl 直下に置いてみたら、 とりあえず extconf.rb は突破できるようになりました。 後続のために以下の URL にこの 3 ファイルを ZIP したものを置いておきました。 http://nalsh.jp/patches/libffi-head-20100227.zip で、これを使うと、Makefile は作れるのですが、以下のようなエラーで止まりました。 sys/mman.h は POSIX 依存のヘッダらしいです。 なので、これを直さない限り ext/dl with libffi は MSVC++ ではビルド出来ないはずです。 おそらく、Luis ができたというのは mingw32 での話じゃないかなぁ。 compiling dl ..\..\miniruby.exe -I'../..' -I'../.././lib' -I'../../.ext/i386-mswin32_ 90' -I'../../.ext/common' -I./- -I'../.././ext' -rpurelib.rb -e "puts 'EXPORTS', 'Init_dl'" > dl-i386-mswin32_90.def cl -nologo -I. -I../../.ext/include/i386-mswin32_90 -I../.././include -I ../.././ext/dl -MD -Zi -W2 -wd4996 -O2sy- -Zm600 -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include -Focfunc.obj -c -Tccfunc.c cfunc.c cl -nologo -I. -I../../.ext/include/i386-mswin32_90 -I../.././include -I ../.././ext/dl -MD -Zi -W2 -wd4996 -O2sy- -Zm600 -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/include -Foclosure.obj -c -Tcclosure.c closure.c closure.c(7) : fatal error C1083: include ファイルを開けません。'sys/mman.h': No such file or directory NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.EXE"' : リターン コード '0x2' Stop. NMAKE : fatal error U1077: '.\miniruby.exe' : リターン コード '0x1' Stop. >> 私も自分の上司からvisual >> studioをもらえる事になったので、そうなり次第、すぐにでもテストし、その変更をコミットする予定でいますので、宜しくお願いします。 > > 老婆心ながら、別に誰かに貰わなくてもExpress Editionならフリー > で入手できますよ。 わたしも VC9 Express Edition で試しています。 以下 libffi の libtool 修正後の make 結果 C:\home\src\libffi>make make "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=-g" "CXXFLAGS=" "CFLAGS_FOR_BUILD=" "CF LAGS_FOR_TARGET=" "INSTALL=/bin/install -c" "INSTALL_DATA=/bin/install -c -m 644 " "INSTALL_PROGRAM=/bin/install -c" "INSTALL_SCRIPT=/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/bin/sh / home/naruse/src/libffi/missing --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/sh" "exec_prefix=/usr/local" "infodir=/usr/local/sh are/info" "libdir=/usr/local/lib" "prefix=/usr/local" "AR=false" "AS=as" "CC=msv cc.sh" "CXX=g++" "LD=link" "NM=dumpbin -symbols" "RANLIB=:" "DESTDIR=" all-recur sive make[1]: Entering directory `/home/naruse/src/libffi' Making all in include make[2]: Entering directory `/home/naruse/src/libffi/include' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/naruse/src/libffi/include' Making all in testsuite make[2]: Entering directory `/home/naruse/src/libffi/testsuite' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/naruse/src/libffi/testsuite' Making all in man make[2]: Entering directory `/home/naruse/src/libffi/man' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/naruse/src/libffi/man' make[2]: Entering directory `/home/naruse/src/libffi' source='src/debug.c' object='src/debug.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/debug.lo src/deb ug.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/debug.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/debug.c -DDLL_EXPORT -DPIC debug.c libtool: compile: mv -f "debug.obj" "src/.libs/debug.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/debug.c >/dev/null 2>&1 libtool: compile: mv -f "debug.obj" "src/debug.obj" source='src/prep_cif.c' object='src/prep_cif.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/prep_cif.lo src/ prep_cif.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/prep_cif.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/prep_cif.c -DDLL_EXPORT -DPIC prep_cif.c libtool: compile: mv -f "prep_cif.obj" "src/.libs/prep_cif.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/prep_cif.c >/dev/null 2>&1 libtool: compile: mv -f "prep_cif.obj" "src/prep_cif.obj" source='src/types.c' object='src/types.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/types.lo src/typ es.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/types.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/types.c -DDLL_EXPORT -DPIC types.c libtool: compile: mv -f "types.obj" "src/.libs/types.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/types.c >/dev/null 2>&1 libtool: compile: mv -f "types.obj" "src/types.obj" source='src/raw_api.c' object='src/raw_api.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/raw_api.lo src/r aw_api.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/raw_api.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/raw_api.c -DDLL_EXPORT -DPIC raw_api.c libtool: compile: mv -f "raw_api.obj" "src/.libs/raw_api.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/raw_api.c >/dev/null 2>&1 libtool: compile: mv -f "raw_api.obj" "src/raw_api.obj" source='src/java_raw_api.c' object='src/java_raw_api.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/java_raw_api.lo src/java_raw_api.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/java_raw_api.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/java_raw_api.c -DDLL_EXPORT -DPIC java_raw_api.c libtool: compile: mv -f "java_raw_api.obj" "src/.libs/java_raw_api.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/java_raw_api.c >/dev/null 2>&1 libtool: compile: mv -f "java_raw_api.obj" "src/java_raw_api.obj" source='src/closures.c' object='src/closures.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/closures.lo src/ closures.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/closures.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/closures.c -DDLL_EXPORT -DPIC closures.c libtool: compile: mv -f "closures.obj" "src/.libs/closures.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/closures.c >/dev/null 2>&1 libtool: compile: mv -f "closures.obj" "src/closures.obj" source='src/x86/ffi.c' object='src/x86/ffi.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CC --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I ./include -Iinclude -I./src -Wall -g -fexceptions -g -c -o src/x86/ffi.lo src/x 86/ffi.c libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/x86/ffi.c -DDLL_EXPORT -DPIC cl -MDd -nologo -W3 -WX -wd4127 -wd4820 -wd4706 -wd4100 -wd4255 -wd4668 -wd4053 -wd4324 -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -D_DEBUG -RT C1 -Zi -D_DEBUG -RTC1 -Zi -c src/x86/ffi.c -DDLL_EXPORT -DPIC ffi.c libtool: compile: mv -f "ffi.obj" "src/x86/.libs/ffi.obj" libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -Wall -g -fexceptions -g -c src/x86/ffi.c >/dev/null 2>&1 libtool: compile: mv -f "ffi.obj" "src/x86/ffi.obj" source='src/x86/win32.S' object='src/x86/win32.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/sh ./depcomp \ /bin/sh ./libtool --mode=compile msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -I. -I./include -Iinclude -I./src -g -c -o src/x86/win32.lo src/x86/win32.S libtool: compile: msvcc.sh -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./sr c -I. -I./include -Iinclude -I./src -g -c src/x86/win32.S -DDLL_EXPORT -DPIC cl -nologo -EP -I. -I. -I./include -Iinclude -I./src -I. -I./include -Iinclude -I./src -DHAVE_CONFIG_H -DDLL_EXPORT -DPIC src/x86/win32.S > ./win32.asm win32.S ml -nologo -safeseh -c ./win32.asm error A4910: cannot open file: c:\Program Files\Microsoft Visual Studio 9.0\VC\B IN\ml.err MASM : warning A4018: : -safeseh Assembling: ./win32.asm Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /z2 "win32.obj" "win32.exe" NUL LINK : warning LNK4044: オプション '/z2' は無効です。無視されます。 win32.obj : fatal error LNK1107: ファイルが無効であるか、または壊れています: 0x6 11 を読み取れません。 make[2]: *** [src/x86/win32.lo] Error 1 make[2]: Leaving directory `/home/naruse/src/libffi' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/naruse/src/libffi' make: *** [all] Error 2 -- NARUSE, Yui