Cygwin上のperl5.8.8のperlccを使ってperlスクリプトを
exe化しようと思う。
普通に実行すると下記のようにエラーが。
$ perlcc work/make_hash_list2.pl
Note (probably harmless): No library found for -lgdbm_compat
pccf0gsH.c:10477: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10484: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10505: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10637: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10638: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10640: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10641: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10647: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10666: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c:10667: warning: this decimal constant is unsigned only in ISO C90
pccf0gsH.c: In function `perl_init_aaab':
pccf0gsH.c:25097: warning: this decimal constant is unsigned only in ISO C90
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: warning: au
to-importing has been activated without --enable-auto-import specified on the co
mmand line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.Info: resolving _PL_ppaddr by linking to __imp__PL_ppad
dr (auto-import)
Info: resolving _PL_memory_wrap by linking to __imp__PL_memory_wrap (auto-import
)
-Bオプションをつけると、コンパイルできた。
$ perlcc -B -o work/kkk.exe test.pl
⇒cygwinでは実行できるが、windowsからは実行できなかった。
この実行形式はcygwinの上に載ったものだからだ。
http://www.sixnine.net/cygwin/translation/devel/mno-cygwin-howto.html#s1-2
の情報を元に、perlccでソースファイルを作成し、gccで--mno-cygwinオプションを
つけてコンパイルすることを試したが、山ほどworningがでるのでやめた。
work/make_hash_list2.c:342: error: parse error before ')' token
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
work/make_hash_list2.c:342: warning: excess elements in scalar initializer
work/make_hash_list2.c:342: warning: (near initialization for `op_list[58]')
perlcc自体信頼性は高くない模様。Cygwin環境で実現したかったが一旦あきらめることにする。