libgauche ナシのナニ

作成着手。とりあえず configure して

$ CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar LD=arm-linux-gnueabi-ld \
RANLIB=arm-linux-gnueabi-ranlib ./configure --host=armel-unknown-linux \
--build=arm-linux-gnueabi --enable-multibyte=utf-8 --enable-threads=pthreads

で、src 配下の Makefile の一部を以下に。

gosh$(EXEEXT) : libgauche.$(SOEXT) $(gosh_OBJECTS) 
        @rm -f gosh$(EXEEXT)
        $(LINK) $(gosh_LDFLAGS) -o gosh$(EXEEXT) $(gosh_OBJECTS) $(gosh_LDADD) $(LIBS)
        $(LINK) $(gosh_LDFLAGS) -o gosh.exe $(gosh_OBJECTS) $(libgauche_OBJECTS) ../gc/.libs/*.o $(LIBS)

あ、しまった。LDFLAGS に -static をナニ。以下で configure をリトライ。

$ LDFLAGS=-static CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar \
LD=arm-linux-gnueabi-ld RANLIB=arm-linux-gnueabi-ranlib ./configure \
--host=armel-unknown-linux --build=arm-linux-gnueabi --enable-multibyte=utf-8 \
--enable-threads=pthreads

で、make 起動して出かけます。

帰宅後

make: *** No rule to make target `../gc/libgc.la', needed by `libgauche.so'.  Stop.

む。これは LDFLAGS に -static 指定したから、なのは昨日のナニで分かってたりして。ぶっちゃけ *.o ができてりゃなんとかなるんだけどな、と言いつつ手動で、ってかターゲット分けるか。
src/Makefile を以下に。

gosh.uni : $(gosh_OBJECTS) $(libgauche_OBJECTS) ../gc/.libs/*.o
        $(LINK) $(gosh_LDFLAGS) -o gosh.exe $(gosh_OBJECTS) $(libgauche_OBJECTS) ../gc/.libs/*.o $(LIBS)

で、

$ make gosh.uni
arm-linux-gnueabi-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I./../gc/include   -g -O2 -fPIC  -c main.c
TARGETLIB=`pwd`  arm-linux-gnueabi-gcc -std=gnu99 -g -O2 -fPIC -Wl,--rpath -Wl,`pwd` -L. -static  -rdynamic -o gosh.uni main.o core.o vm.o compaux.o macro.o code.o error.o class.o prof.o collection.o boolean.o char.o string.o list.o hash.o treemap.o bits.o port.o write.o read.o vector.o weak.o symbol.o keyword.o gloc.o compare.o regexp.o signal.o parameter.o module.o proc.o number.o bignum.o load.o paths.o promise.o repl.o autoloads.o system.o stdlib.o extlib.o exclib.o syslib.o moplib.o intlib.o compile.o scmlib.o objlib.o ../gc/.libs/*.o -ldl -lcrypt -lutil -lm  -lpthread
../gc/.libs/gc_dlopen.o: In function `GC_dlopen':
/home/rms/Gauche-0.8.14/gc/gc_dlopen.c:79: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
system.o: In function `Scm_GetGroupById':
/home/rms/Gauche-0.8.14/src/system.c:1164: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
system.o: In function `Scm_GetGroupByName':
/home/rms/Gauche-0.8.14/src/system.c:1176: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
system.o: In function `Scm_GetPasswdByName':
/home/rms/Gauche-0.8.14/src/system.c:1258: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
system.o: In function `Scm_GetPasswdById':
/home/rms/Gauche-0.8.14/src/system.c:1246: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
$

ええと、/usr/arm-linux-gnueabi/lib/libc.a とリンクさせようとしたらどうすりゃいいんだろ。って上記メセジをよく見てみたら warning ばっかだな。gosh.uni もできてます。

$ arm-linux-gnueabi-readelf -h gosh.uni
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x8130
  Start of program headers:          52 (bytes into file)
  Start of section headers:          4435712 (bytes into file)
  Flags:                             0x4000002, has entry point, Version4 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         38
  Section header string table index: 35
$

emulator に転送してみた。

# /data/gosh.uni
gosh: WARNING: Error while loading initialization file: cannot find file "gauche-init.scm" in *load-path* ("/usr/local/share/gauche/site/lib" "/usr/local/share/gauche/0.8.14/lib")(error).
WARNING: couldn't load gauche.interactive

gosh> (+ 1 2)
3
gosh> 

動くには動きましたが微妙。やっぱ昨晩 make できたナニをフルセットで送れないと微妙な上、configure のオプションを微妙に変えないと駄目そげ。
でも一応 emulator 上で gosh は動いた。