Subject: port-i386/2835: man page for compat_freebsd
To: None <email@example.com>
From: None <firstname.lastname@example.org>
Date: 10/11/1996 18:18:32
>Synopsis: man page for compat_freebsd
>Responsible: gnats-admin (GNATS administrator)
>Arrival-Date: Fri Oct 11 15:35:01 1996
System: NetBSD stripey.spath.ba.md.us 1.2 NetBSD 1.2 (STRIPEY) #3: Sat Oct 5 10:06:09 EDT 1996 email@example.com:/j/NetBSD/src/sys/arch/i386/compile/STRIPEY i386
man page attached.
.\" Copyright (c) 1996 James E. Spath <firstname.lastname@example.org>
.\" Adapted from:
.\" $NetBSD: compat_linux.8,v 1.2 1995/10/16 20:17:59 fvdl Exp $
.\" Copyright (c) 1995 Frank van der Linden
.\" All rights reserved.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed for the NetBSD Project
.\" by Frank van der Linden
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.Dd October 11, 1996
.Os NetBSD 1.2
.Dt COMPAT_FREEBSD 8
.Nd setup procedure for running FreeBSD binaries
NetBSD supports running FreeBSD binaries.
This only applies to i386 systems for now.
Most programs should work.
The FreeBSD compatibility feature is active
for kernels compiled with the
Many programs are dynamically linked. This means you will also
need the FreeBSD shared libraries that the program depends on, and
the runtime linker. You will need to create a "shadow root"
directory for FreeBSD binaries on your NetBSD system. This directory
is named /emul/freebsd. Any file operations done by FreeBSD programs
run under NetBSD will look in this directory first. So, if a
FreeBSD program opens, for example, /etc/passwd, NetBSD will first
try to open /emul/freebsd/etc/passwd, and if that does not exist
open the 'real' /etc/passwd file. We recommend that you install
FreeBSD packages that include configuration files, etc., under
/emul/freebsd, to avoid naming conflicts with possible NetBSD
counterparts. Shared libraries should also be installed in the
Generally, you will need to look for the shared libraries that
FreeBSD binaries depend on only the first few times that you install
a FreeBSD program on your NetBSD system. After a while, you will
have a sufficient set of FreeBSD shared libraries on your system
to be able to run newly imported FreeBSD binaries without any extra
.Ss Setting up shared libraries
How to get to know which shared libraries FreeBSD binaries need,
and where to get them? Basically, there are 3 possibilities (when
following these instructions you will need to be root on your NetBSD
.Bl -tag -width 123 -compact
You have access to a FreeBSD system. In this case you can temporarily
install the binary there, see what shared libraries it needs, and
copy them to your NetBSD system. Example: you have just ftp-ed
the FreeBSD binary of XPaint. Put it on the FreeBSD system you
have access to, and check which shared libraries it needs by running
.Bl -tag -width 123 -compact -offset indent
.It (me@freebsd) ldd xpaint
libXt.so.3 => /usr/X11/lib/libXt.so.3.1.0
You would need to get all the files from the last column, and put
them under /emul/freebsd, with the names in the first column as
symbolic links pointing to them. This means you eventually have
these files on your NetBSD system:
/emul/freebsd/usr/X11/lib/libXt.so.3 (symbolic link to the above)
Note that if you already have a FreeBSD shared library with a
matching major revision number to the first column of the 'ldd'
output, you won't need to copy the file named in the last column
to your system (the one you already have should work). We advise
copying the shared library if it is a newer version. You can remove
the old one as long as you make the symbolic link point to the new
one. So, if you have these libraries on your system:
/emul/freebsd/lib/libc.so.4 -> /emul/freebsd/lib/libc.so.4.6.27
and you find that the ldd output for a new binary you want to
libc.so.4 => /lib/libc.so.4.6.29
you won't need to worry about copying /lib/libc.so.4.6.29 too,
because the program should work fine with the slightly older version.
You can decide to replace the libc.so anyway, and that should leave
/emul/freebsd/lib/libc.so.4 -> /emul/freebsd/lib/libc.so.4.6.29
Please note that the symbolic link mechanism is
needed for FreeBSD binaries; the NetBSD runtime linker takes care
of looking for matching major revision numbers itself.
Finally, you must make sure that you have the FreeBSD runtime linker
and its config files on your system. You should copy these files
from the FreeBSD system to their appropriate place on your NetBSD
system (in the /emul/freebsd tree):
You don't have access to a FreeBSD system. In that case, you should
get the extra files you need from various web sites. Information
on where to look for the various files is appended below. For now,
let's assume you know where to get the files.
Retrieve the following files (from _one_ ftp site to avoid any
version mismatches), and install them under /emul/freebsd (i.e.
/foo/bar is installed as /emul/freebsd/foo/bar):
ldconfig and ldd don't necessarily need to be under /emul/freebsd,
you can install them elsewhere in the system too. Just make sure
they don't conflict with their NetBSD counterparts. A good idea
would be to install them in /usr/local/bin as ldconfig-freebsd and
Create the file /emul/freebsd/var/run/ld.so.hints, containing the
directories in which the FreeBSD runtime linker should look for
shared libs. It is a plain text file, containing a directory name
on each line. /lib and /usr/lib are standard, you could add the
Note that these are mapped to /emul/freebsd/XXXX by NetBSD's compat
code, and should exist as such on your system.
Run the FreeBSD ldconfig program. It should be statically linked,
so it doesn't need any shared libraries by itself. It will create
the file /emul/freebsd/var/run/ld.so.hionts. You should rerun the FreeBSD
version of the ldconfig program each time you add a new shared
You should now be set up for FreeBSD binaries which only need a
shared libc. You can test this by running the FreeBSD ldd on itself.
Suppose that you have it installed as ldd-freebsd, it should produce
.Bl -tag -width 123 -compact -offset indent
.It (me@netbsd) ldd-freebsd `which ldd-freebsd`
libc.so.4 => /lib/libc.so.4.6.29
You are now ready to install new FreeBSD binaries. Whenever you
install a new FreeBSD program, check if it needs shared libraries,
and if you have them installed in the /emul/freebsd tree. To do
this, run the FreeBSD version of ldd on the new program, and watch
its output. ldd (see also the manual page for ldd(1)) will print
a list of shared libraries that the program depends on, in the form
<majorname> => <fullname>.
If it prints "not found" instead of <fullname> it means that you
need an extra library. <majorname> shows the library name, in the
form libXXXX.so.<N> You will need to find a libXXXX.so.<N>.<mm> on
a FreeBSD ftp site, and install it on your system. The XXXX (name)
and <N> (major revision number) should match; the minor number(s)
<mm> are less important, though it is advised to take the most
You have a FreeBSD "live file system" CD-ROM. In this case you
can run binaries directly from the CD. You could mount the CD
volume at the /emul/freebsd directory, and the emulator will find
all the correct binaries and shared libraries beneath this point.
Programs that look for /etc/passwd entries will find the CD-ROM
version, however, so the following can be used to overlay the
read-only files with writable ones:
mount -v -t cd9660 -o ro /dev/cd0a /emul/freebsd
mount -v -t union /usr/emul/freebsd /emul/freebsd
The /emul/freebsd and /usr/emul/freebsd directories need to be
created first. Specific files such as passwd and group can be
placed there after the union mount is made.
.Ss Finding the necessary files.
the information below is valid as of the time this
document was written
but certain details such as names of web sites,
directories and distribution names
may have changed by the time you read this.
http://www.freebsd.org, or one of the mirror sites.
/emul/freebsd/ mount point or directory.
.Sh SEE ALSO
The information about FreeBSD distributions may become outdated.
We need a list of programs that will not work here.