Guile をコンパイル.

一時期はTCLを置き換えるだのなんだの騒がれたものの,今やscheme好きの間でも使われない*1Guile.
私も,もはや興味はない.しかし,使いたい開発用ツールがGuileで書かれているものだから仕方が無い.インストールするか.

まず,GMPで引っかかる.

checking for __gmpz_init in -lgmp... no
configure: error: GNU MP not found, see README

libgmp.a が gcc の標準検索パスに無い状況を configure が想定していない.開発者が少ないツールでは,ありがちな罠だわなー.
めげずに続けてみる.

CFLAGS=-L/opt/gcc4build/lib ../guile-1.8.6/configure --prefix=/opt/guile

configure は通った.

Leopard では,新しめのGuileはビルドできない.

ld warning: codegen in ___gmpn_popcount (offset 0x00000007) prevents image from loading in dyld shared cache
ld warning: codegen in ___gmpn_popcount (offset 0x0000000E) prevents image from loading in dyld shared cache
ld warning: codegen in ___gmpn_popcount (offset 0x00000015) prevents image from loading in dyld shared cache
ld warning: codegen in ___gmpn_hamdist (offset 0x00000007) prevents image from loading in dyld shared cache
ld warning: codegen in ___gmpn_hamdist (offset 0x0000000E) prevents image from loading in dyld shared cache
ld warning: codegen in ___gmpn_hamdist (offset 0x00000015) prevents image from loading in dyld shared cache
ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___gmpn_add_n from /opt/gcc4build/lib/libgmp.a(add_n.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs
collect2: ld returned 1 exit status
make[3]: *** [libguile.la] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

がーん.で,調べてみると,1.8.4になった辺りでダメとのこと.開発者が少ない上にOSXって特殊だからなぁ.
と思って,1.8.3にまで戻してみる.
今度は

cc1: warnings being treated as errors
../../guile-1.8.3/libguile/fports.c: In function 'scm_open_file':
../../guile-1.8.3/libguile/fports.c:364: warning: implicit declaration of function 'open64'
../../guile-1.8.3/libguile/fports.c: At top level:
../../guile-1.8.3/libguile/fports.c:614: error: syntax error before 'fport_seek_or_seek64'
../../guile-1.8.3/libguile/fports.c:614: error: syntax error before 'off64_t'
../../guile-1.8.3/libguile/fports.c:615: warning: return type defaults to 'int'

など出て落ちる.これも去年の1月ごろに話題になっていたらしい.行くも退くもナシか….CVSリポジトリで絶妙な時期を捜す…とかは嫌だな.単にGuileで動くツールを使いたいだけなのに.泥沼過ぎる.

対策

CFLAGS=-L/opt/gcc4build/lib ../guile-1.8.6/configure --prefix=/opt/guile

できたlibtoolにパッチ当て.

--- libtool.org	2009-05-11 18:41:42.000000000 +0900
+++ libtool	2009-05-11 18:42:26.000000000 +0900
@@ -4589,7 +4589,7 @@
     vinfo=
     vinfo_number=no
     weak_libs=
-    single_module="${wl}-single_module"
+    single_module="${wl}-single_module ${wl}-read_only_relocs,suppress"
     func_infer_tag $base_compile
 
     # We need to know -static, to get the right output filenames.
CFLAGS=-L/opt/gcc4build/lib make
sudo make install

動きゃいいのだ.それがhackだ.…と,自分に納得させる.

*1:特に2バイト圏の日本では,Gaucheのほうが使い易いもんね