In message: <20090909010833.ga12...@netbsd.org> David Holland <dholland-sourcechan...@netbsd.org> writes: : On Tue, Sep 08, 2009 at 10:02:33AM -0600, M. Warner Losh wrote: : > __NetBSD__ is the *COMPILER* environment. Depending on it is *BAD*. : > You need to use a different symbol. This is a bug in the NetBSD code : > now. __NetBSD__ isn't, and never has bene, the KERNEL. : : No need to shout... : : Anyway, what does the compiler environment *mean* besides "we're : building a NetBSD binary"? That's exactly what rumpkernel is, even if : it's compiled with the FreeBSD compiler. Properly speaking it ought to : be built with a cross-compiler; maybe that'll happen in the long term.
If you are building with a FreeBSD compiler, you are building a FreeBSD binary, by definition. __FreeBSD__ means you are building a FreeBSD binary. If that's not what you want to do, you need to jump through a lot of hoops, but it usually easier to build a cross compiler than jump through those hoops. There's a lot more to the environment than just -D__FreeBSD__, there's the default binaries that are produced, there's a bunch of defines and arch assertions, default paths to includes and libraries, etc. This may be inconvenient. I know years ago I tried building a NetBSD kernel with a FreeBSD compiler, and that failed due to these differences (and others other than __NetBSD__ not being defined). Trying to kludge it caused me much pain and suffering. I abandoned the effort because building a proper cross compiler turned out to be a lot easier... sorry for the shouting earlier, but this is a hot-button since I've had to explain this difference many times to many people over the years... Warner