yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 1 | Requirements |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 2 | ------------ |
yaberauneya | fbc9045 | 2009-11-06 18:21:37 +0000 | [diff] [blame] | 3 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 4 | Tools are needed for LTP compilation. They should be available as a |
| 5 | package in any Linux distribution (no specific version is required). |
subrata_modak | 3960cc8 | 2009-01-20 10:47:29 +0000 | [diff] [blame] | 6 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 7 | Debian / Ubuntu |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 8 | |
| 9 | # apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev |
subrata_modak | 16147ad | 2009-01-21 11:30:52 +0000 | [diff] [blame] | 10 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 11 | OpenSUSE / SLES |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 12 | |
| 13 | # zypper install gcc git make pkgconf autoconf automake bison flex m4 linux-glibc-devel glibc-devel |
subrata_modak | 16147ad | 2009-01-21 11:30:52 +0000 | [diff] [blame] | 14 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 15 | Fedora / CentOS / RHEL |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 16 | |
| 17 | # yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers |
subrata_modak | 3960cc8 | 2009-01-20 10:47:29 +0000 | [diff] [blame] | 18 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 19 | These are minimal build requirements for git compilation. Some tests require |
| 20 | extra development files of some libraries, see travis/*.sh. There is also |
| 21 | support for other Linux distributions not listed here. |
yaberauneya | 4f493d8 | 2009-11-03 16:12:12 +0000 | [diff] [blame] | 22 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 23 | autoconf, automake, m4 (autoconf requirement), git and pkgconf (or pkg-config |
| 24 | on older distros) are required only for compilation from git (used for creating |
| 25 | configure file). |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 26 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 27 | pkgconf is recommended also for compilation from tarball as it |
| 28 | does automatic detection of some library support. |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 29 | |
Petr Vorel | dfda9ec | 2020-05-14 19:34:48 +0200 | [diff] [blame] | 30 | GNU Bison / Berkeley Yacc is required for ltp-scanner. |
Petr Vorel | b009824 | 2020-03-17 19:58:19 +0100 | [diff] [blame] | 31 | |
yaberauneya | bf3aeec | 2009-11-07 01:30:29 +0000 | [diff] [blame] | 32 | Configuration |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 33 | ------------- |
Mike Frysinger | e168ad2 | 2014-06-18 01:55:46 -0400 | [diff] [blame] | 34 | |
Petr Vorel | 400ac9b | 2019-11-04 07:31:41 +0100 | [diff] [blame] | 35 | Configuration requires autoconf: |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 36 | |
Petr Vorel | 400ac9b | 2019-11-04 07:31:41 +0100 | [diff] [blame] | 37 | $ cd $TOP_SRCDIR |
| 38 | $ make autotools |
| 39 | $ mkdir -p $TOP_BUILDDIR |
Michał Kowalczyk | f8a2e6e | 2020-07-19 16:12:07 +0200 | [diff] [blame] | 40 | $ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 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 | |
| 45 | See the In-build-tree and Out-of-build-tree sections below for more details on |
Petr Vorel | 400ac9b | 2019-11-04 07:31:41 +0100 | [diff] [blame] | 46 | what to do next. |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 47 | |
| 48 | Compiling LTP |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 49 | ------------- |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 50 | |
| 51 | In-build-tree |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 52 | ------------- |
| 53 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 54 | In-build-tree support is when you build binaries (applications, binary objects) |
| 55 | in the same directory where the source files reside. |
| 56 | |
Garrett Cooper | e5387ce | 2010-08-18 02:00:52 -0700 | [diff] [blame] | 57 | $ make all |
| 58 | $ make \ |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 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. |
subrata_modak | aba85b9 | 2008-12-11 10:30:33 +0000 | [diff] [blame] | 67 | |
Cyril Hrubis | 70d7e8c | 2015-09-15 12:50:31 +0200 | [diff] [blame] | 68 | If you get a build error, please report it to ltp@lists.linux.it with |
subrata_modak | 4045517 | 2009-01-05 08:35:21 +0000 | [diff] [blame] | 69 | following information, |
| 70 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 71 | 1. The error output before the failure. |
| 72 | 2. If you used configure: |
Mike Frysinger | e168ad2 | 2014-06-18 01:55:46 -0400 | [diff] [blame] | 73 | i. include/config.h |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 74 | ii. include/mk/config.mk |
| 75 | iii. config.log |
subrata_modak | 4045517 | 2009-01-05 08:35:21 +0000 | [diff] [blame] | 76 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 77 | Out-of-build-tree |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 78 | ----------------- |
| 79 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 80 | Out-of-build-tree support is when you build binaries (applications, binary |
| 81 | objects, generated files) outside of the directory where the source files |
| 82 | reside. This is typically used when cross-compiling for multiple targets. |
subrata_modak | 4045517 | 2009-01-05 08:35:21 +0000 | [diff] [blame] | 83 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 84 | NOTE: This is by and large correctly implemented, but there are several corner |
Garrett Cooper | c41bb21 | 2010-02-24 13:24:15 -0800 | [diff] [blame] | 85 | cases, where this isn't implemented properly. Please see TODO for a list of |
| 86 | items which need fixing in the LTP tree. |
subrata_modak | aba85b9 | 2008-12-11 10:30:33 +0000 | [diff] [blame] | 87 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 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. |
alaffin | e15dd68 | 2000-05-08 20:31:30 +0000 | [diff] [blame] | 107 | |
nstraz | 0312c25 | 2000-09-26 20:59:21 +0000 | [diff] [blame] | 108 | Quick Start |
| 109 | ----------- |
whr | b973f2b | 2000-05-05 19:34:50 +0000 | [diff] [blame] | 110 | |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 111 | $ tar xzf ltp-XXXXXXXX.tar.gz |
| 112 | $ cd ltp |
| 113 | $ ./configure |
| 114 | $ make all |
| 115 | # make install |
| 116 | $ /opt/ltp/runltp |
whr | b973f2b | 2000-05-05 19:34:50 +0000 | [diff] [blame] | 117 | |
yaberauneya | 934df0e | 2010-01-07 10:43:24 +0000 | [diff] [blame] | 118 | *NOTE: |
| 119 | - LTP assumes the existence of the nobody, bin, and daemon users and their |
Garrett Cooper | c41bb21 | 2010-02-24 13:24:15 -0800 | [diff] [blame] | 120 | groups. If these IDs do not exist, certain tests will fail. The respective |
| 121 | user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then |
| 122 | its 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. |
| 125 | DESTDIR= is also honored for install and will install into $DESTDIR/$prefix, |
| 126 | if you want to install into a chroot or a rootfs for instance. |
whr | b973f2b | 2000-05-05 19:34:50 +0000 | [diff] [blame] | 127 | |
nstraz | 0312c25 | 2000-09-26 20:59:21 +0000 | [diff] [blame] | 128 | Detailed Installation |
| 129 | --------------------- |
| 130 | |
| 131 | Beyond the "Quick Start" instructions, there are only a few other things |
| 132 | that should be done. The Linux Test Project build process uses a |
| 133 | minimalist approach. There is a lot of room for improvement and |
| 134 | contributions are welcome. |
| 135 | |
robbiew | b6c5fe7 | 2001-09-18 20:44:30 +0000 | [diff] [blame] | 136 | 1. Log in as root. |
| 137 | |
| 138 | 2. Untar the ltp tarball into a spare directory. There is not a |
robbiew | fc0708b | 2004-03-01 22:16:02 +0000 | [diff] [blame] | 139 | standard location for it yet. We put it in our home directory |
robbiew | 0eea352 | 2004-02-05 17:33:10 +0000 | [diff] [blame] | 140 | while we're working on it. |
subrata_modak | f43b380 | 2009-08-28 05:33:40 +0000 | [diff] [blame] | 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. |
nstraz | 0312c25 | 2000-09-26 20:59:21 +0000 | [diff] [blame] | 144 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 145 | 3. Build and install everything, as described above. Note the minimum software |
| 146 | requirements above before doing so. |
nstraz | 0312c25 | 2000-09-26 20:59:21 +0000 | [diff] [blame] | 147 | |
Xiao Yang | 3b3a842 | 2016-11-14 17:55:09 +0800 | [diff] [blame] | 148 | 4. The disk I/O tests can be run by executing the diskio.sh script. In order |
robbiew | ba42204 | 2001-09-19 15:25:43 +0000 | [diff] [blame] | 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. |
nstraz | 0312c25 | 2000-09-26 20:59:21 +0000 | [diff] [blame] | 153 | |
Petr Vorel | 0905201 | 2020-06-19 22:49:05 +0200 | [diff] [blame] | 154 | 5. The network tests related installation see testcases/network/README.md. |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 155 | |
| 156 | Cross compiling |
| 157 | --------------- |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 158 | |
Mike Frysinger | e168ad2 | 2014-06-18 01:55:46 -0400 | [diff] [blame] | 159 | To cross compile, you must specify the correct variables when running configure. |
Petr Vorel | 6890f37 | 2020-05-14 20:32:39 +0200 | [diff] [blame] | 160 | e.g. CC, LDFLAGS, etc. |
| 161 | For correct pkgconf / pkg-config detection you need to set |
| 162 | PKG_CONFIG_SYSROOT_DIR=$SYSROOT |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 163 | |
Mike Frysinger | e168ad2 | 2014-06-18 01:55:46 -0400 | [diff] [blame] | 164 | After configure has run, it will generate include/mk/config.mk. You can tweak |
| 165 | settings in there if need be, but you should not specificy settings on the |
| 166 | command-line when running make. |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 167 | |
Petr Vorel | 6890f37 | 2020-05-14 20:32:39 +0200 | [diff] [blame] | 168 | 32 bit build on 64 bit machine |
| 169 | ------------------------------ |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 170 | |
Petr Vorel | 6890f37 | 2020-05-14 20:32:39 +0200 | [diff] [blame] | 171 | You need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR |
| 172 | |
| 173 | * RPM based distributions (openSUSE, Fedora, etc.) |
| 174 | PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure |
| 175 | |
| 176 | * Debian / Ubuntu and derivates |
| 177 | PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure |
| 178 | |
| 179 | * Arch Linux |
| 180 | PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure |
| 181 | |
Steven Jackson | 34a7c82 | 2017-01-16 16:41:07 +0000 | [diff] [blame] | 182 | Android Users |
| 183 | ------------- |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 184 | |
Steven Jackson | 34a7c82 | 2017-01-16 16:41:07 +0000 | [diff] [blame] | 185 | Specify ANDROID=1 when calling make. Many tests which would otherwise work are |
| 186 | currently not built because they share a directory with an incompatible test. |
| 187 | |
| 188 | The shell scripts expect /bin/sh to exist, so create a symlink. |
| 189 | |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 190 | Variables in Makefile |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 191 | --------------------- |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 192 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 193 | The conventions enforced are standard ones. Here's a quick summary: |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 194 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 195 | CFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!) |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 196 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 197 | CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP) |
Garrett Cooper | e5387ce | 2010-08-18 02:00:52 -0700 | [diff] [blame] | 198 | functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 199 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 200 | LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT |
Garrett Cooper | e5387ce | 2010-08-18 02:00:52 -0700 | [diff] [blame] | 201 | PUT LIBRARIES IN THIS LIST (see LDLIBS for that). |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 202 | |
yaberauneya | 2d8710f | 2009-10-25 06:35:08 +0000 | [diff] [blame] | 203 | LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread, |
Garrett Cooper | e5387ce | 2010-08-18 02:00:52 -0700 | [diff] [blame] | 204 | -lltp. |
vapier | 36ab22f | 2009-01-19 03:37:35 +0000 | [diff] [blame] | 205 | |
Petr Vorel | 04d0e52 | 2020-05-14 20:41:53 +0200 | [diff] [blame] | 206 | For other variables and more info about the build systems see |
| 207 | doc/build-system-guide.txt. |
yaberauneya | 9079a9f | 2009-11-05 08:38:40 +0000 | [diff] [blame] | 208 | |
| 209 | Common Issues |
Michał Kowalczyk | 4d4e3a0 | 2020-07-19 16:18:29 +0200 | [diff] [blame] | 210 | ------------- |
yaberauneya | 9079a9f | 2009-11-05 08:38:40 +0000 | [diff] [blame] | 211 | |
yaberauneya | cef7962 | 2009-11-12 11:57:37 +0000 | [diff] [blame] | 212 | Issue: When executing configure it says: |
| 213 | |
| 214 | checking for a BSD-compatible install... /usr/bin/install -c |
| 215 | checking whether build environment is sane... yes |
| 216 | checking for gawk... gawk |
| 217 | checking whether make sets $(MAKE)... yes |
| 218 | configure: error: cannot run /bin/sh ./config.sub |
| 219 | |
yaberauneya | 44cac8e | 2009-11-12 12:08:09 +0000 | [diff] [blame] | 220 | Solution: 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. |
yaberauneya | cef7962 | 2009-11-12 11:57:37 +0000 | [diff] [blame] | 221 | |
yaberauneya | 9079a9f | 2009-11-05 08:38:40 +0000 | [diff] [blame] | 222 | Issue: When executing make [all] it says: |
| 223 | |
| 224 | " *** No rule to make target `/$*', needed by `pan-all'. Stop." |
| 225 | |
| 226 | Solution: You must upgrade to make 3.81. Please see the Requirements section above. |
| 227 | |
| 228 | Issue: 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 Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 236 | make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all |
yaberauneya | 9079a9f | 2009-11-05 08:38:40 +0000 | [diff] [blame] | 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 | |
| 240 | Solution: You cannot build LTP with -r / --no-builtin-rules and/or |
Garrett Cooper | e5387ce | 2010-08-18 02:00:52 -0700 | [diff] [blame] | 241 | -R / --no-builtin-variables specified. LTP relies heavily on built-in |
| 242 | implicit rules and variables to function properly. |
yaberauneya | 340292d | 2010-01-18 23:46:09 +0000 | [diff] [blame] | 243 | |
| 244 | Issue: 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' |