Panther で Gauche を使い続ける!
Gauche-0.9.3.3 (2012.06.03)
0.9.3.3 が出ていたのでビルドする。前回はどんなオプションを付けたのか思い出せなかったし、調べるのも面倒だったので、便利な機能を使った。
> gzcat Gauche-0.9.3.3.tgz | tar xf -
> cd Gauche-0.9.3.3
> gauche-config --reconfigure | sh
...
This Gauche has been configured with the following parameters:
version: 0.9.3.3
multibyte: utf8
slib: /usr/local/lib/slib
thread: pthreads
tls/ssl: axTLS
optional modules: ndbm zlib
make
...
ld: Undefined symbols:
_pthread_atfork
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libgc.la] Error 1
make[1]: *** [all-recursive] Error 1
...
system.c: In function `Scm_UnsetEnv':
system.c:2203: error: void value not ignored as it ought to be
make[1]: *** [system.o] Error 1
...
make: *** [all] Error 2
ぐほっ、上記のように失敗してしまった。前回の作業メモを見ながらやり直してみたけど、やっぱりダメだった。
ということで、少しずつ見ていく。まずは
ld: Undefined symbols: _pthread_atfork
/usr/bin/libtool: internal link edit command failed
の部分を追ってみる。/usr/include/pthread.h
を見てみると、int pthread_atfork
の定義が無い。pthreads
を無効にしてビルドするしかないのかなぁ。
下記のように configure
し直してから
./configure CFLAGS=-Wno-long-double --enable-pthreads=no
make
を実行。結果は
system.c: In function `Scm_UnsetEnv':
system.c:2203: error: void value not ignored as it ought to be
make[1]: *** [system.o] Error 1
となり、またしてもエラーになってしまった。
ソースの当該箇所を見てみると、下記のようになっている。
void Scm_UnsetEnv(const char *name)
{
#if defined(HAVE_UNSETENV)
int r = 0;
SCM_SYSCALL(r, unsetenv(name));
if (r < 0) Scm_SysError("unsetenv failed on %s", name);
#else /*!HAVE_UNSETENV*/
Scm_Error("sys-unsetenv is not supported on this platform.");
#endif /*!HAVE_UNSETENV*/
}
あ〜、なんかこの unsetenv
って見たことがある。Yash の variable.c
で使われてたやつだ。/usr/include/stdlib.h
では
void unsetenv(const char *);
のように戻り値が void
になっているけど、int
を欲っするからエラーになるんだったっけ?悩んだことがあるから解決にかかる時間が短かくて済む。Yash を使ってて良かった点かなぁ(^_^;)。
とりあえず HAVE_UNSETENV
というオプションがあるようなので、src/gauche/config.h
の
/* Define to 1 if the system has unsetenv */
#define HAVE_UNSETENV 1
の部分を undef
(コメントアウト)にしておこう。とりあえずこれで make
が最後まで進み、make test
も
Total: 12725 tests, 12725 passed, 0 failed, 0 aborted.
となった(^_-)v。なんかテストの数が他の人よりも少ないけど...。
これまでの手順をまとめておくと、下記のようになる。
1. ./configure CFLAGS=-Wno-long-double --enable-threads=no
2. src/gauche/config.h の修正
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
...
/* Define to 1 if the system has unsetenv */
#define HAVE_UNSETENV 1
/* #define HAVE_UNSETENV 1 */
3. ext/net/net.c の修正
#include <sys/uio.h> を追記
4. src/Makefile の gosh_LDFLAGS = -Wl,-no_pie の -no_pie を削除
5. make