blob: 52d61101e51619c19e92de87756f56e2af124f3a [file] [log] [blame]
yaberauneya2d8710f2009-10-25 06:35:08 +00001Requirements
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +02002------------
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
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +02008
9 # apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev
subrata_modak16147ad2009-01-21 11:30:52 +000010
Petr Voreldfda9ec2020-05-14 19:34:48 +020011OpenSUSE / SLES
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020012
13 # zypper install gcc git make pkgconf autoconf automake bison flex m4 linux-glibc-devel glibc-devel
subrata_modak16147ad2009-01-21 11:30:52 +000014
Petr Voreldfda9ec2020-05-14 19:34:48 +020015Fedora / CentOS / RHEL
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020016
17 # yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers
subrata_modak3960cc82009-01-20 10:47:29 +000018
Petr Voreldfda9ec2020-05-14 19:34:48 +020019These are minimal build requirements for git compilation. Some tests require
20extra development files of some libraries, see travis/*.sh. There is also
21support for other Linux distributions not listed here.
yaberauneya4f493d82009-11-03 16:12:12 +000022
Petr Voreldfda9ec2020-05-14 19:34:48 +020023autoconf, automake, m4 (autoconf requirement), git and pkgconf (or pkg-config
24on older distros) are required only for compilation from git (used for creating
25configure file).
yaberauneya2d8710f2009-10-25 06:35:08 +000026
Petr Voreldfda9ec2020-05-14 19:34:48 +020027pkgconf is recommended also for compilation from tarball as it
28does automatic detection of some library support.
yaberauneya2d8710f2009-10-25 06:35:08 +000029
Petr Voreldfda9ec2020-05-14 19:34:48 +020030GNU Bison / Berkeley Yacc is required for ltp-scanner.
Petr Vorelb0098242020-03-17 19:58:19 +010031
yaberauneyabf3aeec2009-11-07 01:30:29 +000032Configuration
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020033-------------
Mike Frysingere168ad22014-06-18 01:55:46 -040034
Petr Vorel400ac9b2019-11-04 07:31:41 +010035Configuration requires autoconf:
yaberauneya2d8710f2009-10-25 06:35:08 +000036
Petr Vorel400ac9b2019-11-04 07:31:41 +010037 $ cd $TOP_SRCDIR
38 $ make autotools
39 $ mkdir -p $TOP_BUILDDIR
Michał Kowalczykf8a2e6e2020-07-19 16:12:07 +020040 $ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
yaberauneya2d8710f2009-10-25 06:35:08 +000041
42- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
43- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
44
45See the In-build-tree and Out-of-build-tree sections below for more details on
Petr Vorel400ac9b2019-11-04 07:31:41 +010046what to do next.
yaberauneya2d8710f2009-10-25 06:35:08 +000047
48Compiling LTP
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020049-------------
yaberauneya2d8710f2009-10-25 06:35:08 +000050
51In-build-tree
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020052-------------
53
yaberauneya2d8710f2009-10-25 06:35:08 +000054In-build-tree support is when you build binaries (applications, binary objects)
55in the same directory where the source files reside.
56
Garrett Coopere5387ce2010-08-18 02:00:52 -070057 $ make all
58 $ make \
yaberauneya2d8710f2009-10-25 06:35:08 +000059 "DESTDIR=$SYSROOT" \
60 SKIP_IDCHECK=[0|1] \
61 install
62
63- Specifying DESTDIR is optional, but required when installing to a non-host
64 sysroot, as opposed to the host system's sysroot.
65- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
66 on the target system's sysroot.
subrata_modakaba85b92008-12-11 10:30:33 +000067
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +020068If you get a build error, please report it to ltp@lists.linux.it with
subrata_modak40455172009-01-05 08:35:21 +000069following information,
70
yaberauneya2d8710f2009-10-25 06:35:08 +000071 1. The error output before the failure.
72 2. If you used configure:
Mike Frysingere168ad22014-06-18 01:55:46 -040073 i. include/config.h
yaberauneya2d8710f2009-10-25 06:35:08 +000074 ii. include/mk/config.mk
75 iii. config.log
subrata_modak40455172009-01-05 08:35:21 +000076
yaberauneya2d8710f2009-10-25 06:35:08 +000077Out-of-build-tree
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +020078-----------------
79
yaberauneya2d8710f2009-10-25 06:35:08 +000080Out-of-build-tree support is when you build binaries (applications, binary
81objects, generated files) outside of the directory where the source files
82reside. This is typically used when cross-compiling for multiple targets.
subrata_modak40455172009-01-05 08:35:21 +000083
yaberauneya2d8710f2009-10-25 06:35:08 +000084NOTE: This is by and large correctly implemented, but there are several corner
Garrett Cooperc41bb212010-02-24 13:24:15 -080085cases, where this isn't implemented properly. Please see TODO for a list of
86items which need fixing in the LTP tree.
subrata_modakaba85b92008-12-11 10:30:33 +000087
yaberauneya2d8710f2009-10-25 06:35:08 +000088 $ mkdir "$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 $ make \
95 -C "$OUT_OF_BUILD_TREE_DIR" \
96 -f "$TOP_SRCDIR/Makefile" \
97 "top_srcdir=$TOP_SRCDIR" \
98 "top_builddir=$OUT_OF_BUILD_TREE_DIR" \
99 "DESTDIR=$SYSROOT" \
100 SKIP_IDCHECK=[0|1]
101 install
102
103- Specifying DESTDIR is optional, but required when installing to a non-host
104 sysroot, as opposed to the host system's sysroot.
105- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
106 on the target system's sysroot.
alaffine15dd682000-05-08 20:31:30 +0000107
nstraz0312c252000-09-26 20:59:21 +0000108Quick Start
109-----------
whrb973f2b2000-05-05 19:34:50 +0000110
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200111 $ tar xzf ltp-XXXXXXXX.tar.gz
112 $ cd ltp
113 $ ./configure
114 $ make all
115 # make install
116 $ /opt/ltp/runltp
whrb973f2b2000-05-05 19:34:50 +0000117
yaberauneya934df0e2010-01-07 10:43:24 +0000118*NOTE:
119- LTP assumes the existence of the nobody, bin, and daemon users and their
Garrett Cooperc41bb212010-02-24 13:24:15 -0800120groups. If these IDs do not exist, certain tests will fail. The respective
121user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then
122its group ID should also be 99. The names of the groups are irrelevant.
123- The installation directory is /opt/ltp by default. Please see
124"Using autoconf" above and specify the appropriate path via --prefix.
125DESTDIR= is also honored for install and will install into $DESTDIR/$prefix,
126if you want to install into a chroot or a rootfs for instance.
whrb973f2b2000-05-05 19:34:50 +0000127
nstraz0312c252000-09-26 20:59:21 +0000128Detailed Installation
129---------------------
130
131Beyond the "Quick Start" instructions, there are only a few other things
132that should be done. The Linux Test Project build process uses a
133minimalist approach. There is a lot of room for improvement and
134contributions are welcome.
135
robbiewb6c5fe72001-09-18 20:44:30 +00001361. Log in as root.
137
1382. Untar the ltp tarball into a spare directory. There is not a
robbiewfc0708b2004-03-01 22:16:02 +0000139 standard location for it yet. We put it in our home directory
robbiew0eea3522004-02-05 17:33:10 +0000140 while we're working on it.
subrata_modakf43b3802009-08-28 05:33:40 +0000141 Note that the full path to this location must be accessible for
142 unprivileged users, as some tests are run as a different user than root.
143 Hence /root is not a good choice on several distributions.
nstraz0312c252000-09-26 20:59:21 +0000144
yaberauneya2d8710f2009-10-25 06:35:08 +00001453. Build and install everything, as described above. Note the minimum software
146 requirements above before doing so.
nstraz0312c252000-09-26 20:59:21 +0000147
Xiao Yang3b3a8422016-11-14 17:55:09 +08001484. The disk I/O tests can be run by executing the diskio.sh script. In order
robbiewba422042001-09-19 15:25:43 +0000149 for these tests to successfully operate a writable high-density 3.5" floppy
150 must be in the disk drive and a CD-ROM with more than 100Mb of data must be
151 in the CD-ROM drive. The corresponding tests will fail if either disk is
152 missing.
nstraz0312c252000-09-26 20:59:21 +0000153
Petr Vorel09052012020-06-19 22:49:05 +02001545. The network tests related installation see testcases/network/README.md.
vapier36ab22f2009-01-19 03:37:35 +0000155
156Cross compiling
157---------------
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200158
Mike Frysingere168ad22014-06-18 01:55:46 -0400159To cross compile, you must specify the correct variables when running configure.
Petr Vorel6890f372020-05-14 20:32:39 +0200160e.g. CC, LDFLAGS, etc.
161For correct pkgconf / pkg-config detection you need to set
162PKG_CONFIG_SYSROOT_DIR=$SYSROOT
vapier36ab22f2009-01-19 03:37:35 +0000163
Mike Frysingere168ad22014-06-18 01:55:46 -0400164After configure has run, it will generate include/mk/config.mk. You can tweak
165settings in there if need be, but you should not specificy settings on the
166command-line when running make.
vapier36ab22f2009-01-19 03:37:35 +0000167
Petr Vorel6890f372020-05-14 20:32:39 +020016832 bit build on 64 bit machine
169------------------------------
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200170
Petr Vorel6890f372020-05-14 20:32:39 +0200171You need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR
172
173* RPM based distributions (openSUSE, Fedora, etc.)
174PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
175
176* Debian / Ubuntu and derivates
177PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
178
179* Arch Linux
180PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
181
Steven Jackson34a7c822017-01-16 16:41:07 +0000182Android Users
183-------------
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200184
Steven Jackson34a7c822017-01-16 16:41:07 +0000185Specify ANDROID=1 when calling make. Many tests which would otherwise work are
186currently not built because they share a directory with an incompatible test.
187
188The shell scripts expect /bin/sh to exist, so create a symlink.
189
vapier36ab22f2009-01-19 03:37:35 +0000190Variables in Makefile
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200191---------------------
vapier36ab22f2009-01-19 03:37:35 +0000192
yaberauneya2d8710f2009-10-25 06:35:08 +0000193The conventions enforced are standard ones. Here's a quick summary:
vapier36ab22f2009-01-19 03:37:35 +0000194
yaberauneya2d8710f2009-10-25 06:35:08 +0000195CFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
vapier36ab22f2009-01-19 03:37:35 +0000196
yaberauneya2d8710f2009-10-25 06:35:08 +0000197CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
Garrett Coopere5387ce2010-08-18 02:00:52 -0700198 functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
vapier36ab22f2009-01-19 03:37:35 +0000199
yaberauneya2d8710f2009-10-25 06:35:08 +0000200LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
Garrett Coopere5387ce2010-08-18 02:00:52 -0700201 PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
vapier36ab22f2009-01-19 03:37:35 +0000202
yaberauneya2d8710f2009-10-25 06:35:08 +0000203LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread,
Garrett Coopere5387ce2010-08-18 02:00:52 -0700204 -lltp.
vapier36ab22f2009-01-19 03:37:35 +0000205
Petr Vorel04d0e522020-05-14 20:41:53 +0200206For other variables and more info about the build systems see
207doc/build-system-guide.txt.
yaberauneya9079a9f2009-11-05 08:38:40 +0000208
209Common Issues
Michał Kowalczyk4d4e3a02020-07-19 16:18:29 +0200210-------------
yaberauneya9079a9f2009-11-05 08:38:40 +0000211
yaberauneyacef79622009-11-12 11:57:37 +0000212Issue: When executing configure it says:
213
214checking for a BSD-compatible install... /usr/bin/install -c
215checking whether build environment is sane... yes
216checking for gawk... gawk
217checking whether make sets $(MAKE)... yes
218configure: error: cannot run /bin/sh ./config.sub
219
yaberauneya44cac8e2009-11-12 12:08:09 +0000220Solution: 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 +0000221
yaberauneya9079a9f2009-11-05 08:38:40 +0000222Issue: When executing make [all] it says:
223
224 " *** No rule to make target `/$*', needed by `pan-all'. Stop."
225
226Solution: You must upgrade to make 3.81. Please see the Requirements section above.
227
228Issue: When executing make [all] it says something like:
229
230 # ...
231 install -m 00644 "/scratch/ltp-dev2/ltp/include/test.h" "/scratch/ltp-install12/include/test.h"
232 install -m 00644 "/scratch/ltp-dev2/ltp/include/tlibio.h" "/scratch/ltp-install12/include/tlibio.h"
233 install -m 00644 "/scratch/ltp-dev2/ltp/include/usctest.h" "/scratch/ltp-install12/include/usctest.h"
234 install -m 00644 "/scratch/ltp-dev2/ltp/include/write_log.h" "/scratch/ltp-install12/include/write_log.h"
235 make[1]: Leaving directory `/scratch/ltp-dev2/ltp/include'
Chris Dearman37550cf2012-10-17 19:54:01 -0700236 make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
yaberauneya9079a9f2009-11-05 08:38:40 +0000237 make[1]: Entering directory `/scratch/ltp-dev2/ltp/lib'
238 " *** No rule to make target `dataascii.o', needed by `libltp.a'. Stop." # <-- the error
239
240Solution: You cannot build LTP with -r / --no-builtin-rules and/or
Garrett Coopere5387ce2010-08-18 02:00:52 -0700241 -R / --no-builtin-variables specified. LTP relies heavily on built-in
242 implicit rules and variables to function properly.
yaberauneya340292d2010-01-18 23:46:09 +0000243
244Issue: When executing make (no target, 3.80), it does the following, and doesn't execute all:
245
246 #
247 make -C testcases/realtime autotools
248 make[1]: Entering directory `/scratch/ltp/testcases/realtime'
249 autoheader
250 make[1]: Leaving directory `/scratch/ltp/testcases/realtime'