2010-07-17

windres: can't open icon file `icons\emacs.ico'

MinGW / MSYS の環境を作り直して、久しぶりに Emacs の emacs-23 ブランチをビルドしてみたら、make all や make bootstrap で emacs.exe を作るときに windres がコケるようになってた。

$ make bootstrap (的なコマンドライン)
(略)
windres -O coff --include-dir ../nt -o oo-spd/i386/emacs.res ../nt/emacs.rc
rm oo-spd/i386/temacs0.a
rm: cannot lstat `oo-spd/i386/temacs0.a': No such file or directory
make[2]: [oo-spd/i386/temacs0.a] Error 1 (ignored)
ar -rsc oo-spd/i386/temacs0.a oo-spd/i386/emacs.o
windres: can't open icon file `icons\emacs.ico': No such file or directory
make[2]: *** [oo-spd/i386/emacs.res] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/c/Users/yu-ji/home/src/wc/emacs/emacs-23/src'
make[1]: *** [bootstrap-temacs] Error 2
make[1]: Leaving directory `/c/Users/yu-ji/home/src/wc/emacs/emacs-23/src'
make: *** [bootstrap-gmake] Error 2

(並列に走ってる部分なので余計なメッセージも混ざってますが…)

使ったのは binutils-2.20.51-1-mingw32-bin.tar.lzma で、以前の環境で正常だったはずの binutils-2.20-1-mingw32-bin.tar.gz の windres に戻しても同様にコケる。

=== modified file 'nt/emacs.rc'
--- nt/emacs.rc 2010-05-08 04:46:44 +0000
+++ nt/emacs.rc 2010-07-17 07:33:02 +0000
@@ -1,5 +1,5 @@
-Emacs ICON   icons\emacs.ico
-32649 CURSOR icons\hand.cur
+Emacs ICON   icons/emacs.ico
+32649 CURSOR icons/hand.cur
 1 24 "emacs.manifest"

 #ifndef VS_VERSION_INFO

emacsclient.rc のほうは直さなくてもいいみたい。なんでしょうね…。MinGW / MSYS の環境作りでなにか忘れてるのかなぁ。

2010-06-25

ActiveState Perl Dev Kit 9.0 / ActivePerl 5.12.1

Perl Dev Kit(PDK) 9.0 が先週出たので PDK 8 からアップグレードしました。PDK は 9.0 から Perl 5.12 に対応したので、併わせて ActivePerl も 5.10.1 から 5.12.1 へアップデート。

ようやく Perl 5.12 を本格的に使えそうです。まずはアップデートされた各モジュールのキャッチアップから…これがいちばん大変そう。PPM で提供されるモジュールも変わっているので、自分のモジュールもいまだインストールできない状態です(´д`)

2010-06-02

MinGW gcc 4.5.0 の -march=native を Core i7 860 で

以前 "MSYS gcc 4.5.0" と書いていましたが "MinGW gcc 4.5.0" の間違いです。

MinGW gcc 4.5.0 の -march=native オプションを Core i7 860 で使うと適用されるオプションがおかしい。

のシェルスクリプトを拝借して…、
(一部手動改行)

## 参考に Cygwin で。
$ cat /proc/cpuinfo | grep '^model ' | sort | uniq
model name      : Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz

$ uname -a
CYGWIN_NT-6.1-WOW64 devildoll 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin

$ gcc --version
gcc (GCC) 4.3.4 20090804 (release) 1
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ~/work/gcc_native.sh
-march=core2 -mcx16 -msahf --param l1-cache-size=32
--param l1-cache-line-size=64 -mtune=core2


## MinGW / MSYS で。
$ uname -a
MINGW32_NT-6.1 DEVILDOLL 1.0.14(0.47/3/2) 2010-03-17 23:02 i686 Msys

$ gcc --version
gcc.exe (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ./work/gcc_native.sh
-march=atom -mcx16 -msahf -mpopcnt -msse4.2 --param l1-cache-size=32
--param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=core2

(ノ∀`) アチャー atom て

2010-05-14

zlib

こないだ zlib はオフィシャルから配布されてた DLL を使いましたが、新バージョン公開後すぐにバイナリーが上がるわけではないみたい。なので自分で make してみた。

win32/DLL_FAQ.txt によればオフィシャルの DLL を使うよう推奨しているのにね…。

## Cygwin で
$ cd ~/src
$ wget http://zlib.net/zlib-1.2.5.tar.bz2
$ tar xjf zlib-1.2.5.tar.bz2

## MinGW で
$ cd zlib-1.2.5
$ cp contrib/asm686/match.S ./match.S
$ make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o adler32.o adler32.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o compress.o compress.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o crc32.o crc32.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o deflate.o deflate.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o gzclose.o gzclose.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o gzlib.o gzlib.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o gzread.o gzread.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o gzwrite.o gzwrite.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o infback.o infback.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o inffast.o inffast.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o inflate.o inflate.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o inftrees.o inftrees.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o trees.o trees.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o uncompr.o uncompr.c
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o zutil.o zutil.c
gcc -DASMV -Wall -c -o match.o match.S
ar rcs libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o match.o
windres --define GCC_WINDRES -o zlibrc.o win32/zlib1.rc
gcc -shared -Wl,--out-implib,libzdll.a -DASMV \
        -o zlib1.dll win32/zlib.def adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o match.o zlibrc.o
Creating library file: libzdll.a
strip zlib1.dll
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o example.o example.c
gcc -DASMV -o example.exe example.o libz.a
strip example.exe
gcc -DASMV -O3 -Wall -DNO_VIZ -c -o minigzip.o minigzip.c
gcc -DASMV -o minigzip.exe minigzip.o libz.a
strip minigzip.exe
gcc -DASMV -o example_d.exe example.o libzdll.a
strip example_d.exe
gcc -DASMV -o minigzip_d.exe minigzip.o libzdll.a
strip minigzip_d.exe

$ make test testdll -fwin32/Makefile.gcc
./example
zlib version 1.2.5 = 0x1250, compile flags = 0x255
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
echo hello world | ./minigzip | ./minigzip -d
hello world
./example_d
zlib version 1.2.5 = 0x1250, compile flags = 0x255
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
echo hello world | ./minigzip_d | ./minigzip_d -d
hello world

## Cygwin で
$ tar cvzf zlib-1.2.5-win32-x86-unofficial-uch.tar.gz \
> ./zlib-1.2.5/*.{exe,dll}
./zlib-1.2.5/example.exe
./zlib-1.2.5/example_d.exe
./zlib-1.2.5/minigzip.exe
./zlib-1.2.5/minigzip_d.exe
./zlib-1.2.5/zlib1.dll

いちおう置いてみます。オフィシャルの DLL が出たのに気づいたら消します。ダウンロード前に http://www.zlib.net/ をチェックしてみてください。

  • http://w4.hoso.net/files zlib-1.2.5-win32-x86-unofficial-uch.tar.gz

追記@Wed Aug 18 17:03:52 2010

オフィシャルの DLL がでています。