diff --git a/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml b/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml index c2a1904be6..5f26f8df7c 100644 --- a/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml +++ b/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml @@ -1,1281 +1,1281 @@ &linux; Binary Compatibility Jim Mock Restructured and parts updated by Brian N. Handy Originally contributed by Rich Murphey Synopsis Linux binary compatibility binary compatibility Linux &os; provides binary compatibility with &linux;, allowing users to install and run &linux; binaries on a &os; system. Many companies and developers develop only for &linux;, and binary compatibility allows &os; users to run about 90% of all &linux; applications without modification. This includes productivity applications, games, and more. It has even been reported that, in some situations, &linux; binaries perform better on &os; than they do on &linux;. However, some &linux;-specific operating system features are not supported under &os;. For example, &linux; binaries will not work on &os; if they overly use &i386; specific calls, such as enabling virtual 8086 mode. After reading this chapter, you will know: How to enable &linux; binary compatibility on a &os; system. How to install additional &linux; shared libraries. How to install &linux; applications on a &os; system. The implementation details of &linux; compatibility in &os;. Before reading this chapter, you should: Know how to install additional third-party software. Installation Ports Collection &linux; libraries are not installed on &os; by default and &linux; binary compatibility is not enabled by default. &linux; libraries can be installed using the &os; Ports Collection. Alternately, &linux; libraries can be installed manually. Using the Ports Collection is by far the easiest way to install &linux; libraries: - &prompt.root; cd -/usr/ports/emulators/linux_base-f10 &prompt.root; make install distclean + &prompt.root; cd /usr/ports/emulators/linux_base-f10 +&prompt.root; make install distclean Once the port is installed, enable &linux; binary compatibility by loading the linux module. Type the following as root: &prompt.root; kldload linux In order for &linux; compatibility to always be enabled at boot time, add the following line to /etc/rc.conf: linux_enable="YES" To verify that the module is loaded, use &man.kldstat.8;: &prompt.user; kldstat Id Refs Address Size Name 1 2 0xc0100000 16bdb8 kernel 7 1 0xc24db000 d000 linux.ko kernel options COMPAT_LINUX Users who prefer to statically link &linux; binary compatibility into the kernel should add options COMPAT_LINUX to the custom kernel configuration file. Compile and install the new kernel as described in . Installing Libraries Manually While using the Ports Collection is recommended, &linux; libraries can be installed manually. The &linux; shared libraries required by a program and the runtime linker should be copied to /compat/linux. Any shared libraries opened by &linux; programs run under &os; will look in this directory first. For example, if a &linux; program loads /lib/libc.so, &os; will first try to open /compat/linux/lib/libc.so, and if that does not exist, it will then try /lib/libc.so. Shared libraries should be installed to /compat/linux/lib rather than to the paths that the &linux; ld.so reports. Generally, one will need to look for the shared libraries that &linux; binaries depend on only the first few times that a &linux; program is installed on &os;. After a while, there will be a sufficient set of &linux; shared libraries on the system to be able to run newly imported &linux; binaries without any extra work. How to Install Additional Shared Libraries shared libraries If the linux_base port is installed and an application still complains about missing shared libraries, there are two methods root can use to determine which shared libraries the &linux; binaries need. If a &linux; system is available, determine which shared libraries the application needs, and copy them to the &os; system. In this example, FTP was used to download the &linux; binary of Doom on a &linux; system . To check which shared libraries it needs, run ldd linuxdoom: &prompt.user; ldd linuxdoom libXt.so.3 (DLL Jump 3.1) => /usr/X11/lib/libXt.so.3.1.0 libX11.so.3 (DLL Jump 3.1) => /usr/X11/lib/libX11.so.3.1.0 libc.so.4 (DLL Jump 4.5pl26) => /lib/libc.so.4.6.29 symbolic links Copy all the files in the last column into /compat/linux on the &os; system, with the names in the first column as symbolic links pointing to them. This example will result in the following files on the &os; system: /compat/linux/usr/X11/lib/libXt.so.3.1.0 /compat/linux/usr/X11/lib/libXt.so.3 -> libXt.so.3.1.0 /compat/linux/usr/X11/lib/libX11.so.3.1.0 /compat/linux/usr/X11/lib/libX11.so.3 -> libX11.so.3.1.0 /compat/linux/lib/libc.so.4.6.29 /compat/linux/lib/libc.so.4 -> libc.so.4.6.29
If a &linux; shared library already exists with a matching major revision number to the first column of the ldd output, it does not need to be copied to the file named in the last column, as the existing library should work. It is advisable to copy the shared library if it is a newer version, though. The old one can be removed, as long as the symbolic link points to the new one. For example, these libraries exist on the system: /compat/linux/lib/libc.so.4.6.27 /compat/linux/lib/libc.so.4 -> libc.so.4.6.27 and a binary claims to require a later version according to the output of ldd: libc.so.4 (DLL Jump 4.5pl26) -> libc.so.4.6.29 If it is only one or two versions out of date in the trailing digit, do not worry about copying /lib/libc.so.4.6.29, because the program should work fine with the slightly older version. However, it is safe to replace the libc.so: /compat/linux/lib/libc.so.4.6.29 /compat/linux/lib/libc.so.4 -> libc.so.4.6.29
The symbolic link mechanism is only needed for &linux; binaries as the &os; runtime linker takes care of looking for matching major revision numbers.
Installing &linux; ELF Binaries Linux ELF binaries ELF binaries sometimes require an extra step of branding. If an unbranded ELF binary is executed, it will generate an error message like the following: &prompt.user; ./my-linux-elf-binary ELF binary type not known Abort To help the &os; kernel distinguish between a &os; ELF binary and a &linux; binary, use &man.brandelf.1;: &prompt.user; brandelf -t Linux my-linux-elf-binary GNU toolchain Since the GNU toolchain places the appropriate branding information into ELF binaries automatically, this step is usually not necessary. Installing a &linux; RPM Based Application &os; uses its own package database to track all software installed from the Ports Collection. However, the &linux; RPM database is not supported. In order to install a &linux; RPM-based application, first install the archivers/rpm2cpio package or port. Once installed, root can use this command to install a .rpm as follows: &prompt.root; cd /compat/linux &prompt.root; rpm2cpio -q < /path/to/linux.archive.rpm | cpio -id If necessary, brandelf the installed ELF binaries, but not the libraries. Note that this will prevent a clean uninstall. Configuring the Hostname Resolver If DNS does not work or this error appears: resolv+: "bind" is an invalid keyword resolv+: "hosts" is an invalid keyword Configure /compat/linux/etc/host.conf as follows: order hosts, bind multi on This order specifies that /etc/hosts is searched first and DNS is searched second. When /compat/linux/etc/host.conf does not exist, &linux; applications use /etc/host.conf and complain about the incompatible &os; syntax. Remove bind if a name server is not configured using /etc/resolv.conf.
Boris Hollas Updated for Mathematica 5.X by Installing &mathematica; applications Mathematica This section describes the process of installing the &linux; version of &mathematica; 9.X onto a &os; system. &mathematica; is a commercial, computational software program used in scientific, engineering, and mathematical fields. A 30 day trial version is available for download from wolfram.com/mathematica. Running the &mathematica; Installer Before installing &mathematica;, make sure that the textproc/linux-f10-aspell package or port is installed and that the &man.linprocfs.5; file system is mounted. &prompt.root; sysctl kern.fallback_elf_brand=3 &os; will now assume that unbranded ELF binaries use the &linux; ABI which should allow the installer to execute from the CDROM. The downloaded file will be saved to /tmp/Mathematica_9.0.1_LINUX.sh. Become the superuser and run this installer file: &prompt.root; sh /tmp/Mathematica_9.0.1_LINUX.sh Mathematica Secured 9.0.1 for LINUX Installer Archive Verifying archive integrity. Extracting installer. ... Wolfram Mathematica 9 Installer Copyright (c) 1988-2013 Wolfram Research, Inc. All rights reserved. WARNING: Wolfram Mathematica is protected by copyright law and international treaties. Unauthorized reproduction or distribution may result in severe civil and criminal penalties and will be prosecuted to the maximum extent possible under law. Enter the installation directory, or press ENTER to select /usr/local/Wolfram/Mathematica/9.0: > Now installing... *********************** Installation complete. Running the &mathematica; Frontend over a Network &mathematica; uses some special fonts to display characters not present in any of the standard font sets. Xorg requires these fonts to be installed locally. This means that these fonts need to be copied from the CDROM or from a host with &mathematica; installed to the local machine. These fonts are normally stored in /cdrom/Unix/Files/SystemFiles/Fonts on the CDROM, or /usr/local/mathematica/SystemFiles/Fonts on the hard drive. The actual fonts are in the subdirectories Type1 and X. There are several ways to use them, as described below. The first way is to copy the fonts into one of the existing font directories in /usr/local/lib/X11/fonts then running &man.mkfontdir.1; within the directory containing the new fonts. The second way to do this is to copy the directories to /usr/local/lib/X11/fonts: &prompt.root; cd /usr/local/lib/X11/fonts &prompt.root; mkdir X &prompt.root; mkdir MathType1 &prompt.root; cd /cdrom/Unix/Files/SystemFiles/Fonts &prompt.root; cp X/* /usr/local/lib/X11/fonts/X &prompt.root; cp Type1/* /usr/local/lib/X11/fonts/MathType1 &prompt.root; cd /usr/local/lib/X11/fonts/X &prompt.root; mkfontdir &prompt.root; cd ../MathType1 &prompt.root; mkfontdir Now add the new font directories to the font path: &prompt.root; xset fp+ /usr/local/lib/X11/fonts/X &prompt.root; xset fp+ /usr/local/lib/X11/fonts/MathType1 &prompt.root; xset fp rehash When using the &xorg; server, these font directories can be loaded automatically by adding them to /etc/X11/xorg.conf. fonts If /usr/local/lib/X11/fonts/Type1 does not already exist, change the name of the MathType1 directory in the example above to Type1. -->