• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Requirements
2-------------------
3
4Tools are needed for LTP compilation. They should be available as a
5package in any Linux distribution (no specific version is required).
6
7Debian / Ubuntu
8# apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev
9
10OpenSUSE / SLES
11# zypper install gcc git make pkgconf autoconf automake bison flex m4 linux-glibc-devel glibc-devel
12
13Fedora / CentOS / RHEL
14# yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers
15
16These are minimal build requirements for git compilation. Some tests require
17extra development files of some libraries, see travis/*.sh. There is also
18support for other Linux distributions not listed here.
19
20autoconf, automake, m4 (autoconf requirement), git and pkgconf (or pkg-config
21on older distros) are required only for compilation from git (used for creating
22configure file).
23
24pkgconf is recommended also for compilation from tarball as it
25does automatic detection of some library support.
26
27GNU Bison / Berkeley Yacc is required for ltp-scanner.
28
29Configuration
30-------------------
31
32Configuration requires autoconf:
33
34	$ cd $TOP_SRCDIR
35	$ make autotools
36	$ mkdir -p $TOP_BUILDDIR
37	$ cd $TOP_BUILDDIR && ./configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
38
39- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
40- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
41
42See the In-build-tree and Out-of-build-tree sections below for more details on
43what to do next.
44
45Compiling LTP
46-------------------
47
48In-build-tree
49-------------------
50In-build-tree support is when you build binaries (applications, binary objects)
51in the same directory where the source files reside.
52
53	$ make all
54	$ make \
55	  "DESTDIR=$SYSROOT" \
56	  SKIP_IDCHECK=[0|1] \
57	  install
58
59- Specifying DESTDIR is optional, but required when installing to a non-host
60  sysroot, as opposed to the host system's sysroot.
61- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
62  on the target system's sysroot.
63
64If you get a build error, please report it to ltp@lists.linux.it with
65following information,
66
67 1. The error output before the failure.
68 2. If you used configure:
69	i.   include/config.h
70	ii.  include/mk/config.mk
71	iii. config.log
72
73Out-of-build-tree
74-------------------
75Out-of-build-tree support is when you build binaries (applications, binary
76objects, generated files) outside of the directory where the source files
77reside. This is typically used when cross-compiling for multiple targets.
78
79NOTE: This is by and large correctly implemented, but there are several corner
80cases, where this isn't implemented properly. Please see TODO for a list of
81items which need fixing in the LTP tree.
82
83	$ mkdir "$OUT_OF_BUILD_TREE_DIR"
84	$ make \
85	  -C "$OUT_OF_BUILD_TREE_DIR" \
86	  -f "$TOP_SRCDIR/Makefile" \
87	  "top_srcdir=$TOP_SRCDIR" \
88	  "top_builddir=$OUT_OF_BUILD_TREE_DIR"
89	$ make \
90	  -C "$OUT_OF_BUILD_TREE_DIR" \
91	  -f "$TOP_SRCDIR/Makefile" \
92	  "top_srcdir=$TOP_SRCDIR" \
93	  "top_builddir=$OUT_OF_BUILD_TREE_DIR" \
94	  "DESTDIR=$SYSROOT" \
95	  SKIP_IDCHECK=[0|1]
96	  install
97
98- Specifying DESTDIR is optional, but required when installing to a non-host
99  sysroot, as opposed to the host system's sysroot.
100- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
101  on the target system's sysroot.
102
103Quick Start
104-----------
105
1061> tar xzf ltp-XXXXXXXX.tar.gz
1072> cd ltp
1083> ./configure
1094> make all
1105> make install
1116> /opt/ltp/runltp
112
113*NOTE:
114- LTP assumes the existence of the nobody, bin, and daemon users and their
115groups.  If these IDs do not exist, certain tests will fail. The respective
116user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then
117its group ID should also be 99. The names of the groups are irrelevant.
118- The installation directory is /opt/ltp by default. Please see
119"Using autoconf" above and specify the appropriate path via --prefix.
120DESTDIR= is also honored for install and will install into $DESTDIR/$prefix,
121if you want to install into a chroot or a rootfs for instance.
122
123Detailed Installation
124---------------------
125
126Beyond the "Quick Start" instructions, there are only a few other things
127that should be done.  The Linux Test Project build process uses a
128minimalist approach.  There is a lot of room for improvement and
129contributions are welcome.
130
1311. Log in as root.
132
1332. Untar the ltp tarball into a spare directory.  There is not a
134   standard location for it yet.  We put it in our home directory
135   while we're working on it.
136   Note that the full path to this location must be accessible for
137   unprivileged users, as some tests are run as a different user than root.
138   Hence /root is not a good choice on several distributions.
139
1403. Build and install everything, as described above. Note the minimum software
141   requirements above before doing so.
142
1434. The disk I/O tests can be run by executing the diskio.sh script.  In order
144   for these tests to successfully operate a writable high-density 3.5" floppy
145   must be in the disk drive and a CD-ROM with more than 100Mb of data must be
146   in the CD-ROM drive.  The corresponding tests will fail if either disk is
147   missing.
148
1495. The network tests are executed by running the network.sh script. The network
150   tests require some configuration for them to work correctly:
151
152     i) First, there MUST be another test machine setup to act as the server
153	to these client side tests.  This machine MUST have the LTP installed
154	in the same exact location, i.e. if the client has /root/ltp, then the
155	server must have /root/ltp.  This is required because certain tests
156	expect to find server files in certain locations.  Make sure to compile
157	the LTP on this server machine also.
158
159    ii) Second, the server must be setup to allow the client to connect using
160	the "r" commands, such as rsh.  This is done by simply creating/editing
161	the ".rhosts" file under /root.  Place the hostname of the client
162	machine in this file to allow root to remotely connect without the use
163	of a password. If server has the PAM system security tool, you need
164	to add the following lines to /etc/securetty:
165		rlogin
166		rsh
167		rexec
168		pts/0
169		pts/1
170		  :
171		pts/9
172
173   iii) Next, certain services must be activated in order for certain tests to
174	execute.  The following services are activated via inetd/xinetd:
175		rlogind
176		ftpd
177		telnetd
178		echo (stream)
179		fingerd
180		rshd
181	 Also, because certain RPC programs are tested, the "portmapper" daemon
182	 MUST be started, as well as NFS server AND lock services.
183
184    iv) Finally, before running the network.sh script, two variables must be
185	set: The "RHOST" variable should be set to the hostname of the server.
186	The "PASSWD" variable should be set to root's password on the server
187	machine. This is necessary for tests such as telnet01.sh and ftp01.sh.
188
189   You can now successfully execute the network.sh script.
190
191   You can run the test category which you are interested in, -h option shows
192   the list of the test category:
193       # ./network.sh -h
194
195   For more info about howto run network.sh see testcases/network/README.md.
196
197Cross compiling
198---------------
199To cross compile, you must specify the correct variables when running configure.
200e.g. CC, LDFLAGS, etc.
201For correct pkgconf / pkg-config detection you need to set
202PKG_CONFIG_SYSROOT_DIR=$SYSROOT
203
204After configure has run, it will generate include/mk/config.mk. You can tweak
205settings in there if need be, but you should not specificy settings on the
206command-line when running make.
207
20832 bit build on 64 bit machine
209------------------------------
210You need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR
211
212* RPM based distributions (openSUSE, Fedora, etc.)
213PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
214
215* Debian / Ubuntu and derivates
216PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
217
218* Arch Linux
219PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
220
221Android Users
222-------------
223Specify ANDROID=1 when calling make. Many tests which would otherwise work are
224currently not built because they share a directory with an incompatible test.
225
226The shell scripts expect /bin/sh to exist, so create a symlink.
227
228Variables in Makefile
229----------------------
230
231The conventions enforced are standard ones. Here's a quick summary:
232
233CFLAGS   - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
234
235CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
236	   functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
237
238LDFLAGS  - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
239	   PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
240
241LDLIBS   - libraries listed after objects during link, e.g. -lc, -lpthread,
242	   -lltp.
243
244For other variables and more info about the build systems see
245doc/build-system-guide.txt.
246
247Common Issues
248----------------------
249
250Issue:    When executing configure it says:
251
252checking for a BSD-compatible install... /usr/bin/install -c
253checking whether build environment is sane... yes
254checking for gawk... gawk
255checking whether make sets $(MAKE)... yes
256configure: error: cannot run /bin/sh ./config.sub
257
258Solution: 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.
259
260Issue:    When executing make [all] it says:
261
262    " *** No rule to make target `/$*', needed by `pan-all'.  Stop."
263
264Solution: You must upgrade to make 3.81. Please see the Requirements section above.
265
266Issue:    When executing make [all] it says something like:
267
268    # ...
269    install -m 00644 "/scratch/ltp-dev2/ltp/include/test.h" "/scratch/ltp-install12/include/test.h"
270    install -m 00644 "/scratch/ltp-dev2/ltp/include/tlibio.h" "/scratch/ltp-install12/include/tlibio.h"
271    install -m 00644 "/scratch/ltp-dev2/ltp/include/usctest.h" "/scratch/ltp-install12/include/usctest.h"
272    install -m 00644 "/scratch/ltp-dev2/ltp/include/write_log.h" "/scratch/ltp-install12/include/write_log.h"
273    make[1]: Leaving directory `/scratch/ltp-dev2/ltp/include'
274    make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
275    make[1]: Entering directory `/scratch/ltp-dev2/ltp/lib'
276    " *** No rule to make target `dataascii.o', needed by `libltp.a'.  Stop." # <-- the error
277
278Solution: You cannot build LTP with -r / --no-builtin-rules and/or
279	  -R / --no-builtin-variables specified. LTP relies heavily on built-in
280	  implicit rules and variables to function properly.
281
282Issue:    When executing make (no target, 3.80), it does the following, and doesn't execute all:
283
284    #
285    make -C testcases/realtime autotools
286    make[1]: Entering directory `/scratch/ltp/testcases/realtime'
287    autoheader
288    make[1]: Leaving directory `/scratch/ltp/testcases/realtime'
289