• 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
9	# apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev
10
11openSUSE / SLES
12
13	# zypper install gcc git make pkg-config autoconf automake bison flex m4 linux-glibc-devel glibc-devel
14
15Fedora / CentOS / RHEL
16
17	# yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers
18
19These are minimal build requirements for git compilation. Some tests require
20extra development files of some libraries, see ci/*.sh. There is also
21support for other Linux distributions not listed here.
22
23autoconf, 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).
26
27pkgconf is recommended also for compilation from tarball as it
28does automatic detection of some library support.
29
30GNU Bison / Berkeley Yacc is required for ltp-scanner.
31
32Configuration
33-------------
34
35Configuration requires autoconf:
36
37	$ cd $TOP_SRCDIR
38	$ make autotools
39	$ mkdir -p $TOP_BUILDDIR
40	$ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
41
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
46what to do next.
47
48Compiling LTP
49-------------
50
51In-build-tree
52-------------
53
54In-build-tree support is when you build binaries (applications, binary objects)
55in the same directory where the source files reside.
56
57	$ make all
58	$ make \
59	  "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.
67
68If you get a build error, please report it to ltp@lists.linux.it with
69following information,
70
71 1. The error output before the failure.
72 2. If you used configure:
73	i.   include/config.h
74	ii.  include/mk/config.mk
75	iii. config.log
76
77Out-of-build-tree
78-----------------
79
80Out-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.
83
84NOTE: This is by and large correctly implemented, but there are several corner
85cases, where this isn't implemented properly. Please see TODO for a list of
86items which need fixing in the LTP tree.
87
88	$ 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.
107
108Quick Start
109-----------
110
111	$ tar xzf ltp-XXXXXXXX.tar.gz
112	$ cd ltp
113	$ ./configure
114	$ make all
115	# make install
116	$ /opt/ltp/runltp
117
118*NOTE:
119- LTP assumes the existence of the nobody, bin, and daemon users and their
120groups.  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.
127
128Detailed 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
1361. Log in as root.
137
1382. Untar the ltp tarball into a spare directory.  There is not a
139   standard location for it yet.  We put it in our home directory
140   while we're working on it.
141   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.
144
1453. Build and install everything, as described above. Note the minimum software
146   requirements above before doing so.
147
1484. The disk I/O tests can be run by executing the diskio.sh script.  In order
149   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.
153
1545. The network tests related installation see testcases/network/README.md.
155
156Cross compiling
157---------------
158
159To cross compile, you must specify the correct variables when running configure.
160e.g. CC, LDFLAGS, etc.
161For correct pkgconf / pkg-config detection you need to set
162PKG_CONFIG_SYSROOT_DIR=$SYSROOT
163
164After 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.
167
16832 bit build on 64 bit machine
169------------------------------
170
171You 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
182Android Users
183-------------
184
185Specify 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
190Variables in Makefile
191---------------------
192
193The conventions enforced are standard ones. Here's a quick summary:
194
195CFLAGS   - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
196
197CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
198	   functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
199
200LDFLAGS  - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
201	   PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
202
203LDLIBS   - libraries listed after objects during link, e.g. -lc, -lpthread,
204	   -lltp.
205
206For other variables and more info about the build systems see
207doc/build-system-guide.txt.
208
209Common Issues
210-------------
211
212Issue:    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
220Solution: 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.
221
222Issue:    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'
236    make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
237    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
241	  -R / --no-builtin-variables specified. LTP relies heavily on built-in
242	  implicit rules and variables to function properly.
243
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'
251