Subject: Cross compiling current fails
To: None <current-users@netbsd.org>
From: R. Huvendiek <netbsd@kaervek.net>
List: current-users
Date: 09/06/2005 01:26:28
Hello,

today I tried to compile the latest current sources using my linux
machine. Unfortunately it does not even compile the tools. The toolchain
seem to choke badly on dirent.h whilst compiling ffs.lo (makefs).

From my observations the preprocessor will pull in files from the host
machine in /usr/include (/usr/include/dirent.h in this case), which of
course does not intermix very well with the netbsd sources :(

I start the compiling with:

./build.sh -R $D/rel -D $D/dist -O $D/obj -T $D/tools -mi386 -Utools

After a while all hell breaks loose:

------------------------------------------------------------
#   compile  makefs/ffs.lo
cc -O -I. -I/home/kaervek/netbsd-current/build/obj/tools/compat -I/home/kaervek/netbsd-current/build/obj/tools/compat/include  -I/home/kaervek/netbsd-current/src/tools/makefs/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  -I/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs  -I/home/kaervek/netbsd-current/src/bin/ls -I/home/kaervek/netbsd-current/src/sbin/mknod -I/home/kaervek/netbsd-current/src/usr.sbin/mtree -I/home/kaervek/netbsd-current/src/sys/fs/cd9660 -c -o ffs.lo.o    /home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c
In file included from /home/kaervek/netbsd-current/src/tools/makefs/../compat/ufs/ufs/dir.h:3,
                 from /home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c:100:
/home/kaervek/netbsd-current/src/tools/makefs/../compat/ufs/ufs/../../../../sys/ufs/ufs/dir.h:92:1: warning: "DT_UNKNOWN" redefined
In file included from /home/kaervek/netbsd-current/src/tools/makefs/../compat/compat_defs.h:118,
                 from /home/kaervek/netbsd-current/build/obj/tools/compat/nbtool_config.h:137,
                 from /home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c:69:
/usr/include/dirent.h:101:1: warning: this is the location of the previous definition
------------------------------------------------------------

As you see in the last line, /usr/include/dirent.h is pulled in.
Even though this are only warnings, there quite a lot of this. Then
things get ugly:

------------------------------------------------------------
/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c: In function `ffs_dump_dirbuf':
/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c:973: error: structure has no member named `d_ino'
/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c: In function `ffs_make_dirbuf':
/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c:993: error: structure has no member named `d_ino'
/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c:1010: error: structure has no member named `d_ino'

*** Failed target:  ffs.lo
*** Failed command: cc -O -I. -I/home/kaervek/netbsd-current/build/obj/tools/compat -I/home/kaervek/netbsd-current/build/obj/tools/compat/include -I/home/kaervek/netbsd-current/src/tools/makefs/../compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs -I/home/kaervek/netbsd-current/src/bin/ls -I/home/kaervek/netbsd-current/src/sbin/mknod -I/home/kaervek/netbsd-current/src/usr.sbin/mtree -I/home/kaervek/netbsd-current/src/sys/fs/cd9660 -c -o ffs.lo.o /home/kaervek/netbsd-current/src/tools/makefs/../../usr.sbin/makefs/ffs.c
*** Error code 1

Stop.
nbmake: stopped in /home/kaervek/netbsd-current/src/tools/makefs
------------------------------------------------------------

And that's it. I already tried to mess around by settings CPPFLAGS, but
this make the whole situation only worse. Of course the host compiler
does not work after this and I am unable to even compile the cross gcc.

Is there any cure for this? The whole source seems to compiler just
fine on my netbsd machine. But it takes a _lot_ longer there.

Ralf