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 30Configuration 31------------- 32 33Configuration requires autoconf: 34 35 $ cd $TOP_SRCDIR 36 $ make autotools 37 $ mkdir -p $TOP_BUILDDIR 38 $ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc 39 40- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios. 41- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios. 42 43See the In-build-tree and Out-of-build-tree sections below for more details on 44what to do next. 45 46Compiling LTP 47------------- 48 49In-build-tree 50------------- 51 52In-build-tree support is when you build binaries (applications, binary objects) 53in the same directory where the source files reside. 54 55 $ make all 56 $ make \ 57 "DESTDIR=$SYSROOT" \ 58 install 59 60- Specifying DESTDIR is optional, but required when installing to a non-host 61 sysroot, as opposed to the host system's sysroot. 62 63If you get a build error, please report it to ltp@lists.linux.it with 64following information, 65 66 1. The error output before the failure. 67 2. If you used configure: 68 i. include/config.h 69 ii. include/mk/config.mk 70 iii. config.log 71 72Out-of-build-tree 73----------------- 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. 78 79NOTE: This is by and large correctly implemented, but there are several corner 80cases, where this isn't implemented properly. Please see TODO for a list of 81items which need fixing in the LTP tree. 82 83 $ 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 install 96 97- Specifying DESTDIR is optional, but required when installing to a non-host 98 sysroot, as opposed to the host system's sysroot. 99 100Quick Start 101----------- 102 103 $ tar xzf ltp-XXXXXXXX.tar.gz 104 $ cd ltp 105 $ ./configure 106 $ make all 107 # make install 108 $ /opt/ltp/runltp 109 110*NOTE: 111- LTP assumes the existence of the nobody, bin, and daemon users and their 112groups. If these IDs do not exist, certain tests will fail. The respective 113user and group IDs should be the same, i.e. if `nobody's' user ID is 99, then 114its group ID should also be 99. The names of the groups are irrelevant. 115- The installation directory is /opt/ltp by default. Please see 116"Using autoconf" above and specify the appropriate path via --prefix. 117DESTDIR= is also honored for install and will install into $DESTDIR/$prefix, 118if you want to install into a chroot or a rootfs for instance. 119 120Detailed Installation 121--------------------- 122 123Beyond the "Quick Start" instructions, there are only a few other things 124that should be done. The Linux Test Project build process uses a 125minimalist approach. There is a lot of room for improvement and 126contributions are welcome. 127 1281. Log in as root. 129 1302. Untar the ltp tarball into a spare directory. There is not a 131 standard location for it yet. We put it in our home directory 132 while we're working on it. 133 Note that the full path to this location must be accessible for 134 unprivileged users, as some tests are run as a different user than root. 135 Hence /root is not a good choice on several distributions. 136 1373. Build and install everything, as described above. Note the minimum software 138 requirements above before doing so. 139 1404. The disk I/O tests can be run by executing the diskio.sh script. In order 141 for these tests to successfully operate a writable high-density 3.5" floppy 142 must be in the disk drive and a CD-ROM with more than 100Mb of data must be 143 in the CD-ROM drive. The corresponding tests will fail if either disk is 144 missing. 145 1465. The network tests related installation see testcases/network/README.md. 147 148Cross compiling 149--------------- 150 151To cross compile, you must specify the correct variables when running configure. 152e.g. CC, LDFLAGS, etc. 153For correct pkgconf / pkg-config detection you need to set 154PKG_CONFIG_SYSROOT_DIR=$SYSROOT 155 156After configure has run, it will generate include/mk/config.mk. You can tweak 157settings in there if need be, but you should not specificy settings on the 158command-line when running make. 159 16032 bit build on 64 bit machine 161------------------------------ 162 163You need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR 164 165* RPM based distributions (openSUSE, Fedora, etc.) 166PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 167 168* Debian / Ubuntu and derivates 169PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 170 171* Arch Linux 172PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 173 174Android Users 175------------- 176 177Specify ANDROID=1 when calling make. Many tests which would otherwise work are 178currently not built because they share a directory with an incompatible test. 179 180The shell scripts expect /bin/sh to exist, so create a symlink. 181 182Variables in Makefile 183--------------------- 184 185The conventions enforced are standard ones. Here's a quick summary: 186 187CFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!) 188 189CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP) 190 functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT 191 192LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT 193 PUT LIBRARIES IN THIS LIST (see LDLIBS for that). 194 195LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread, 196 -lltp. 197 198For other variables and more info about the build systems see 199doc/Build-System.asciidoc. 200