blob: 2620af06b0a932b9ce517933c1b9ec3567c00ca4 [file] [log] [blame]
yaberauneya340292d2010-01-18 23:46:09 +00001$Id: INSTALL,v 1.36 2010/01/18 23:46:09 yaberauneya Exp $
subrata_modakaba85b92008-12-11 10:30:33 +00002
yaberauneya2d8710f2009-10-25 06:35:08 +00003Requirements
subrata_modakaba85b92008-12-11 10:30:33 +00004-------------------
yaberauneyafbc90452009-11-06 18:21:37 +00005
Garrett Cooper525c4d22010-02-22 10:11:46 -080061. In order to compile ltp you must have make 3.80+ (make 3.81 preferred).
yaberauneya340292d2010-01-18 23:46:09 +000072. In order to compile and use ltp-scanner (a utility in the pan directory),
8 you must have bison/yacc, and flex installed.
subrata_modak3960cc82009-01-20 10:47:29 +00009
yaberauneya2d8710f2009-10-25 06:35:08 +000010bison can be obtained here:
11- http://ftp.gnu.org/gnu/bison/bison-2.4.1.tar.gz
subrata_modak16147ad2009-01-21 11:30:52 +000012
yaberauneya2d8710f2009-10-25 06:35:08 +000013Berkeley yacc can be obtained here:
14- ftp://invisible-island.net/byacc/byacc.tar.gz
subrata_modak16147ad2009-01-21 11:30:52 +000015
yaberauneya2d8710f2009-10-25 06:35:08 +000016flex can be obtained here:
17- http://downloads.sourceforge.net/project/flex/flex/flex-2.5.33/flex-2.5.33.tar.bz2
subrata_modak3960cc82009-01-20 10:47:29 +000018
yaberauneya4f493d82009-11-03 16:12:12 +000019make 3.81 can be obtained here:
20- http://ftp.gnu.org/gnu/make/make-3.81.tar.bz2
21
yaberauneya2d8710f2009-10-25 06:35:08 +000022If 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
yaberauneyabf3aeec2009-11-07 01:30:29 +000038Configuration
yaberauneya2d8710f2009-10-25 06:35:08 +000039-------------------
Mike Frysingere168ad22014-06-18 01:55:46 -040040
41Using autoconf (preferred):
Garrett Coopere5387ce2010-08-18 02:00:52 -070042 $ make autotools # This must be run from "$TOP_SRCDIR"!
yaberauneya2d8710f2009-10-25 06:35:08 +000043 $ test -d "$TOP_BUILDDIR" || mkdir -p "$TOP_BUILDDIR"
Garrett Coopere5387ce2010-08-18 02:00:52 -070044 $ cd "$TOP_BUILDDIR" && "$TOP_SRCDIR/configure" \
yaberauneya2d8710f2009-10-25 06:35:08 +000045 # [configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc]
46
47Not using autoconf:
48
49 $ test -d "$TOP_BUILDDIR" || mkdir -p "$TOP_BUILDDIR"
Garrett Coopere5387ce2010-08-18 02:00:52 -070050 $ cp "$TOP_SRCDIR/include/config.h.default" \
yaberauneya2d8710f2009-10-25 06:35:08 +000051 "$TOP_BUILDDIR/include/config.h"
Garrett Coopere5387ce2010-08-18 02:00:52 -070052 $ cp "$TOP_SRCDIR/include/mk/config.mk.default" \
yaberauneya2d8710f2009-10-25 06:35:08 +000053 "$TOP_BUILDDIR/include/mk/config.mk"
Garrett Cooper4f71cae2010-11-01 21:09:17 -070054 $ cp "$TOP_SRCDIR/include/mk/features.mk.default" \
55 "$TOP_BUILDDIR/include/mk/features.mk"
yaberauneya2d8710f2009-10-25 06:35:08 +000056
Garrett Coopere5387ce2010-08-18 02:00:52 -070057 # Fire up your favorite editor and set each value appropriately in
58 # include/mk/config.mk. Uncomment all values commented out, such as
yaberauneya2d8710f2009-10-25 06:35:08 +000059 # NUMA_LIBS, etc, but only if you're sure that the libraries exist and
60 # can be linked on your system.
61
62- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
63- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
64
65See the In-build-tree and Out-of-build-tree sections below for more details on
66what to do next...
67
68Compiling LTP
69-------------------
70
Garrett Cooper7c67a092010-08-05 06:28:15 -070071"What's in a Path?"
72-------------------
73
74Before getting started, you should make sure that your build directory and
75source directory are as basic as possible: no commas, colons, semicolons,
76spaces, etc. In fact, this is a relatively good rule of thumb when dealing
77with any [Gnu?] make based opensource project.
78
79We won't `fix' the `issues' associated with these particular set of build
80errors resulting from non-sane pathnames, because it would introduce unneeded
81complexity into the build system and would require non-trivial effort to fix
82and validate the third-party packages, and thus wouldn't be a sustainable
83model to follow.
84
85So, we apologize for the inconvenience, but using other characters like
86underscores and dashes should help when disambiguating words between build
87and source pathnames.
88
yaberauneya2d8710f2009-10-25 06:35:08 +000089In-build-tree
90-------------------
91In-build-tree support is when you build binaries (applications, binary objects)
92in the same directory where the source files reside.
93
Garrett Coopere5387ce2010-08-18 02:00:52 -070094 $ make all
95 $ make \
yaberauneya2d8710f2009-10-25 06:35:08 +000096 "DESTDIR=$SYSROOT" \
97 SKIP_IDCHECK=[0|1] \
98 install
99
100- Specifying DESTDIR is optional, but required when installing to a non-host
101 sysroot, as opposed to the host system's sysroot.
102- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
103 on the target system's sysroot.
subrata_modakaba85b92008-12-11 10:30:33 +0000104
Cyril Hrubis70d7e8c2015-09-15 12:50:31 +0200105If you get a build error, please report it to ltp@lists.linux.it with
subrata_modak40455172009-01-05 08:35:21 +0000106following information,
107
yaberauneya2d8710f2009-10-25 06:35:08 +0000108 1. The error output before the failure.
109 2. If you used configure:
Mike Frysingere168ad22014-06-18 01:55:46 -0400110 i. include/config.h
yaberauneya2d8710f2009-10-25 06:35:08 +0000111 ii. include/mk/config.mk
112 iii. config.log
subrata_modak40455172009-01-05 08:35:21 +0000113
yaberauneya2d8710f2009-10-25 06:35:08 +0000114Out-of-build-tree
115-------------------
116Out-of-build-tree support is when you build binaries (applications, binary
117objects, generated files) outside of the directory where the source files
118reside. This is typically used when cross-compiling for multiple targets.
subrata_modak40455172009-01-05 08:35:21 +0000119
yaberauneya2d8710f2009-10-25 06:35:08 +0000120NOTE: This is by and large correctly implemented, but there are several corner
Garrett Cooperc41bb212010-02-24 13:24:15 -0800121cases, where this isn't implemented properly. Please see TODO for a list of
122items which need fixing in the LTP tree.
subrata_modakaba85b92008-12-11 10:30:33 +0000123
yaberauneya2d8710f2009-10-25 06:35:08 +0000124 $ mkdir "$OUT_OF_BUILD_TREE_DIR"
125 $ make \
126 -C "$OUT_OF_BUILD_TREE_DIR" \
127 -f "$TOP_SRCDIR/Makefile" \
128 "top_srcdir=$TOP_SRCDIR" \
129 "top_builddir=$OUT_OF_BUILD_TREE_DIR"
130 $ make \
131 -C "$OUT_OF_BUILD_TREE_DIR" \
132 -f "$TOP_SRCDIR/Makefile" \
133 "top_srcdir=$TOP_SRCDIR" \
134 "top_builddir=$OUT_OF_BUILD_TREE_DIR" \
135 "DESTDIR=$SYSROOT" \
136 SKIP_IDCHECK=[0|1]
137 install
138
139- Specifying DESTDIR is optional, but required when installing to a non-host
140 sysroot, as opposed to the host system's sysroot.
141- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd}
142 on the target system's sysroot.
alaffine15dd682000-05-08 20:31:30 +0000143
nstraz0312c252000-09-26 20:59:21 +0000144Quick Start
145-----------
whrb973f2b2000-05-05 19:34:50 +0000146
robbiew57404482001-09-19 16:11:23 +00001471> tar xzf ltp-XXXXXXXX.tar.gz
nstraz0312c252000-09-26 20:59:21 +00001482> cd ltp
yaberauneyabf3aeec2009-11-07 01:30:29 +00001493> ./configure
1504> make all
1515> make install
Garrett Cooperc41bb212010-02-24 13:24:15 -08001526> /opt/ltp/runltp
whrb973f2b2000-05-05 19:34:50 +0000153
yaberauneya934df0e2010-01-07 10:43:24 +0000154*NOTE:
155- LTP assumes the existence of the nobody, bin, and daemon users and their
Garrett Cooperc41bb212010-02-24 13:24:15 -0800156groups. If these IDs do not exist, certain tests will fail. The respective
157user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then
158its group ID should also be 99. The names of the groups are irrelevant.
159- The installation directory is /opt/ltp by default. Please see
160"Using autoconf" above and specify the appropriate path via --prefix.
161DESTDIR= is also honored for install and will install into $DESTDIR/$prefix,
162if you want to install into a chroot or a rootfs for instance.
whrb973f2b2000-05-05 19:34:50 +0000163
nstraz0312c252000-09-26 20:59:21 +0000164Detailed Installation
165---------------------
166
167Beyond the "Quick Start" instructions, there are only a few other things
168that should be done. The Linux Test Project build process uses a
169minimalist approach. There is a lot of room for improvement and
170contributions are welcome.
171
robbiewb6c5fe72001-09-18 20:44:30 +00001721. Log in as root.
173
1742. Untar the ltp tarball into a spare directory. There is not a
robbiewfc0708b2004-03-01 22:16:02 +0000175 standard location for it yet. We put it in our home directory
robbiew0eea3522004-02-05 17:33:10 +0000176 while we're working on it.
subrata_modakf43b3802009-08-28 05:33:40 +0000177 Note that the full path to this location must be accessible for
178 unprivileged users, as some tests are run as a different user than root.
179 Hence /root is not a good choice on several distributions.
nstraz0312c252000-09-26 20:59:21 +0000180
yaberauneya2d8710f2009-10-25 06:35:08 +00001813. Build and install everything, as described above. Note the minimum software
182 requirements above before doing so.
nstraz0312c252000-09-26 20:59:21 +0000183
Xiao Yang3b3a8422016-11-14 17:55:09 +08001844. The disk I/O tests can be run by executing the diskio.sh script. In order
robbiewba422042001-09-19 15:25:43 +0000185 for these tests to successfully operate a writable high-density 3.5" floppy
186 must be in the disk drive and a CD-ROM with more than 100Mb of data must be
187 in the CD-ROM drive. The corresponding tests will fail if either disk is
188 missing.
nstraz0312c252000-09-26 20:59:21 +0000189
Xiao Yang3b3a8422016-11-14 17:55:09 +08001905. The network tests are executed by running the network.sh script. The network
Petr Vorel751785e2016-11-10 12:54:39 +0100191 tests require some configuration for them to work correctly:
robbiewba422042001-09-19 15:25:43 +0000192
193 i) First, there MUST be another test machine setup to act as the server
194 to these client side tests. This machine MUST have the LTP installed
195 in the same exact location, i.e. if the client has /root/ltp, then the
196 server must have /root/ltp. This is required because certain tests
197 expect to find server files in certain locations. Make sure to compile
198 the LTP on this server machine also.
199
robbiew0eea3522004-02-05 17:33:10 +0000200 ii) Second, the server must be setup to allow the client to connect using
subrata_modak08978d22008-12-18 04:58:57 +0000201 the "r" commands, such as rsh. This is done by simply creating/editing
202 the ".rhosts" file under /root. Place the hostname of the client
203 machine in this file to allow root to remotely connect without the use
204 of a password. If server has the PAM system security tool, you need
205 to add the following lines to /etc/securetty:
206 rlogin
207 rsh
208 rexec
209 pts/0
210 pts/1
211 :
212 pts/9
robbiewba422042001-09-19 15:25:43 +0000213
robbiew0eea3522004-02-05 17:33:10 +0000214 iii) Next, certain services must be activated in order for certain tests to
robbiewba422042001-09-19 15:25:43 +0000215 execute. The following services are activated via inetd/xinetd:
216 rlogind
217 ftpd
218 telnetd
219 echo (stream)
220 fingerd
221 rshd
subrata_modak08978d22008-12-18 04:58:57 +0000222 Also, because certain RPC programs are tested, the "portmapper" daemon
223 MUST be started, as well as NFS server AND lock services.
robbiewba422042001-09-19 15:25:43 +0000224
Petr Vorel751785e2016-11-10 12:54:39 +0100225 iv) Finally, before running the network.sh script, two variables must be
226 set: The "RHOST" variable should be set to the hostname of the server.
227 The "PASSWD" variable should be set to root's password on the server
228 machine. This is necessary for tests such as telnet01 and ftp01.
robbiewba422042001-09-19 15:25:43 +0000229
Petr Vorel751785e2016-11-10 12:54:39 +0100230 You can now successfully execute the network.sh script.
subrata_modak08978d22008-12-18 04:58:57 +0000231
232 You can run the test category which you are interested in, -h option shows
233 the list of the test category:
Petr Vorel751785e2016-11-10 12:54:39 +0100234 # ./network.sh -h
vapier36ab22f2009-01-19 03:37:35 +0000235
Petr Vorel751785e2016-11-10 12:54:39 +0100236 For more info about howto run network.sh see testcases/network/README.md.
vapier36ab22f2009-01-19 03:37:35 +0000237
238Cross compiling
239---------------
240
Mike Frysingere168ad22014-06-18 01:55:46 -0400241To cross compile, you must specify the correct variables when running configure.
242e.g. CC, CXX, CXXFLAGS, LDFLAGS, etc...
vapier36ab22f2009-01-19 03:37:35 +0000243
Mike Frysingere168ad22014-06-18 01:55:46 -0400244After configure has run, it will generate include/mk/config.mk. You can tweak
245settings in there if need be, but you should not specificy settings on the
246command-line when running make.
vapier36ab22f2009-01-19 03:37:35 +0000247
yaberauneya2d8710f2009-10-25 06:35:08 +0000248uClinux Users
249--------------
250Specify UCLINUX=1 when calling make; -DUCLINUX=1 use is deprecated and highly
251discouraged.
vapier36ab22f2009-01-19 03:37:35 +0000252
Steven Jackson34a7c822017-01-16 16:41:07 +0000253Android Users
254-------------
255Specify ANDROID=1 when calling make. Many tests which would otherwise work are
256currently not built because they share a directory with an incompatible test.
257
258The shell scripts expect /bin/sh to exist, so create a symlink.
259
vapier36ab22f2009-01-19 03:37:35 +0000260Variables in Makefile
261----------------------
262
yaberauneya2d8710f2009-10-25 06:35:08 +0000263The conventions enforced are standard ones. Here's a quick summary:
vapier36ab22f2009-01-19 03:37:35 +0000264
yaberauneya2d8710f2009-10-25 06:35:08 +0000265CFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
vapier36ab22f2009-01-19 03:37:35 +0000266
267CXXFLAGS - used when compiling/linking C++ code (no CPPFLAGS!)
268
yaberauneya2d8710f2009-10-25 06:35:08 +0000269CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
Garrett Coopere5387ce2010-08-18 02:00:52 -0700270 functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
vapier36ab22f2009-01-19 03:37:35 +0000271
yaberauneya2d8710f2009-10-25 06:35:08 +0000272LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
Garrett Coopere5387ce2010-08-18 02:00:52 -0700273 PUT LIBRARIES IN THIS LIST (see LDLIBS for that).
vapier36ab22f2009-01-19 03:37:35 +0000274
yaberauneya2d8710f2009-10-25 06:35:08 +0000275LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread,
Garrett Coopere5387ce2010-08-18 02:00:52 -0700276 -lltp.
vapier36ab22f2009-01-19 03:37:35 +0000277
yaberauneya2d8710f2009-10-25 06:35:08 +0000278See README.mk-devel for a more terse description of what's available.
yaberauneya9079a9f2009-11-05 08:38:40 +0000279
280Common Issues
281----------------------
282
yaberauneyacef79622009-11-12 11:57:37 +0000283Issue: When executing configure it says:
284
285checking for a BSD-compatible install... /usr/bin/install -c
286checking whether build environment is sane... yes
287checking for gawk... gawk
288checking whether make sets $(MAKE)... yes
289configure: error: cannot run /bin/sh ./config.sub
290
yaberauneya44cac8e2009-11-12 12:08:09 +0000291Solution: 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 +0000292
yaberauneya9079a9f2009-11-05 08:38:40 +0000293Issue: When executing make [all] it says:
294
295 " *** No rule to make target `/$*', needed by `pan-all'. Stop."
296
297Solution: You must upgrade to make 3.81. Please see the Requirements section above.
298
299Issue: When executing make [all] it says something like:
300
301 # ...
302 install -m 00644 "/scratch/ltp-dev2/ltp/include/test.h" "/scratch/ltp-install12/include/test.h"
303 install -m 00644 "/scratch/ltp-dev2/ltp/include/tlibio.h" "/scratch/ltp-install12/include/tlibio.h"
304 install -m 00644 "/scratch/ltp-dev2/ltp/include/usctest.h" "/scratch/ltp-install12/include/usctest.h"
305 install -m 00644 "/scratch/ltp-dev2/ltp/include/write_log.h" "/scratch/ltp-install12/include/write_log.h"
306 make[1]: Leaving directory `/scratch/ltp-dev2/ltp/include'
Chris Dearman37550cf2012-10-17 19:54:01 -0700307 make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all
yaberauneya9079a9f2009-11-05 08:38:40 +0000308 make[1]: Entering directory `/scratch/ltp-dev2/ltp/lib'
309 " *** No rule to make target `dataascii.o', needed by `libltp.a'. Stop." # <-- the error
310
311Solution: You cannot build LTP with -r / --no-builtin-rules and/or
Garrett Coopere5387ce2010-08-18 02:00:52 -0700312 -R / --no-builtin-variables specified. LTP relies heavily on built-in
313 implicit rules and variables to function properly.
yaberauneya340292d2010-01-18 23:46:09 +0000314
315Issue: When executing make (no target, 3.80), it does the following, and doesn't execute all:
316
317 #
318 make -C testcases/realtime autotools
319 make[1]: Entering directory `/scratch/ltp/testcases/realtime'
320 autoheader
321 make[1]: Leaving directory `/scratch/ltp/testcases/realtime'