Subject: cross-build trouble?
To: None <tech-ports@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-ports
Date: 04/30/2002 16:13:10
I've been trying to set up a cross-build environment.  First, I made
sure that the new build world order was at least minimally sane by
doing "build.sh -r" to rebuild everything.  This was on i386, and it
worked; the system it built has shown no signs of brokenness.  (This is
all with a /usr/src tree checked out via anoncvs a night or two ago.)

Then, as a first trial, to get used to it, I tried to cross-build
macppc (macppc picked as a "random" port that uses different $MACHINE
and $MACHINE_ARCH).  The command I used was

build.sh -a powerpc -d -m macppc -D /home/mouse/macppc -O /home/mouse/macppc/.obj -U

/home/mouse/macppc was empty except for an empty .obj directory, and
the command was run as the user that owns /usr/src.

This ticked along nicely for a while, but eventually fell over:

dependall ===> toolchain
...
(cd intl && /home/mouse/macppc/.obj/tools/tools.NetBSD-1.5ZC-i386/bin/nbmake -f /usr/src/tools/toolchain/../Makefile.gnuwrap all)
cc -c -DCROSS_COMPILE -DIN_GCC -DHAIFA   -O   -DHAVE_CONFIG_H    -I. -I/usr/src/tools/toolchain/../../gnu/dist/toolchain/gcc -I/usr/src/tools/toolchain/../../gnu/dist/toolchain/gcc/config -I/usr/src/tools/toolchain/../../gnu/dist/toolchain/gcc/../include  /usr/src/tools/toolchain/../../gnu/dist/toolchain/gcc/gencheck.c
/var/tmp/ccW0ZXxE.s: Assembler messages:
/var/tmp/ccW0ZXxE.s:658: Error: Unrecognized opcode: `pushl'
/var/tmp/ccW0ZXxE.s:659: Error: Unrecognized opcode: `movl'
/var/tmp/ccW0ZXxE.s:660: Error: Unrecognized opcode: `subl'
/var/tmp/ccW0ZXxE.s:661: Error: Unrecognized opcode: `addl'
/var/tmp/ccW0ZXxE.s:662: Error: Unrecognized opcode: `pushl'
[many more "Unrecognized opcode" complaints about perfectly valid i386
opcodes, and the occasional syntax error]
*** Error code 1

Stop.
nbmake: stopped in /home/mouse/macppc/.obj/tools/toolchain/build/gcc
*** Error code 1
[cascade of "stopped in..." messages]

I then tried the same, but with s/powerpc/m68k/ and s/macppc/sun3/g,
which fell over in the-same-but-different way.  It failed at the same
point in the build, and it failed complaining about valid i386
instructions, but the complaints look very different.  Could it perhaps
be incorrectly using the cross-as when building host binaries?

And, what's the Right Thing to do about it?  Did I misinterpret
build.sh's -a and -m options, or do they not quite work yet, or what?
I _thought_ cross-building was supposed to work, with like one or two
exceptions (something like sh3? I forget).

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B