What is easiest way to build a BSD 8 binary on a BSD 7 box?

Pieter de Goeje pieter at degoeje.nl
Mon Feb 8 01:35:20 UTC 2010


On Monday 08 February 2010 01:51:37 Peter Steele wrote:
> >The easiest way would probably be the following.
> >
> ># SOMEDIR=/path/to/fbsd8buildenv
> ># mkdir -p ${SOMEDIR}
> ># cd /path/to/FreeBSD-8.0/src
> ># make buildworld
> ># make installworld DESTDIR=${SOMEDIR}
> >
> >Then adding --sysroot=${SOMEDIR} to all invocations of gcc/ld and/or
> > liberal use of -I and -L gcc options should do the trick.
> >
> >For example:
> ># export CFLAGS="-I${SOMEDIR}/usr/include -L${SOMEDIR}/lib
> > -L${SOMEDIR}/usr/lib # make
>
> I've done this and it's clearly working, at least in the sense I can tell
> the libraries are coming from my BSD 8 repository. My makefile is
> generating gcc commands that look like this:
>
> gcc -m64 -DHAVE_INT64_T --sysroot=/usr/local/buildrepo/bsd/v8/obj
> -L/usr/local/buildrepo/bsd/v8/obj/usr/lib ...
>
> I know it's working because if I rename the directory pointed to by sysroot
> the link fails. My tool is still failing though in exactly the same way in
> a call to kvm_read. The same call works fine when the tool is built on a
> BSD 8 box. Is there anything else I need to do to make sure the BSD 7 built
> binary is a fully complaint BSD 8 binary?

You could check that the tool is actually linked to the correct libraries with 
ldd(1). If all else fails, you could try building a full FreeBSD 8 jail or 
chroot. However running FBSD 8 userland on a 7 kernel is unsupported so I 
have no idea if that will actually work well enough to build software...

-- 
Pieter de Goeje


More information about the freebsd-questions mailing list