Next Previous Contents

6. Running foreign binaries

6.1 Running FreeBSD binaries under Linux

The iBCS package has support for running FreeBSD binaries under Linux; but it's old and unmaintained. I cannot get it to work. Please let me know if you have had better luck with this.

6.2 Running Linux binaries under FreeBSD

FreeBSD has the ability to run Linux binaries, both in a.out and ELF formats. To do this you have to take the following three steps:

  1. You have to enable Linux compatibility. To do this (in FreeBSD 2.2.2 --- details may vary in other versions) you have to edit your /etc/rc.conf file and change
    linux_enable="NO"
    
    to
    linux_enable="YES"
    
    and reboot. Another way to load the Linux binary support is to execute the command /usr/bin/linux. This way you don't have to reboot, and you don't always have the Linux binary support loaded (i.e. you save memory.) Remember to add the line
    options         COMPAT_LINUX
    
    to the FreeBSD kernel config file if you build a new FreeBSD kernel.
  2. You have to install the Linux shared libraries if your Linux binaries are dynamically linked. The libraries are included in FreeBSD 2.2.{2,5,6} as the package linux_lib-2.4.tgz (newer versions might be available.) Run the following command to install the package:
    pkg_add <path_to_package>/linux_lib-2.4.tgz
    
    <path_to_package> is the directory where the package is stored. You may also load it off the net by:
    pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable/All/linux_lib-2.4.tgz
    
    or by re-running /stand/sysinstall. Enter ``Configure'', ``Packages'' and use the menus. You should execute the following command if you are running statically linked Linux binaries:
    brandelf -t Linux <name_of_statically_linked_linux_binary>
    
  3. Install the Linux program(s) you want to run. The program(s) can be installed on either UFS or ext2fs filesystems. See section Mounting ext2fs filesystems under FreeBSD for more information about using ext2fs filesystems under FreeBSD.

I have successfully run the Linux versions of Applixware 4.3 and Netscape 3.01 (both ELF format) under FreeBSD 2.2.2 using this method (yes, I know there is a native FreeBSD version of Netscape 4.) The Linux versions of acroread and StarOffice 3 and 4 also work well under FreeBSD. StarOffice 5 depends on native Linux threads and currently do not work under FreeBSD. Read the FreeBSD documentation for more information on this topic.


Next Previous Contents
Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout