1 .\" $NetBSD: compat_freebsd.8,v 1.12 2001/12/26 01:11:51 wiz Exp $
2 .\" from: compat_linux.8,v 1.1 1995/03/05 23:30:36 fvdl Exp
4 .\" Copyright (c) 1995 Frank van der Linden
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed for the NetBSD Project
18 .\" by Frank van der Linden
19 .\" 4. The name of the author may not be used to endorse or promote products
20 .\" derived from this software without specific prior written permission
22 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 .Nd setup procedure for running FreeBSD binaries
44 Most binaries should work, except programs that use
47 These include i386-specific calls, such as syscons utilities.
50 compatibility feature is active for kernels compiled
55 A lot of programs are dynamically linked. This means, that you will
58 shared libraries that the program depends on, and the runtime
59 linker. Also, you will need to create a
65 system. This directory
68 Any file operations done by
72 will look in this directory first.
75 program opens, for example,
80 .Pa /emul/freebsd/etc/passwd ,
81 and if that does not exist open the
85 It is recommended that you install
87 packages that include configuration files, etc under
89 to avoid naming conflicts with possible
92 libraries should also be installed in the shadow tree.
94 Generally, you will need to look for the shared libraries that
96 binaries depend on only the first few times that you install a
100 system. After a while, you will have a sufficient set of
102 shared libraries on your system to be able to run newly imported
104 binaries without any extra work.
105 .Ss Setting up shared libraries
106 How to get to know which shared libraries
108 binaries need, and where
109 to get them? Basically, there are 2 possibilities (when following
110 these instructions: you will need to be root on your
112 system to do the necessary installation steps).
119 In this case you can temporarily install the binary there, see what
120 shared libraries it needs, and copy them to your
123 Example: you have just ftp-ed the
128 system you have access to, and check which shared libraries it
132 .Bl -tag -width 123 -compact -offset indent
133 .It me@freebsd% ldd /usr/local/lib/SimCity/res/sim
135 /usr/local/lib/SimCity/res/sim:
136 -lXext.6 =\*[Gt] /usr/X11R6/lib/libXext.so.6.0 (0x100c1000)
137 -lX11.6 =\*[Gt] /usr/X11R6/lib/libX11.so.6.0 (0x100c9000)
138 -lc.2 =\*[Gt] /usr/lib/libc.so.2.1 (0x10144000)
139 -lm.2 =\*[Gt] /usr/lib/libm.so.2.0 (0x101a7000)
140 -lgcc.261 =\*[Gt] /usr/lib/libgcc.so.261.0 (0x101bf000)
144 You would need go get all the files from the last column, and
147 This means you eventually have these files on your
152 .Pa /emul/freebsd/usr/X11R6/lib/libXext.so.6.0
154 .Pa /emul/freebsd/usr/X11R6/lib/libX11.so.6.0
156 .Pa /emul/freebsd/usr/lib/libc.so.2.1
158 .Pa /emul/freebsd/usr/lib/libm.so.2.0
160 .Pa /emul/freebsd/usr/lib/libgcc.so.261.0
163 Note that if you already have a
165 shared library with a matching major revision number to the first
168 output, you won't need to copy the file named
169 in the last column to your system, the one you already have should
171 It is advisable to copy the shared library anyway if it is a newer version,
173 You can remove the old one.
174 So, if you have these libraries on your system:
177 .Pa /emul/freebsd/usr/lib/libc.so.2.0
180 and you find that the ldd output for a new binary you want to
184 \-lc.2 =\*[Gt] /usr/lib/libc.so.2.1 (0x10144000)
187 You won't need to worry about copying
188 .Pa /usr/lib/libc.so.2.1
189 too, because the program should work fine with the slightly older version.
190 You can decide to replace the libc.so anyway, and that should leave
194 .Pa /emul/freebsd/usr/lib/libc.so.2.1
197 Finally, you must make sure that you have the
199 runtime linker and its config files on your system.
200 You should copy these files from the
202 system to their appropriate place on your
209 .Pa usr/libexec/ld.so
211 .Pa var/run/ld.so.hints
214 You don't have access to a
216 system. In that case, you
217 should get the extra files you need from various ftp sites.
218 Information on where to look for the various files is appended
219 below. For now, let's assume you know where to get the files.
221 Retrieve the following files (from _one_ ftp site to avoid
222 any version mismatches), and install them under
227 .Pa /emul/freebsd/foo/bar ) :
234 .Pa usr/lib/libc.so.x.y.z
236 .Pa usr/libexec/ld.so
242 don't necessarily need to be under
244 you can install them elsewhere in the system too. Just make sure
245 they don't conflict with their
248 A good idea would be to install them in
257 ldconfig program with directory arguments in which the
259 runtime linker should look for shared libs.
261 are standard, you could run like the following:
263 .Bl -tag -width 123 -compact -offset indent
264 .It me@netbsd% mkdir -p /emul/freebsd/var/run
265 .It me@netbsd% touch /emul/freebsd/var/run/ld.so.hints
266 .It me@netbsd% ldconfig-freebsd /usr/X11R6/lib /usr/local/lib
269 Note that argument directories of ldconfig are
271 .Pa /emul/freebsd/XXXX
274 compat code, and should exist as such on your system.
276 .Pa /emul/freebsd/var/run/ld.so.hints
277 is existing when you run
279 ldconfig, if not, you may lose
281 .Pa /var/run/ld.so.hints .
285 linked, so it doesn't need any shared libraries by itself.
286 It will create the file
287 .Pa /emul/freebsd/var/run/ld.so.hints .
290 version of the ldconfig program each time you add a new shared library.
292 You should now be set up for
294 binaries which only need a shared libc.
295 You can test this by running the
298 on itself. Suppose that you have it installed as
300 it should produce something like:
302 .Bl -tag -width 123 -compact -offset indent
303 .It me@netbsd% ldd-freebsd `which ldd-freebsd`
305 /usr/local/bin/ldd-freebsd:
306 -lc.2 =\*[Gt] /usr/lib/libc.so.2.1 (0x1001a000)
310 This being done, you are ready to install new
313 Whenever you install a new
315 program, you should check if it needs shared libraries, and if so,
316 whether you have them installed in the
319 To do this, you run the
323 on the new program, and watch its output.
325 (see also the manual page for
328 of shared libraries that the program depends on, in the
329 form -l\*[Lt]majorname\*[Gt] =\*[Gt] \*[Lt]fullname\*[Gt].
333 instead of \*[Lt]fullname\*[Gt] it means that you need an extra library.
334 Which library this is, is shown
335 in \*[Lt]majorname\*[Gt], which will be of the form XXXX.\*[Lt]N\*[Gt]
336 You will need to find a libXXXX.so.\*[Lt]N\*[Gt].\*[Lt]mm\*[Gt] on a
338 ftp site, and install it on your system.
339 The XXXX (name) and \*[Lt]N\*[Gt] (major
340 revision number) should match; the minor number(s) \*[Lt]mm\*[Gt] are
341 less important, though it is advised to take the most
347 binary needs access to certain device file.
350 X server software needs
353 for ioctls. In this case, create a symbolic link from
354 .Pa /emul/freebsd/dev/ttyv0
359 You will need to have at least
360 .Cd options WSDISPLAY_COMPAT_SYSCONS
362 .Cd options WSDISPLAY_COMPAT_USL
368 .Ss Finding the necessary files
370 the information below is valid as of the time this
371 document was written (June, 1995), but certain details
372 such as names of ftp sites, directories and distribution names
373 may have changed by the time you read this.
377 distribution is available on a lot of ftp sites.
378 Sometimes the files are unpacked, and you can get the individual
379 files you need, but mostly they are stored in distribution sets,
380 usually consisting of subdirectories with gzipped tar files in them.
381 The primary ftp sites for the distributions are:
382 .Bl -item -compact -offset indent
384 .Pa ftp.freebsd.org:/pub/FreeBSD
387 Mirror sites are described on:
388 .Bl -item -compact -offset indent
390 .Pa ftp.freebsd.org:/pub/FreeBSD/MIRROR.SITES
393 This distribution consists of a number of tar-ed and gzipped files,
394 Normally, they're controlled by an install program, but you can
397 too. The way to look something up is to retrieve all the files in the
398 distribution, and ``tar ztvf'' through them for the file you need.
399 Here is an example of a list of files that you might need.
401 .Bd -literal -offset indent
404 ld.so 2.0-RELEASE/bindist/bindist.??
405 ldconfig 2.0-RELEASE/bindist/bindist.??
406 ldd 2.0-RELEASE/bindist/bindist.??
407 libc.so.2 2.0-RELEASE/bindist/bindist.??
408 libX11.so.6.0 2.0-RELEASE/XFree86-3.1/XFree86-3.1-bin.tar.gz
409 libX11.so.6.0 XFree86-3.1.1/X311bin.tgz
410 libXt.so.6.0 2.0-RELEASE/XFree86-3.1/XFree86-3.1-bin.tar.gz
411 libXt.so.6.0 XFree86-3.1.1/X311bin.tgz
412 .\" libX11.so.3 oldlibs
413 .\" libXt.so.3 oldlibs
418 are tar-ed, gzipped and split, so you can extract contents by
419 .Dq cat bindist.?? | tar zpxf - .
421 Extract the files from these gzipped tarfiles in your
423 directory (possibly omitting or afterwards removing files you don't
424 need), and you are done.
426 The information about
428 distributions may become outdated.