binutil 2.9 を h8300-hms ターゲットとしてコンパイルする
クロスコンパイラ構築の第一段階、binutil の make && make install の方法というか、試行錯誤の記録です。使用したのは cygwin + gcc 3.3.3 (cygwin special)。
./configure --prefix=/home/userlib/h8300-hms --target=h8300-hms特に捻りなし。
checking lex output file root... ./configure: line 1701: lex: command not foundこんなことを言われたら、cygwin の setup.exe から、devel にある flex を追加インストール。
configure: error: cannot find output from lex; giving up
gcc -c -g -O2 -I. -I./../include -DNEED_sys_siglist -DNEED_basename -DNEED_strsignal ./dummy.cで、エラーは
In file included from dummy.c:46:です。built-in な関数定義と当たっているだけなので、-fno-builtin を付けて手動でコンパイルを通します。
functions.def: In function `main':
functions.def:38: error: too few arguments to function `strstr'
functions.def:45: error: too few arguments to function `vprintf'
functions.def:46: error: too few arguments to function `vsprintf'
gcc -c -g -O2 -I. -I./../include -DNEED_sys_siglist -DNEED_basename -DNEED_strsignal -fno-builtin ./dummy.c
strerror.c:461: error: conflicting types for `sys_errlist'errno.h での sys_errlist や sys_nerr の宣言との衝突なので、strerror.c を修正します。
/usr/include/sys/errno.h:23: error: previous declaration of `sys_errlist'
10c10ちなみに FreeBSD + gcc 3.4.4 な環境では strsignal.c でも同様のエラーに見舞われます。
< #ifndef NEED_sys_errlist
---
> //#ifndef NEED_sys_errlist
17c17,18
< #endif
---
> #define sys_nerr sys_nerr__
> //#endif
22c23
< #ifndef NEED_sys_errlist
---
> //#ifndef NEED_sys_errlist
24c25,26
< #endif
---
> #undef sys_nerr sys_nerr
> //#endif
mkdir pic
In file included from srconv.c:29:問題のコマンドラインはこれ。
bucomm.h:30:23: fopen-bin.h: No such file or directory
In file included from srconv.c:29:
bucomm.h:129: error: parse error before "boolean"
srconv.c:30:21: sysroff.h: No such file or directory
srconv.c:32:23: libiberty.h: No such file or directory
srconv.c:35:27: coff/internal.h: No such file or directory
In file included from srconv.c:36:
../bfd/libcoff.h:79: error: parse error before "boolean"
../bfd/libcoff.h:79: warning: no semicolon at end of struct or union
(以下略)
gcc -g -O2 srconv.c -o srconv…やたらシンプルですね。ちょっと手前の行と比較してみましょう。
gcc -DHAVE_CONFIG_H -I. -I. -I. -D_GNU_SOURCE -I. -I. -I../bfd -I./../bfd -I./../include -g -O2 -c wrstabs.cはい、どう見ても -I の include ディレクトリ指定が足りません。しかしそれだけではなくて、なんと実は sysroff.h というファイルが生成されていません。
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(SRCONV_PROG)$(EXEEXT) $(ADDR2LINE_PROG)ここの連中に $(EXEEXT) があったりなかったりする点にあります。
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(SRCONV_PROG)$(EXEEXT) $(ADDR2LINE_PROG)
noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG)
EXTRA_PROGRAMS = $(NLMCONV_PROG) $(SRCONV_PROG) $(DLLTOOL_PROG) $(WINDRES_PROG)