blob: 120f030b5382073f4c2b21135f7dcbd2cf04df37 [file] [log] [blame]
yaberauneya2d8710f2009-10-25 06:35:08 +00001Requirements
subrata_modakaba85b92008-12-11 10:30:33 +00002-------------------
yaberauneyafbc90452009-11-06 18:21:37 +00003
Petr Voreldfda9ec2020-05-14 19:34:48 +02004Tools are needed for LTP compilation. They should be available as a
5package in any Linux distribution (no specific version is required).
subrata_modak3960cc82009-01-20 10:47:29 +00006
Petr Voreldfda9ec2020-05-14 19:34:48 +02007Debian / Ubuntu
8# apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev
subrata_modak16147ad2009-01-21 11:30:52 +00009
Petr Voreldfda9ec2020-05-14 19:34:48 +020010OpenSUSE / SLES
11# zypper install gcc git make pkgconf autoconf automake bison flex m4 linux-glibc-devel glibc-devel
subrata_modak16147ad2009-01-21 11:30:52 +000012
Petr Voreldfda9ec2020-05-14 19:34:48 +020013Fedora / CentOS / RHEL
14# yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers
subrata_modak3960cc82009-01-20 10:47:29 +000015
Petr Voreldfda9ec2020-05-14 19:34:48 +020016These 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.
yaberauneya4f493d82009-11-03 16:12:12 +000019
Petr Voreldfda9ec2020-05-14 19:34:48 +020020autoconf, 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).
yaberauneya2d8710f2009-10-25 06:35:08 +000023
Petr Voreldfda9ec2020-05-14 19:34:48 +020024pkgconf is recommended also for compilation from tarball as it
25does automatic detection of some library support.
yaberauneya2d8710f2009-10-25 06:35:08 +000026
Petr Voreldfda9ec2020-05-14 19:34:48 +020027GNU Bison / Berkeley Yacc is required for ltp-scanner.
Petr Vorelb0098242020-03-17 19:58:19 +010028
yaberauneyabf3aeec2009-11-07 01:30:29 +000029Configuration
yaberauneya2d8710f2009-10-25 06:35:08 +000030-------------------
Mike Frysingere168ad22014-06-18 01:55:46 -040031
Petr Vorel400ac9b2019-11-04 07:31:41 +010032Configuration requires autoconf:
yaberauneya2d8710f2009-10-25 06:35:08 +000033
Petr Vorel400ac9b2019-11-04 07:31:41 +010034 $ 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
yaberauneya2d8710f2009-10-25 06:35:08 +000038
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
Petr Vorel400ac9b2019-11-04 07:31:41 +010043what to do next.
yaberauneya2d8710f2009-10-25 06:35:08 +000044
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
Garrett Coopere5387ce2010-08-18 02:00:52 -070053 $ make all
54 $ make \
yaberauneya2d8710f2009-10-25 06:35:08 +000055 "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.
subrata_modakaba85b92008-12-11 10:30:33 +000063
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +020064If you get a build error, please report it to ltp@lists.linux.it with
subrata_modak40455172009-01-05 08:35:21 +000065following information,
66
yaberauneya2d8710f2009-10-25 06:35:08 +000067 1. The error output before the failure.
68 2. If you used configure:
Mike Frysingere168ad22014-06-18 01:55:46 -040069 i. include/config.h
yaberauneya2d8710f2009-10-25 06:35:08 +000070 ii. include/mk/config.mk
71 iii. config.log
subrata_modak40455172009-01-05 08:35:21 +000072
yaberauneya2d8710f2009-10-25 06:35:08 +000073Out-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.
subrata_modak40455172009-01-05 08:35:21 +000078
yaberauneya2d8710f2009-10-25 06:35:08 +000079NOTE: This is by and large correctly implemented, but there are several corner
Garrett Cooperc41bb212010-02-24 13:24:15 -080080cases, where this isn't implemented properly. Please see TODO for a list of
81items which need fixing in the LTP tree.
subrata_modakaba85b92008-12-11 10:30:33 +000082
yaberauneya2d8710f2009-10-25 06:35:08 +000083 $ 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.
alaffine15dd682000-05-08 20:31:30 +0000102
nstraz0312c252000-09-26 20:59:21 +0000103Quick Start
104-----------
whrb973f2b2000-05-05 19:34:50 +0000105
robbiew57404482001-09-19 16:11:23 +00001061> tar xzf ltp-XXXXXXXX.tar.gz
nstraz0312c252000-09-26 20:59:21 +00001072> cd ltp
yaberauneyabf3aeec2009-11-07 01:30:29 +00001083> ./configure
1094> make all
1105> make install
Garrett Cooperc41bb212010-02-24 13:24:15 -08001116> /opt/ltp/runltp
whrb973f2b2000-05-05 19:34:50 +0000112
yaberauneya934df0e2010-01-07 10:43:24 +0000113*NOTE:
114- LTP assumes the existence of the nobody, bin, and daemon users and their
Garrett Cooperc41bb212010-02-24 13:24:15 -0800115groups. 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.
whrb973f2b2000-05-05 19:34:50 +0000122
nstraz0312c252000-09-26 20:59:21 +0000123Detailed 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
robbiewb6c5fe72001-09-18 20:44:30 +00001311. Log in as root.
132
1332. Untar the ltp tarball into a spare directory. There is not a
robbiewfc0708b2004-03-01 22:16:02 +0000134 standard location for it yet. We put it in our home directory
robbiew0eea3522004-02-05 17:33:10 +0000135 while we're working on it.
subrata_modakf43b3802009-08-28 05:33:40 +0000136 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.
nstraz0312c252000-09-26 20:59:21 +0000139
yaberauneya2d8710f2009-10-25 06:35:08 +00001403. Build and install everything, as described above. Note the minimum software
141 requirements above before doing so.
nstraz0312c252000-09-26 20:59:21 +0000142
Xiao Yang3b3a8422016-11-14 17:55:09 +08001434. The disk I/O tests can be run by executing the diskio.sh script. In order
robbiewba422042001-09-19 15:25:43 +0000144 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.
nstraz0312c252000-09-26 20:59:21 +0000148
Xiao Yang3b3a8422016-11-14 17:55:09 +08001495. The network tests are executed by running the network.sh script. The network
Petr Vorel751785e2016-11-10 12:54:39 +0100150 tests require some configuration for them to work correctly:
robbiewba422042001-09-19 15:25:43 +0000151
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
robbiew0eea3522004-02-05 17:33:10 +0000159 ii) Second, the server must be setup to allow the client to connect using
subrata_modak08978d22008-12-18 04:58:57 +0000160 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
robbiewba422042001-09-19 15:25:43 +0000172
robbiew0eea3522004-02-05 17:33:10 +0000173 iii) Next, certain services must be activated in order for certain tests to
robbiewba422042001-09-19 15:25:43 +0000174 execute. The following services are activated via inetd/xinetd:
175 rlogind
176 ftpd
177 telnetd
178 echo (stream)
179 fingerd
180 rshd
subrata_modak08978d22008-12-18 04:58:57 +0000181 Also, because certain RPC programs are tested, the "portmapper" daemon
182 MUST be started, as well as NFS server AND lock services.
robbiewba422042001-09-19 15:25:43 +0000183
Petr Vorel751785e2016-11-10 12:54:39 +0100184 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
Petr Vorel5e69bdf2019-08-01 10:34:25 +0200187 machine. This is necessary for tests such as telnet01.sh and ftp01.sh.
robbiewba422042001-09-19 15:25:43 +0000188
Petr Vorel751785e2016-11-10 12:54:39 +0100189 You can now successfully execute the network.sh script.
subrata_modak08978d22008-12-18 04:58:57 +0000190
191 You can run the test category which you are interested in, -h option shows
192 the list of the test category:
Petr Vorel751785e2016-11-10 12:54:39 +0100193 # ./network.sh -h
vapier36ab22f2009-01-19 03:37:35 +0000194
Petr Vorel751785e2016-11-10 12:54:39 +0100195 For more info about howto run network.sh see testcases/network/README.md.
vapier36ab22f2009-01-19 03:37:35 +0000196
197Cross compiling
198---------------
Mike Frysingere168ad22014-06-18 01:55:46 -0400199To cross compile, you must specify the correct variables when running configure.
Petr Vorel6890f372020-05-14 20:32:39 +0200200e.g. CC, LDFLAGS, etc.
201For correct pkgconf / pkg-config detection you need to set
202PKG_CONFIG_SYSROOT_DIR=$SYSROOT
vapier36ab22f2009-01-19 03:37:35 +0000203
Mike Frysingere168ad22014-06-18 01:55:46 -0400204After 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.
vapier36ab22f2009-01-19 03:37:35 +0000207
Petr Vorel6890f372020-05-14 20:32:39 +020020832 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
Steven Jackson34a7c822017-01-16 16:41:07 +0000221Android 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
vapier36ab22f2009-01-19 03:37:35 +0000228Variables in Makefile
229----------------------
230
yaberauneya2d8710f2009-10-25 06:35:08 +0000231The conventions enforced are standard ones. Here's a quick summary:
vapier36ab22f2009-01-19 03:37:35 +0000232
yaberauneya2d8710f2009-10-25 06:35:08 +0000233CFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
vapier36ab22f2009-01-19 03:37:35 +0000234
yaberauneya2d8710f2009-10-25 06:35:08 +0000235CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
Garrett Coopere5387ce2010-08-18 02:00:52 -0700236 functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
vapier36ab22f2009-01-19 03:37:35 +0000237
yaberauneya2d8710f2009-10-25 06:35:08 +0000238LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
Garrett Coopere5387ce2010-08-18 02:00:52 -0700239 PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
vapier36ab22f2009-01-19 03:37:35 +0000240
yaberauneya2d8710f2009-10-25 06:35:08 +0000241LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread,
Garrett Coopere5387ce2010-08-18 02:00:52 -0700242 -lltp.
vapier36ab22f2009-01-19 03:37:35 +0000243
Petr Vorel04d0e522020-05-14 20:41:53 +0200244For other variables and more info about the build systems see
245doc/build-system-guide.txt.
yaberauneya9079a9f2009-11-05 08:38:40 +0000246
247Common Issues
248----------------------
249
yaberauneyacef79622009-11-12 11:57:37 +0000250Issue: 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
yaberauneya44cac8e2009-11-12 12:08:09 +0000258Solution: 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.
yaberauneyacef79622009-11-12 11:57:37 +0000259
yaberauneya9079a9f2009-11-05 08:38:40 +0000260Issue: 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'
Chris Dearman37550cf2012-10-17 19:54:01 -0700274 make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
yaberauneya9079a9f2009-11-05 08:38:40 +0000275 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
Garrett Coopere5387ce2010-08-18 02:00:52 -0700279 -R / --no-builtin-variables specified. LTP relies heavily on built-in
280 implicit rules and variables to function properly.
yaberauneya340292d2010-01-18 23:46:09 +0000281
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'