*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> compat_freebsd (8)              




NAME    [Toc]    [Back]

     compat_freebsd - setup for running  FreeBSD  binaries  under

DESCRIPTION    [Toc]    [Back]

     OpenBSD  supports  running  FreeBSD binaries.  Most binaries
should work,
     except for  programs  that  use  FreeBSD-specific  features.
These include
     i386-specific calls, such as syscons utilities and audio devices.

     The FreeBSD compatibility feature is active for kernels compiled with the
     COMPAT_FREEBSD  option  and  the kern.emul.freebsd sysctl(8)

     A lot of programs are dynamically linked.  This  means  that
the FreeBSD
     shared libraries that the programs depend on and the runtime
linker are
     also needed.  Additionally, a "shadow  root"  directory  for
FreeBSD binaries
  on  the  OpenBSD system will have to be created.  This
directory is
     named /emul/freebsd.  Any file operations  done  by  FreeBSD
programs run
     under  OpenBSD  will look in this directory first.  So, if a
FreeBSD program
 opens, for example, /etc/passwd, OpenBSD will first try
to open
     /emul/freebsd/etc/passwd,  and  if  that does not exist open
the `real'
     /etc/passwd file.  It is recommended that  FreeBSD  packages
that include
     configuration files, etc., be installed under /emul/freebsd,
to avoid
     naming conflicts with possible OpenBSD counterparts.  Shared
     should also be installed in the shadow tree.

     Generally,  it will only be necessary to look for the shared
     that FreeBSD binaries depend on the  first  few  times  that
FreeBSD programs
     are  installed  on the OpenBSD system.  After a while, there
will be a sufficient
 set of FreeBSD shared libraries on the system to  be
able to run
     newly imported FreeBSD binaries without any extra work.

   Setting up shared libraries    [Toc]    [Back]
     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, root privileges are required on the
OpenBSD system
 to perform the necessary installation steps).

     1.   Access to the OpenBSD ports(7) system: Install the port
          freebsd_lib in the emulators category.  The freebsd_lib
port contains
 the shared libraries, binaries, and other related
files necessary
 to run FreeBSD applications.

     2.    Access  to  a FreeBSD system: In this case temporarily
install the binary
 there, see what shared  libraries  it  needs,  and
copy them to the
          OpenBSD  system.   Example:  ftp  the FreeBSD binary of
SimCity.  Put it
          on the FreeBSD system, and check which shared libraries
it needs by
          running `ldd sim':

                me@freebsd% ldd /usr/local/lib/SimCity/res/sim

                     -lXext.6   =>  /usr/X11R6/lib/libXext.so.6.0
                     -lX11.6   =>    /usr/X11R6/lib/libX11.so.6.0
                     -lc.2 => /usr/lib/libc.so.2.1 (0x10144000)
                     -lm.2 => /usr/lib/libm.so.2.0 (0x101a7000)
                     -lgcc.261     =>    /usr/lib/libgcc.so.261.0

          All the files from the last column should be placed under
          /emul/freebsd.   The following files would therefore be
required on
          the OpenBSD system:


          Note that if a FreeBSD shared library with  a  matching
major revision
          number  to  the first column of the 'ldd' output is already present,
          it isn't necessary to copy the file named in  the  last
column to the
          OpenBSD  system; the one already there should work.  It
is advisable
          to copy the shared library anyway, if  it  is  a  newer
version.  The
          old  one can be removed.  So, if this library exists on
the system:


          and the ldd output for a new binary is:

                -lc.2 => /usr/lib/libc.so.2.1 (0x10144000)

          it isn't necessary to  copy  /usr/lib/libc.so.2.1  too,
because the
          program  should  work fine with the slightly older version.  libc.so
          can be replaced anyway, and that should leave:


          Finally, the FreeBSD  runtime  linker  and  its  config
files must be
          present  on  the  system.  These files should be copied
from the FreeBSD
 system to their appropriate  place  on  the  OpenBSD
system (in the
          /emul/freebsd tree):


     3.    No  access  to a FreeBSD system: In that case, get the
extra files
          from various ftp sites.  Information on where  to  look
for the various
 files is appended below.

          Retrieve  the  following  files (from _one_ ftp site to
avoid any version
 mismatches), and install them under  /emul/freebsd
          foo/bar is installed as /emul/freebsd/foo/bar):


          ldconfig  and  ldd  don't  necessarily need to be under
          they can be installed  elsewhere  in  the  system  too.
Just make sure
          they don't conflict with their OpenBSD counterparts.  A
good idea
          would be to install them in /usr/local/bin as ldconfigfreebsd and

          Run  the  FreeBSD ldconfig program with directory arguments in which
          the FreeBSD runtime linker should look for shared libs.
/usr/lib is
          standard.  For example:

                me@openbsd% mkdir -p /emul/freebsd/var/run
                me@openbsd%    touch    /emul/freebsd/var/run/ldelf.so.hints
                me@openbsd%          touch           /emul/freebsd/var/run/ld.so.hints
                me@openbsd%    ldconfig-freebsd    /usr/X11R6/lib

          Note that argument directories of ldconfig  are  mapped
          /emul/freebsd/XXXX by OpenBSD's compat code, and should
exist as
          such on the OpenBSD system.  Make sure
          /emul/freebsd/var/run/ld.so.hints exists  when  running
FreeBSD's ldconfig;
 if not, OpenBSD's /var/run/ld.so.hints could be

          FreeBSD ldconfig 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.hints.  The FreeBSD version
of the ldconfig
 program should be rerun each time a  new  shared
library is

          The OpenBSD system should now be set up for FreeBSD binaries which
          only need a shared libc.   Test  this  by  running  the
FreeBSD ldd on
          itself.   Suppose  that it is installed as ldd-freebsd,
it should produce
 something like:

                me@openbsd% ldd-freebsd `which ldd-freebsd`

                     -lc.2 => /usr/lib/libc.so.2.1 (0x1001a000)

          This being done, new FreeBSD binaries can  now  be  installed.  Whenever
 a new FreeBSD program is installed, it should be determined if it
          needs shared libraries, and if so, whether they are installed in the
          /emul/freebsd  tree.   To do this, run the FreeBSD version 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 -l<majorname> => <fullname>.

          If it prints "not found" instead of <fullname> it means
that an extra
 library is needed.  Which library this is, is shown
in <majorname>,
 which will be of the form XXXX.<N>.  Find a
          libXXXX.so.<N>.<mm> on a FreeBSD ftp site, and  install
it on the
          OpenBSD  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 recent version.

   Finding the necessary files    [Toc]    [Back]
     Note:  the  information  below  is valid as of Feb 2003, but
certain details
     such as names of ftp  sites,  directories  and  distribution
names may have
     changed since then.

     FreeBSD  distribution  is  available  on a lot of ftp sites.
Sometimes the
     files are unpacked, and individual files can  be  retrieved,
but mostly
     they  are stored in distribution sets, usually consisting of
 with gzipped tar files in them.  The primary  ftp  site
for the distribution


     Mirror sites are described at:


     This distribution consists of a number of tar-ed and gzipped
files.  Normally,
 they're controlled by an  install  program,  but  the
files can be retrieved
  "by  hand" too.  The way to look something up is to
retrieve all
     the files in the distribution, and ``tar ztvf'' through them
for the
     files  needed.   Here  is an example of a list of files that
might be needed:

           Needed          Files

           ld.so           5.0-RELEASE/base/base.??
           ldconfig        5.0-RELEASE/base/base.??
           ldd             5.0-RELEASE/base/base.??
           libc.so.6       5.0-RELEASE/base/base.??
           libX11.so.6       5.0-RELEASE/packages/x11/XFree86-libraries-??
           libXt.so.6        5.0-RELEASE/packages/x11/XFree86-libraries-??

     The files called ``base.??'' are tar-ed, gzipped and  split,
so they can
     be extracted with ``cat base.?? | tar zpxf -''.

     The  XFree86  libraries are compressed with bzip2 and can be
extracted with
     ``bzcat <file> | tar pxf -''.  Note: The bzip2 utilities are
not part of
     a  base  OpenBSD system.  bzip2 can be added via packages(7)
or ports(7).

     Simply extract the files from these compressed  tarfiles  in
     /emul/freebsd directory (possibly omitting or afterwards removing unnecessary

BUGS    [Toc]    [Back]

     The information about FreeBSD distributions may become  outdated.

OpenBSD      3.6                           June      4,      1995
[ Back ]
 Similar pages
Name OS Title
compat_hpux OpenBSD setup for running HP-UX binaries under emulation
compat_osf1 OpenBSD setup for running OSF/1 binaries under emulation
compat_bsdos OpenBSD setup for running BSDI binaries under emulation
compat_ibcs2 OpenBSD setup for running iBCS2 binaries under emulation
compat_linux OpenBSD setup for running Linux binaries under emulation
compat_sunos OpenBSD setup for running SunOS binaries under emulation
compat_ultrix OpenBSD setup for running Ultrix binaries under emulation
compat_svr4 OpenBSD setup for running SVR4/iBCS2 binaries under emulation
compat_aout OpenBSD setup for running a.out OpenBSD binaries on ELF systems
tuning FreeBSD performance tuning under FreeBSD SYSTEM SETUP - DISKLABEL, NEWFS, TUNEFS, SWAP When using disklabel(...
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service