Subject: Problems building NetBSD/mac68k 1.2.1 from scratch (vs. NetBSD/i386)
To: None <port-mac68k@NetBSD.ORG>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: port-i386
Date: 07/03/1997 20:17:44
I seem to be missing something simple here.  I've built NetBSD 1.2.1 from
scratch on both my SPARCstation 20/71 and a Pentium 133 box, both using
$DESTDIR to build into an alternate directory tree and a direct build.

I'm trying to do the same thing on a Mac IIci and have run into a problem that
stops me as soon as it starts to compile anything.

I copied over the 1.2.1 source from the Pentium.  I set DESTDIR, cd'd to
/usr/src/1.2.1/share/mk and did a "make install" into ${DESTDIR}/usr/share/mk
and then I let rip with

	make -f Makefile.build -m ${DESTDIR}/usr/share/mk build

(Makefile.build is /usr/src/Makefile with a few twiddles like "${MAKE} obj"
 inserted in strategic places, etc.)

This works with no trouble at all on the PC (and on the SPARCstation, for that
matter).  On the Mac, it's a different story.

It gets down into domestic (I'm in the US (-: ) and this is what happens:

(Long path to $DESTDIR changed to "${DESTDIR}" for clarity)

[...]
===> domestic
===> domestic/include
===> domestic/include/kerberosIV
test -e ${DESTDIR}/usr/include/kerberosIV ||  mkdir -m 0755 ${DESTDIR}/usr/include/kerberosIV
cd /usr/src/1.2.1/usr/src/domestic/include/kerberosIV; for file in adm_locl.h co
m_err.h des.h kadm.h kadm_locl.h kadm_server.h kafs.h kdc.h klog.h kparse.h kpro
p.h krb.h krb_config.h krb_db.h kuser_locl.h port-fix.h prot.h protos.h slav_loc
l.h site.h ss.h; do  cmp -s $file ${DESTDIR}/usr/include/kerb
erosIV/$file ||  install -c -o bin -g bin -m 444 $file  /usr/src/1.2.1/usr/src/.
build/usr/include/kerberosIV; done
===> domestic/lib
===> domestic/lib/libacl
===> domestic/lib/libcom_err
===> domestic/lib/libdes
===> domestic/lib/libcom_err
===> domestic/lib/libdes
===> domestic/lib/libkafs
===> domestic/lib/libkdb  
===> domestic/lib/libkrb 
cd /usr/src/1.2.1/usr/src/domestic/lib/libkrb/../../usr.bin/compile_et && make d
epend && make
make: don't know how to make ${DESTDIR}/usr/lib/crt0.o. Stop
*** Error code 2

What should normally happen here (looking at the same point in my PC output):

[...]
===> domestic/lib/libkrb
cd /usr/src/1.2.1/usr/src/domestic/lib/libkrb/obj; cmp -s krb_err.h  /usr/local/.build/usr/include/kerberosIV/krb_err.h ||  install -c -o bin -g bin -m 444 krb_err.h  /usr/local/.build/usr/include/kerberosIV
[...]

Instead, the Mac is trying to do what the PC doesn't do until much much
later, i.e. like 9000 lines further down in the "make build" output!

In short, when the Mac gets to "domestic/lib/libkrb" and does a "make includes"
the result is

macbsd4me# make -n includes
cd /usr/src/1.2.1/usr/src/domestic/lib/libkrb/../../usr.bin/compile_et && make depend && make
/usr/src/1.2.1/usr/src/domestic/lib/libkrb/../../usr.bin/compile_et/compile_et /usr/src/1.2.1/usr/src/domestic/lib/libkrb/krb_err.et
cd /usr/src/1.2.1/usr/src/domestic/lib/libkrb; cmp -s krb_err.h  /usr/src/1.2.1/usr/src/.build/usr/include/kerberosIV/krb_err.h ||  install -c -o bin -g bin -m 444 krb_err.h  /usr/src/1.2.1/usr/src/.build/usr/include/kerberosIV

Why is the Mac trying to build "compile_et" here?  I'm wondering if this is
happening because I don't have a fully-populated /usr/obj tree at this point?

The PC doesn't attempt this build of "compile_et" at this stage.  It doesn't
do it until almost 1000 miles later:

[... 1000 lines of PC "make build" output elided ...]
===> domestic/lib/libkrb
cd /usr/src/1.2.1/usr/src/domestic/lib/libkrb/../../usr.bin/compile_et && make d
epend && make
lex  et_lex.lex.l
mv lex.yy.c et_lex.lex.c
mkdep -a -DHAVE_CONFIG_H -I. -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_e
t/../../include -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_et/../../lib/l
ibcom_err -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_et/../../include com
pile_et.c
cc -O -DHAVE_CONFIG_H -I. -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_et/.
./../include -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_et/../../lib/libc
om_err -I/usr/src/1.2.1/usr/src/domestic/usr.bin/compile_et/../../include  -I/us
r/src/1.2.1/usr/src/domestic/usr.bin/compile_et/../../include -Werror -nostdinc
-idirafter /usr/local/.build/usr/include  -c compile_et.c
[...]

I'm baffled at this point.  If I look at the PC build output, the first
instance of crt0.o I see is

pcnetbsd4me# egrep -n crt0 make.build.out.DESTDIR | head -7
716:cc   -o compile_et -nostdlib -L${DESTDIR}/usr/lib ${DESTDIR}/usr/lib/crt0.o compile_et.o error_table.o -ll -lgcc -lc -lgcc
779:rm -f a.out [Ee]rrs mklog core *.core   crt0.o gcrt0.o scrt0.o  
3466:mkdep -a -DLIBC_SCCS -I/usr/src/1.2.1/usr/src/lib/csu/i386/.. -DDYNAMIC /usr/src/1.2.1/usr/src/lib/csu/i386/crt0.c
3542:cc -O -DLIBC_SCCS -I/usr/src/1.2.1/usr/src/lib/csu/i386/..  -Werror -nostdinc -idirafter ${DESTDIR}/usr/include  -c -DCRT0 -DDYNAMIC /usr/src/1.2.1/usr/src/lib/csu/i386/crt0.c -o crt0.o
3543:cc -O -DLIBC_SCCS -I/usr/src/1.2.1/usr/src/lib/csu/i386/..  -Werror -nostdinc -idirafter ${DESTDIR}/usr/include  -c -DMCRT0 /usr/src/1.2.1/usr/src/lib/csu/i386/crt0.c -o gcrt0.o
3544:cc -O -DLIBC_SCCS -I/usr/src/1.2.1/usr/src/lib/csu/i386/..  -Werror -nostdinc -idirafter ${DESTDIR}/usr/include  -c -DSCRT0 /usr/src/1.2.1/usr/src/lib/csu/i386/crt0.c -o scrt0.o
6762:install -c -o bin -g bin -m 444 crt0.o gcrt0.o scrt0.o  ${DESTDIR}/usr/lib

Now, how could the compile of "compile_et" at line 716 have succeeded, if
"crt0.o" itself wasn't even compiled until line 3542, and it wasn't installed
into ${DESTDIR}/usr/lib until line 6762 ?!?

So the PC should be dying because crt0.o isn't in ${DESTDIR}/usr/lib when
it's first needed, but it doesn't.  And the Mac build is dying because it
seems to be doing something way, way before when it should be doing it.

Can anyone explain this?

	- Greg