Subject: Need help: Out-of-tree cross compilation.
To: None <>
From: marty fouts <>
List: tech-toolchain
Date: 05/26/2006 11:39:23
I've confused myself and need advice.

I'm trying to set up a build system that allows me to build
applications out-of-tree but cross compiled for NetBSD, because I need
to crosscompile aps for NetBSD on a Linux box, as I've mentioned

I've looked at the log output from a system build, and, as far as I
can tell, the Makefile below duplicates the command arguments
necessary for the crosscompile.

I get a hello binary, and it looks fine, except that it's missing the
elf section with the NetBSD note, which, I presume, is the reason why
NetBSD gives a 'wrong architecture' message and refuses to run the

What is the last bit of magic I'm missing in my compilation to make
the binary a NetBSD binary?

Here's the makefile (cut'n'paste, so tabs are screwed up)


CFLAGS=-nostdinc -isystem ../netbsd_quilt/src/obj/destdir.evbarm/usr/include
LDFLAGS= -Wl,-nostdlib
LDFLAGS1=-Wl,-rpath-link,$(BASE)/lib:$(BASE)/usr/lib -L$(BASE)/lib
-B$(BASE)/lib -B$(BASE)/usr/lib

hello:  hello.o
        $(LD) $(LDFLAGS) -o hello $(LDFLAGS1) hello.o $(LIBS)

hello.o:        hello.c
                $(CC) $(CFLAGS) -c hello.c