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

Peter Steele psteele at maxiscale.com
Tue Feb 9 16:22:03 UTC 2010

>I suspect I know the problem. The tool I'm building links with a bunch of other libraries we've developed, which I didn't write. I only modified the makefile of my
>own code. I'm going to have to tweak the makefiles of a dozen different library modules.

Unfortunately the problem isn't quite as simple as using sysroot. The problem with sysroot is symbolic links. Unlike chroot which makes everything reference the new root, including absolute paths, sysroot only does one level of redirection. So for example if my BSD8 root is located under /repo/bsd8, I can point sysroot there but libkvm doesn't link because of this:

$ ll /repo/bsd8/usr/lib/libkvm*
-r--r--r--  1 root  wheel  59630 Feb  7 14:43 /repo/bsd/bsd8/usr/lib/libkvm.a
lrwxr-xr-x  1 root  wheel     16 Feb  9 07:26 /repo/bsd8/usr/lib/libkvm.so -> /lib/libkvm.so.5
-r--r--r--  1 root  wheel  61352 Feb  7 14:43 /repo/bsd/bsd8/usr/lib/libkvm_p.a

The link points to a non-existent library outside of the BSD 8 tree (libkvm is libkvm.so.4 under BSD 7). There are several libraries that fall victim to this symbolic link issue that breaks the sysroot option. I've tried copying the linked BSD 8 libraries to the /lib directory under my BSD 7 system and solves the symbolic link problem, but now I'm getting an undefined symbol. 

It might make more sense to use chroot to do this, although that has complications of its own in that I need to install more packages into my BSD8 repository...

More information about the freebsd-questions mailing list