Subject: Re: Need help: Out-of-tree cross compilation.
To: None <>
From: Valeriy E. Ushakov <>
List: tech-toolchain
Date: 05/27/2006 00:41:33
On Fri, May 26, 2006 at 11:39:23 -0700, marty fouts wrote:

> 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
> before.
> 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
> binary.
> What is the last bit of magic I'm missing in my compilation to make
> the binary a NetBSD binary?

Have you tried the steps described at:

You will not have to add a lot of cruft like:

> 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

It used to work for me.  I used it for cross-compiling a project that
targeted (among other things) NetBSD/sh3 and NetBSD/arm, and you just
need to set CC, LD, etc to the $tooldir/foo-netbsd-gcc etc.

SY, Uwe
--                         |       Zu Grunde kommen          |       Ist zu Grunde gehen