1*49cdfc7eSAndroid Build Coastguard WorkerRequirements 2*49cdfc7eSAndroid Build Coastguard Worker------------ 3*49cdfc7eSAndroid Build Coastguard Worker 4*49cdfc7eSAndroid Build Coastguard WorkerTools are needed for LTP compilation. They should be available as a 5*49cdfc7eSAndroid Build Coastguard Workerpackage in any Linux distribution (no specific version is required). 6*49cdfc7eSAndroid Build Coastguard Worker 7*49cdfc7eSAndroid Build Coastguard WorkerDebian / Ubuntu 8*49cdfc7eSAndroid Build Coastguard Worker 9*49cdfc7eSAndroid Build Coastguard Worker # apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev 10*49cdfc7eSAndroid Build Coastguard Worker 11*49cdfc7eSAndroid Build Coastguard WorkeropenSUSE / SLES 12*49cdfc7eSAndroid Build Coastguard Worker 13*49cdfc7eSAndroid Build Coastguard Worker # zypper install gcc git make pkg-config autoconf automake bison flex m4 linux-glibc-devel glibc-devel 14*49cdfc7eSAndroid Build Coastguard Worker 15*49cdfc7eSAndroid Build Coastguard WorkerFedora / CentOS / RHEL 16*49cdfc7eSAndroid Build Coastguard Worker 17*49cdfc7eSAndroid Build Coastguard Worker # yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers 18*49cdfc7eSAndroid Build Coastguard Worker 19*49cdfc7eSAndroid Build Coastguard WorkerThese are minimal build requirements for git compilation. Some tests require 20*49cdfc7eSAndroid Build Coastguard Workerextra development files of some libraries, see ci/*.sh. There is also 21*49cdfc7eSAndroid Build Coastguard Workersupport for other Linux distributions not listed here. 22*49cdfc7eSAndroid Build Coastguard Worker 23*49cdfc7eSAndroid Build Coastguard Workerautoconf, automake, m4 (autoconf requirement), git and pkgconf (or pkg-config 24*49cdfc7eSAndroid Build Coastguard Workeron older distros) are required only for compilation from git (used for creating 25*49cdfc7eSAndroid Build Coastguard Workerconfigure file). 26*49cdfc7eSAndroid Build Coastguard Worker 27*49cdfc7eSAndroid Build Coastguard Workerpkgconf is recommended also for compilation from tarball as it 28*49cdfc7eSAndroid Build Coastguard Workerdoes automatic detection of some library support. 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard WorkerConfiguration 31*49cdfc7eSAndroid Build Coastguard Worker------------- 32*49cdfc7eSAndroid Build Coastguard Worker 33*49cdfc7eSAndroid Build Coastguard WorkerConfiguration requires autoconf: 34*49cdfc7eSAndroid Build Coastguard Worker 35*49cdfc7eSAndroid Build Coastguard Worker $ cd $TOP_SRCDIR 36*49cdfc7eSAndroid Build Coastguard Worker $ make autotools 37*49cdfc7eSAndroid Build Coastguard Worker $ mkdir -p $TOP_BUILDDIR 38*49cdfc7eSAndroid Build Coastguard Worker $ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc 39*49cdfc7eSAndroid Build Coastguard Worker 40*49cdfc7eSAndroid Build Coastguard Worker- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios. 41*49cdfc7eSAndroid Build Coastguard Worker- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios. 42*49cdfc7eSAndroid Build Coastguard Worker 43*49cdfc7eSAndroid Build Coastguard WorkerSee the In-build-tree and Out-of-build-tree sections below for more details on 44*49cdfc7eSAndroid Build Coastguard Workerwhat to do next. 45*49cdfc7eSAndroid Build Coastguard Worker 46*49cdfc7eSAndroid Build Coastguard WorkerCompiling LTP 47*49cdfc7eSAndroid Build Coastguard Worker------------- 48*49cdfc7eSAndroid Build Coastguard Worker 49*49cdfc7eSAndroid Build Coastguard WorkerIn-build-tree 50*49cdfc7eSAndroid Build Coastguard Worker------------- 51*49cdfc7eSAndroid Build Coastguard Worker 52*49cdfc7eSAndroid Build Coastguard WorkerIn-build-tree support is when you build binaries (applications, binary objects) 53*49cdfc7eSAndroid Build Coastguard Workerin the same directory where the source files reside. 54*49cdfc7eSAndroid Build Coastguard Worker 55*49cdfc7eSAndroid Build Coastguard Worker $ make all 56*49cdfc7eSAndroid Build Coastguard Worker $ make \ 57*49cdfc7eSAndroid Build Coastguard Worker "DESTDIR=$SYSROOT" \ 58*49cdfc7eSAndroid Build Coastguard Worker SKIP_IDCHECK=[0|1] \ 59*49cdfc7eSAndroid Build Coastguard Worker install 60*49cdfc7eSAndroid Build Coastguard Worker 61*49cdfc7eSAndroid Build Coastguard Worker- Specifying DESTDIR is optional, but required when installing to a non-host 62*49cdfc7eSAndroid Build Coastguard Worker sysroot, as opposed to the host system's sysroot. 63*49cdfc7eSAndroid Build Coastguard Worker- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd} 64*49cdfc7eSAndroid Build Coastguard Worker on the target system's sysroot. 65*49cdfc7eSAndroid Build Coastguard Worker 66*49cdfc7eSAndroid Build Coastguard WorkerIf you get a build error, please report it to [email protected] with 67*49cdfc7eSAndroid Build Coastguard Workerfollowing information, 68*49cdfc7eSAndroid Build Coastguard Worker 69*49cdfc7eSAndroid Build Coastguard Worker 1. The error output before the failure. 70*49cdfc7eSAndroid Build Coastguard Worker 2. If you used configure: 71*49cdfc7eSAndroid Build Coastguard Worker i. include/config.h 72*49cdfc7eSAndroid Build Coastguard Worker ii. include/mk/config.mk 73*49cdfc7eSAndroid Build Coastguard Worker iii. config.log 74*49cdfc7eSAndroid Build Coastguard Worker 75*49cdfc7eSAndroid Build Coastguard WorkerOut-of-build-tree 76*49cdfc7eSAndroid Build Coastguard Worker----------------- 77*49cdfc7eSAndroid Build Coastguard Worker 78*49cdfc7eSAndroid Build Coastguard WorkerOut-of-build-tree support is when you build binaries (applications, binary 79*49cdfc7eSAndroid Build Coastguard Workerobjects, generated files) outside of the directory where the source files 80*49cdfc7eSAndroid Build Coastguard Workerreside. This is typically used when cross-compiling for multiple targets. 81*49cdfc7eSAndroid Build Coastguard Worker 82*49cdfc7eSAndroid Build Coastguard WorkerNOTE: This is by and large correctly implemented, but there are several corner 83*49cdfc7eSAndroid Build Coastguard Workercases, where this isn't implemented properly. Please see TODO for a list of 84*49cdfc7eSAndroid Build Coastguard Workeritems which need fixing in the LTP tree. 85*49cdfc7eSAndroid Build Coastguard Worker 86*49cdfc7eSAndroid Build Coastguard Worker $ mkdir "$OUT_OF_BUILD_TREE_DIR" 87*49cdfc7eSAndroid Build Coastguard Worker $ make \ 88*49cdfc7eSAndroid Build Coastguard Worker -C "$OUT_OF_BUILD_TREE_DIR" \ 89*49cdfc7eSAndroid Build Coastguard Worker -f "$TOP_SRCDIR/Makefile" \ 90*49cdfc7eSAndroid Build Coastguard Worker "top_srcdir=$TOP_SRCDIR" \ 91*49cdfc7eSAndroid Build Coastguard Worker "top_builddir=$OUT_OF_BUILD_TREE_DIR" 92*49cdfc7eSAndroid Build Coastguard Worker $ make \ 93*49cdfc7eSAndroid Build Coastguard Worker -C "$OUT_OF_BUILD_TREE_DIR" \ 94*49cdfc7eSAndroid Build Coastguard Worker -f "$TOP_SRCDIR/Makefile" \ 95*49cdfc7eSAndroid Build Coastguard Worker "top_srcdir=$TOP_SRCDIR" \ 96*49cdfc7eSAndroid Build Coastguard Worker "top_builddir=$OUT_OF_BUILD_TREE_DIR" \ 97*49cdfc7eSAndroid Build Coastguard Worker "DESTDIR=$SYSROOT" \ 98*49cdfc7eSAndroid Build Coastguard Worker SKIP_IDCHECK=[0|1] 99*49cdfc7eSAndroid Build Coastguard Worker install 100*49cdfc7eSAndroid Build Coastguard Worker 101*49cdfc7eSAndroid Build Coastguard Worker- Specifying DESTDIR is optional, but required when installing to a non-host 102*49cdfc7eSAndroid Build Coastguard Worker sysroot, as opposed to the host system's sysroot. 103*49cdfc7eSAndroid Build Coastguard Worker- Specify SKIP_IDCHECK=1 if and when you don't want to modify /etc/{group,passwd} 104*49cdfc7eSAndroid Build Coastguard Worker on the target system's sysroot. 105*49cdfc7eSAndroid Build Coastguard Worker 106*49cdfc7eSAndroid Build Coastguard WorkerQuick Start 107*49cdfc7eSAndroid Build Coastguard Worker----------- 108*49cdfc7eSAndroid Build Coastguard Worker 109*49cdfc7eSAndroid Build Coastguard Worker $ tar xzf ltp-XXXXXXXX.tar.gz 110*49cdfc7eSAndroid Build Coastguard Worker $ cd ltp 111*49cdfc7eSAndroid Build Coastguard Worker $ ./configure 112*49cdfc7eSAndroid Build Coastguard Worker $ make all 113*49cdfc7eSAndroid Build Coastguard Worker # make install 114*49cdfc7eSAndroid Build Coastguard Worker $ /opt/ltp/runltp 115*49cdfc7eSAndroid Build Coastguard Worker 116*49cdfc7eSAndroid Build Coastguard Worker*NOTE: 117*49cdfc7eSAndroid Build Coastguard Worker- LTP assumes the existence of the nobody, bin, and daemon users and their 118*49cdfc7eSAndroid Build Coastguard Workergroups. If these IDs do not exist, certain tests will fail. The respective 119*49cdfc7eSAndroid Build Coastguard Workeruser and group IDs should be the same, i.e. if `nobody's' user ID is 99, then 120*49cdfc7eSAndroid Build Coastguard Workerits group ID should also be 99. The names of the groups are irrelevant. 121*49cdfc7eSAndroid Build Coastguard Worker- The installation directory is /opt/ltp by default. Please see 122*49cdfc7eSAndroid Build Coastguard Worker"Using autoconf" above and specify the appropriate path via --prefix. 123*49cdfc7eSAndroid Build Coastguard WorkerDESTDIR= is also honored for install and will install into $DESTDIR/$prefix, 124*49cdfc7eSAndroid Build Coastguard Workerif you want to install into a chroot or a rootfs for instance. 125*49cdfc7eSAndroid Build Coastguard Worker 126*49cdfc7eSAndroid Build Coastguard WorkerDetailed Installation 127*49cdfc7eSAndroid Build Coastguard Worker--------------------- 128*49cdfc7eSAndroid Build Coastguard Worker 129*49cdfc7eSAndroid Build Coastguard WorkerBeyond the "Quick Start" instructions, there are only a few other things 130*49cdfc7eSAndroid Build Coastguard Workerthat should be done. The Linux Test Project build process uses a 131*49cdfc7eSAndroid Build Coastguard Workerminimalist approach. There is a lot of room for improvement and 132*49cdfc7eSAndroid Build Coastguard Workercontributions are welcome. 133*49cdfc7eSAndroid Build Coastguard Worker 134*49cdfc7eSAndroid Build Coastguard Worker1. Log in as root. 135*49cdfc7eSAndroid Build Coastguard Worker 136*49cdfc7eSAndroid Build Coastguard Worker2. Untar the ltp tarball into a spare directory. There is not a 137*49cdfc7eSAndroid Build Coastguard Worker standard location for it yet. We put it in our home directory 138*49cdfc7eSAndroid Build Coastguard Worker while we're working on it. 139*49cdfc7eSAndroid Build Coastguard Worker Note that the full path to this location must be accessible for 140*49cdfc7eSAndroid Build Coastguard Worker unprivileged users, as some tests are run as a different user than root. 141*49cdfc7eSAndroid Build Coastguard Worker Hence /root is not a good choice on several distributions. 142*49cdfc7eSAndroid Build Coastguard Worker 143*49cdfc7eSAndroid Build Coastguard Worker3. Build and install everything, as described above. Note the minimum software 144*49cdfc7eSAndroid Build Coastguard Worker requirements above before doing so. 145*49cdfc7eSAndroid Build Coastguard Worker 146*49cdfc7eSAndroid Build Coastguard Worker4. The disk I/O tests can be run by executing the diskio.sh script. In order 147*49cdfc7eSAndroid Build Coastguard Worker for these tests to successfully operate a writable high-density 3.5" floppy 148*49cdfc7eSAndroid Build Coastguard Worker must be in the disk drive and a CD-ROM with more than 100Mb of data must be 149*49cdfc7eSAndroid Build Coastguard Worker in the CD-ROM drive. The corresponding tests will fail if either disk is 150*49cdfc7eSAndroid Build Coastguard Worker missing. 151*49cdfc7eSAndroid Build Coastguard Worker 152*49cdfc7eSAndroid Build Coastguard Worker5. The network tests related installation see testcases/network/README.md. 153*49cdfc7eSAndroid Build Coastguard Worker 154*49cdfc7eSAndroid Build Coastguard WorkerCross compiling 155*49cdfc7eSAndroid Build Coastguard Worker--------------- 156*49cdfc7eSAndroid Build Coastguard Worker 157*49cdfc7eSAndroid Build Coastguard WorkerTo cross compile, you must specify the correct variables when running configure. 158*49cdfc7eSAndroid Build Coastguard Workere.g. CC, LDFLAGS, etc. 159*49cdfc7eSAndroid Build Coastguard WorkerFor correct pkgconf / pkg-config detection you need to set 160*49cdfc7eSAndroid Build Coastguard WorkerPKG_CONFIG_SYSROOT_DIR=$SYSROOT 161*49cdfc7eSAndroid Build Coastguard Worker 162*49cdfc7eSAndroid Build Coastguard WorkerAfter configure has run, it will generate include/mk/config.mk. You can tweak 163*49cdfc7eSAndroid Build Coastguard Workersettings in there if need be, but you should not specificy settings on the 164*49cdfc7eSAndroid Build Coastguard Workercommand-line when running make. 165*49cdfc7eSAndroid Build Coastguard Worker 166*49cdfc7eSAndroid Build Coastguard Worker32 bit build on 64 bit machine 167*49cdfc7eSAndroid Build Coastguard Worker------------------------------ 168*49cdfc7eSAndroid Build Coastguard Worker 169*49cdfc7eSAndroid Build Coastguard WorkerYou need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR 170*49cdfc7eSAndroid Build Coastguard Worker 171*49cdfc7eSAndroid Build Coastguard Worker* RPM based distributions (openSUSE, Fedora, etc.) 172*49cdfc7eSAndroid Build Coastguard WorkerPKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 173*49cdfc7eSAndroid Build Coastguard Worker 174*49cdfc7eSAndroid Build Coastguard Worker* Debian / Ubuntu and derivates 175*49cdfc7eSAndroid Build Coastguard WorkerPKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 176*49cdfc7eSAndroid Build Coastguard Worker 177*49cdfc7eSAndroid Build Coastguard Worker* Arch Linux 178*49cdfc7eSAndroid Build Coastguard WorkerPKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure 179*49cdfc7eSAndroid Build Coastguard Worker 180*49cdfc7eSAndroid Build Coastguard WorkerAndroid Users 181*49cdfc7eSAndroid Build Coastguard Worker------------- 182*49cdfc7eSAndroid Build Coastguard Worker 183*49cdfc7eSAndroid Build Coastguard WorkerSpecify ANDROID=1 when calling make. Many tests which would otherwise work are 184*49cdfc7eSAndroid Build Coastguard Workercurrently not built because they share a directory with an incompatible test. 185*49cdfc7eSAndroid Build Coastguard Worker 186*49cdfc7eSAndroid Build Coastguard WorkerThe shell scripts expect /bin/sh to exist, so create a symlink. 187*49cdfc7eSAndroid Build Coastguard Worker 188*49cdfc7eSAndroid Build Coastguard WorkerVariables in Makefile 189*49cdfc7eSAndroid Build Coastguard Worker--------------------- 190*49cdfc7eSAndroid Build Coastguard Worker 191*49cdfc7eSAndroid Build Coastguard WorkerThe conventions enforced are standard ones. Here's a quick summary: 192*49cdfc7eSAndroid Build Coastguard Worker 193*49cdfc7eSAndroid Build Coastguard WorkerCFLAGS - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!) 194*49cdfc7eSAndroid Build Coastguard Worker 195*49cdfc7eSAndroid Build Coastguard WorkerCPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP) 196*49cdfc7eSAndroid Build Coastguard Worker functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT 197*49cdfc7eSAndroid Build Coastguard Worker 198*49cdfc7eSAndroid Build Coastguard WorkerLDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT 199*49cdfc7eSAndroid Build Coastguard Worker PUT LIBRARIES IN THIS LIST (see LDLIBS for that). 200*49cdfc7eSAndroid Build Coastguard Worker 201*49cdfc7eSAndroid Build Coastguard WorkerLDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread, 202*49cdfc7eSAndroid Build Coastguard Worker -lltp. 203*49cdfc7eSAndroid Build Coastguard Worker 204*49cdfc7eSAndroid Build Coastguard WorkerFor other variables and more info about the build systems see 205*49cdfc7eSAndroid Build Coastguard Workerdoc/Build-System.asciidoc. 206*49cdfc7eSAndroid Build Coastguard Worker 207*49cdfc7eSAndroid Build Coastguard WorkerCommon Issues 208*49cdfc7eSAndroid Build Coastguard Worker------------- 209*49cdfc7eSAndroid Build Coastguard Worker 210*49cdfc7eSAndroid Build Coastguard WorkerIssue: When executing configure it says: 211*49cdfc7eSAndroid Build Coastguard Worker 212*49cdfc7eSAndroid Build Coastguard Workerchecking for a BSD-compatible install... /usr/bin/install -c 213*49cdfc7eSAndroid Build Coastguard Workerchecking whether build environment is sane... yes 214*49cdfc7eSAndroid Build Coastguard Workerchecking for gawk... gawk 215*49cdfc7eSAndroid Build Coastguard Workerchecking whether make sets $(MAKE)... yes 216*49cdfc7eSAndroid Build Coastguard Workerconfigure: error: cannot run /bin/sh ./config.sub 217*49cdfc7eSAndroid Build Coastguard Worker 218*49cdfc7eSAndroid Build Coastguard WorkerSolution: 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. 219*49cdfc7eSAndroid Build Coastguard Worker 220*49cdfc7eSAndroid Build Coastguard WorkerIssue: When executing make [all] it says: 221*49cdfc7eSAndroid Build Coastguard Worker 222*49cdfc7eSAndroid Build Coastguard Worker " *** No rule to make target `/$*', needed by `pan-all'. Stop." 223*49cdfc7eSAndroid Build Coastguard Worker 224*49cdfc7eSAndroid Build Coastguard WorkerSolution: You must upgrade to make 3.81. Please see the Requirements section above. 225*49cdfc7eSAndroid Build Coastguard Worker 226*49cdfc7eSAndroid Build Coastguard WorkerIssue: When executing make [all] it says something like: 227*49cdfc7eSAndroid Build Coastguard Worker 228*49cdfc7eSAndroid Build Coastguard Worker # ... 229*49cdfc7eSAndroid Build Coastguard Worker install -m 00644 "/scratch/ltp-dev2/ltp/include/test.h" "/scratch/ltp-install12/include/test.h" 230*49cdfc7eSAndroid Build Coastguard Worker install -m 00644 "/scratch/ltp-dev2/ltp/include/tlibio.h" "/scratch/ltp-install12/include/tlibio.h" 231*49cdfc7eSAndroid Build Coastguard Worker install -m 00644 "/scratch/ltp-dev2/ltp/include/usctest.h" "/scratch/ltp-install12/include/usctest.h" 232*49cdfc7eSAndroid Build Coastguard Worker install -m 00644 "/scratch/ltp-dev2/ltp/include/write_log.h" "/scratch/ltp-install12/include/write_log.h" 233*49cdfc7eSAndroid Build Coastguard Worker make[1]: Leaving directory `/scratch/ltp-dev2/ltp/include' 234*49cdfc7eSAndroid Build Coastguard Worker make -C lib -f "/scratch/ltp-dev2/ltp/lib/Makefile" all 235*49cdfc7eSAndroid Build Coastguard Worker make[1]: Entering directory `/scratch/ltp-dev2/ltp/lib' 236*49cdfc7eSAndroid Build Coastguard Worker " *** No rule to make target `dataascii.o', needed by `libltp.a'. Stop." # <-- the error 237*49cdfc7eSAndroid Build Coastguard Worker 238*49cdfc7eSAndroid Build Coastguard WorkerSolution: You cannot build LTP with -r / --no-builtin-rules and/or 239*49cdfc7eSAndroid Build Coastguard Worker -R / --no-builtin-variables specified. LTP relies heavily on built-in 240*49cdfc7eSAndroid Build Coastguard Worker implicit rules and variables to function properly. 241*49cdfc7eSAndroid Build Coastguard Worker 242*49cdfc7eSAndroid Build Coastguard WorkerIssue: When executing make (no target, 3.80), it does the following, and doesn't execute all: 243*49cdfc7eSAndroid Build Coastguard Worker 244*49cdfc7eSAndroid Build Coastguard Worker # 245*49cdfc7eSAndroid Build Coastguard Worker make -C testcases/realtime autotools 246*49cdfc7eSAndroid Build Coastguard Worker make[1]: Entering directory `/scratch/ltp/testcases/realtime' 247*49cdfc7eSAndroid Build Coastguard Worker autoheader 248*49cdfc7eSAndroid Build Coastguard Worker make[1]: Leaving directory `/scratch/ltp/testcases/realtime' 249