1$Id: INSTALL,v 1.36 2010/01/18 23:46:09 yaberauneya Exp $
2
3Requirements
4-------------------
5
61. In order to compile ltp you must have make 3.80+ (make 3.81 preferred).
72. In order to compile and use ltp-scanner (a utility in the pan directory),
8   you must have bison/yacc, and flex installed.
9
10bison can be obtained here:
11- http://ftp.gnu.org/gnu/bison/bison-2.4.1.tar.gz
12
13Berkeley yacc can be obtained here:
14- ftp://invisible-island.net/byacc/byacc.tar.gz
15
16flex can be obtained here:
17- http://downloads.sourceforge.net/project/flex/flex/flex-2.5.33/flex-2.5.33.tar.bz2
18
19make 3.81 can be obtained here:
20- http://ftp.gnu.org/gnu/make/make-3.81.tar.bz2
21
22If you want to use auto configuration, be sure autoconf-2.61+ & automake-1.10+
23are installed.
24
25automake-1.10.2's sources can be downloaded from:
26- ftp://ftp.gnu.org/gnu/automake/automake-1.10.2.tar.bz2
27- ftp://ftp.gnu.org/gnu/automake/automake-1.10.2.tar.gz
28
29autoconf-2.61's sources can be downloaded from:
30- ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2
31- ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz
32
33autoconf-2.61 also requires m4-1.4.7+ be installed. Its sources can be
34downloaded from:
35- http://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.bz2
36- http://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.gz
37
38Configuration
39-------------------
40
41Configuration requires autoconf:
42
43	$ cd $TOP_SRCDIR
44	$ make autotools
45	$ mkdir -p $TOP_BUILDDIR
46	$ cd $TOP_BUILDDIR && ./configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
47
48- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
49- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
50
51See the In-build-tree and Out-of-build-tree sections below for more details on
52what to do next.
53
54Compiling LTP
55-------------------
56
57"What's in a Path?"
58-------------------
59
60Before getting started, you should make sure that your build directory and
61source directory are as basic as possible: no commas, colons, semicolons,
62spaces, etc. In fact, this is a relatively good rule of thumb when dealing
63with any [Gnu?] make based opensource project.
64
65We won't `fix' the `issues' associated with these particular set of build
66errors resulting from non-sane pathnames, because it would introduce unneeded
67complexity into the build system and would require non-trivial effort to fix
68and validate the third-party packages, and thus wouldn't be a sustainable
69model to follow.
70
71So, we apologize for the inconvenience, but using other characters like
72underscores and dashes should help when disambiguating words between build
73and source pathnames.
74
75In-build-tree
76-------------------
77In-build-tree support is when you build binaries (applications, binary objects)
78in the same directory where the source files reside.
79
80	$ make all
81	$ make \
82	  "DESTDIR=$SYSROOT" \
83	  SKIP_IDCHECK=[0|1] \
84	  install
85
86- Specifying DESTDIR is optional, but required when installing to a non-host
87  sysroot, as opposed to the host system's sysroot.
88- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
89  on the target system's sysroot.
90
91If you get a build error, please report it to ltp@lists.linux.it with
92following information,
93
94 1. The error output before the failure.
95 2. If you used configure:
96	i.   include/config.h
97	ii.  include/mk/config.mk
98	iii. config.log
99
100Out-of-build-tree
101-------------------
102Out-of-build-tree support is when you build binaries (applications, binary
103objects, generated files) outside of the directory where the source files
104reside. This is typically used when cross-compiling for multiple targets.
105
106NOTE: This is by and large correctly implemented, but there are several corner
107cases, where this isn't implemented properly. Please see TODO for a list of
108items which need fixing in the LTP tree.
109
110	$ mkdir "$OUT_OF_BUILD_TREE_DIR"
111	$ make \
112	  -C "$OUT_OF_BUILD_TREE_DIR" \
113	  -f "$TOP_SRCDIR/Makefile" \
114	  "top_srcdir=$TOP_SRCDIR" \
115	  "top_builddir=$OUT_OF_BUILD_TREE_DIR"
116	$ make \
117	  -C "$OUT_OF_BUILD_TREE_DIR" \
118	  -f "$TOP_SRCDIR/Makefile" \
119	  "top_srcdir=$TOP_SRCDIR" \
120	  "top_builddir=$OUT_OF_BUILD_TREE_DIR" \
121	  "DESTDIR=$SYSROOT" \
122	  SKIP_IDCHECK=[0|1]
123	  install
124
125- Specifying DESTDIR is optional, but required when installing to a non-host
126  sysroot, as opposed to the host system's sysroot.
127- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
128  on the target system's sysroot.
129
130Quick Start
131-----------
132
1331> tar xzf ltp-XXXXXXXX.tar.gz
1342> cd ltp
1353> ./configure
1364> make all
1375> make install
1386> /opt/ltp/runltp
139
140*NOTE:
141- LTP assumes the existence of the nobody, bin, and daemon users and their
142groups.  If these IDs do not exist, certain tests will fail. The respective
143user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then
144its group ID should also be 99. The names of the groups are irrelevant.
145- The installation directory is /opt/ltp by default. Please see
146"Using autoconf" above and specify the appropriate path via --prefix.
147DESTDIR= is also honored for install and will install into $DESTDIR/$prefix,
148if you want to install into a chroot or a rootfs for instance.
149
150Detailed Installation
151---------------------
152
153Beyond the "Quick Start" instructions, there are only a few other things
154that should be done.  The Linux Test Project build process uses a
155minimalist approach.  There is a lot of room for improvement and
156contributions are welcome.
157
1581. Log in as root.
159
1602. Untar the ltp tarball into a spare directory.  There is not a
161   standard location for it yet.  We put it in our home directory
162   while we're working on it.
163   Note that the full path to this location must be accessible for
164   unprivileged users, as some tests are run as a different user than root.
165   Hence /root is not a good choice on several distributions.
166
1673. Build and install everything, as described above. Note the minimum software
168   requirements above before doing so.
169
1704. The disk I/O tests can be run by executing the diskio.sh script.  In order
171   for these tests to successfully operate a writable high-density 3.5" floppy
172   must be in the disk drive and a CD-ROM with more than 100Mb of data must be
173   in the CD-ROM drive.  The corresponding tests will fail if either disk is
174   missing.
175
1765. The network tests are executed by running the network.sh script. The network
177   tests require some configuration for them to work correctly:
178
179     i) First, there MUST be another test machine setup to act as the server
180	to these client side tests.  This machine MUST have the LTP installed
181	in the same exact location, i.e. if the client has /root/ltp, then the
182	server must have /root/ltp.  This is required because certain tests
183	expect to find server files in certain locations.  Make sure to compile
184	the LTP on this server machine also.
185
186    ii) Second, the server must be setup to allow the client to connect using
187	the "r" commands, such as rsh.  This is done by simply creating/editing
188	the ".rhosts" file under /root.  Place the hostname of the client
189	machine in this file to allow root to remotely connect without the use
190	of a password. If server has the PAM system security tool, you need
191	to add the following lines to /etc/securetty:
192		rlogin
193		rsh
194		rexec
195		pts/0
196		pts/1
197		  :
198		pts/9
199
200   iii) Next, certain services must be activated in order for certain tests to
201	execute.  The following services are activated via inetd/xinetd:
202		rlogind
203		ftpd
204		telnetd
205		echo (stream)
206		fingerd
207		rshd
208	 Also, because certain RPC programs are tested, the "portmapper" daemon
209	 MUST be started, as well as NFS server AND lock services.
210
211    iv) Finally, before running the network.sh script, two variables must be
212	set: The "RHOST" variable should be set to the hostname of the server.
213	The "PASSWD" variable should be set to root's password on the server
214	machine. This is necessary for tests such as telnet01.sh and ftp01.sh.
215
216   You can now successfully execute the network.sh script.
217
218   You can run the test category which you are interested in, -h option shows
219   the list of the test category:
220       # ./network.sh -h
221
222   For more info about howto run network.sh see testcases/network/README.md.
223
224Cross compiling
225---------------
226
227To cross compile, you must specify the correct variables when running configure.
228e.g. CC, LDFLAGS, etc...
229
230After configure has run, it will generate include/mk/config.mk. You can tweak
231settings in there if need be, but you should not specificy settings on the
232command-line when running make.
233
234uClinux Users
235--------------
236Specify UCLINUX=1 when calling make; -DUCLINUX=1 use is deprecated and highly
237discouraged.
238
239Android Users
240-------------
241Specify ANDROID=1 when calling make. Many tests which would otherwise work are
242currently not built because they share a directory with an incompatible test.
243
244The shell scripts expect /bin/sh to exist, so create a symlink.
245
246Variables in Makefile
247----------------------
248
249The conventions enforced are standard ones. Here's a quick summary:
250
251CFLAGS   - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
252
253CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
254	   functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
255
256LDFLAGS  - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
257	   PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
258
259LDLIBS   - libraries listed after objects during link, e.g. -lc, -lpthread,
260	   -lltp.
261
262See README.mk-devel for a more terse description of what's available.
263
264Common Issues
265----------------------
266
267Issue:    When executing configure it says:
268
269checking for a BSD-compatible install... /usr/bin/install -c
270checking whether build environment is sane... yes
271checking for gawk... gawk
272checking whether make sets $(MAKE)... yes
273configure: error: cannot run /bin/sh ./config.sub
274
275Solution: You must upgrade autoconf to 0.10.2+ and m4 to 1.4.7+; config.guess and config.sub aren't necessarily generated with older revisions of the Gnu autotools chain.
276
277Issue:    When executing make [all] it says:
278
279    " *** No rule to make target `/$*', needed by `pan-all'.  Stop."
280
281Solution: You must upgrade to make 3.81. Please see the Requirements section above.
282
283Issue:    When executing make [all] it says something like:
284
285    # ...
286    install -m 00644 "/scratch/ltp-dev2/ltp/include/test.h" "/scratch/ltp-install12/include/test.h"
287    install -m 00644 "/scratch/ltp-dev2/ltp/include/tlibio.h" "/scratch/ltp-install12/include/tlibio.h"
288    install -m 00644 "/scratch/ltp-dev2/ltp/include/usctest.h" "/scratch/ltp-install12/include/usctest.h"
289    install -m 00644 "/scratch/ltp-dev2/ltp/include/write_log.h" "/scratch/ltp-install12/include/write_log.h"
290    make[1]: Leaving directory `/scratch/ltp-dev2/ltp/include'
291    make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
292    make[1]: Entering directory `/scratch/ltp-dev2/ltp/lib'
293    " *** No rule to make target `dataascii.o', needed by `libltp.a'.  Stop." # <-- the error
294
295Solution: You cannot build LTP with -r / --no-builtin-rules and/or
296	  -R / --no-builtin-variables specified. LTP relies heavily on built-in
297	  implicit rules and variables to function properly.
298
299Issue:    When executing make (no target, 3.80), it does the following, and doesn't execute all:
300
301    #
302    make -C testcases/realtime autotools
303    make[1]: Entering directory `/scratch/ltp/testcases/realtime'
304    autoheader
305    make[1]: Leaving directory `/scratch/ltp/testcases/realtime'
306