Subject: cross compile with Linux host fails with nbmake Illegal instruction
To: None <>
From: Jeremy C. Reed <>
List: tech-toolchain
Date: 02/05/2005 22:10:25
I am trying cross compiling of -current on a Linux host. I have
linux-kernel-headers-2.6.10, gcc3-c-3.3.4, gcc3-c++-3.3.4, bmake-20040220
(no gmake installed), binutils-, and mk-files-20040214 installed.

I used HOST_CC to choose my gcc.

HOST_CC=/usr/gcc3/bin/cc ./ -m i386 -U tools

The above fails with:

===> No nonexistent/bin/nbmake, needs building.
===> Bootstrapping nbmake
checking for sh... /bin/sh
checking for gcc... /usr/gcc3/bin/cc
checking for C compiler default output... a.out
checking whether the C compiler works... configure: error: cannot run C
compiled programs.
If you meant to cross compile, use `--host'.

"nonexistent/bin/nbmake" seems like a typo. But then I saw it in the I don't understand why it didn't automatically create a
destination for the to-be-built tools nor any object OBJDIR directory.

2) Then I tried:
 host_alias=i386-pc-linux-gnu HOST_CC=/usr/gcc3/bin/cc ./ -m i386 -U tools

which failed with:

/usr/gcc3/bin/cc  -O -D_PATH_BSHELL="/bin/sh" -D_PATH_DEFSHELLDIR="/bin"
-I/home/reed/netbsd/src/tools/make/../../usr.bin/make -c
/usr/gcc3/bin/cc  -O -o nbmake *.o
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
./ line 1078: 17835 Illegal instruction     ${runcmd} "${make}"
-m ${TOP}/share/mk obj NOSUBDIR=

ERROR: Failed to make obj in tools

host_alias above sets --host for the type of system for the program to run

The builds were done in /tmp/nbbuild17195/ but that was promptly removed
when this build was finished.

3) So I commented out that trap that did that.

$ file /tmp/nbbuild17884/nbmake
/tmp/nbbuild17884/nbmake: ELF 32-bit LSB executable, Intel 80386, version
1 (SYSV), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not

$  /tmp/nbbuild17884/nbmake -v
Illegal instruction

(Well I know -v doesn't do anything other than print out unknown option
and Usage statement.)

4) So I set USETOOLS=never and it still did the build of tools/make (and
failed at end).

Any ideas?

How do I get it to not cross-compile (even though I don't see why that
matters) for the tools?

(Please CC me on replies.)

Thank you,

 Jeremy C. Reed

 	  	 	 BSD News, BSD tutorials, BSD links