Wednesday, 14 July 2010

LAP - Toolchain, Part 5 - TCL, Expect, DejaGNU

OK, I am getting a bit fed up of bintuils and gcc by now, so I am glad to see that we are moving on to something new.  The next package to install is another language, like c or c++.  This is called Tool Command Language.  Other packages are going to use it in the future.

tar -xzvf $LFS/sources/tcl8.5.8-src.tar.gz
cd tcl8.5.8

Note, we have to use the [z] option instead of [j] because this is a gzipped file, not a bzip2'd file.  Also, note that, helpfully, when you unpack the file it unpacks to /tcl8.5.8, NOT /tcl8.5.8-src as you may have been led to believe.

If you have a look in the folder you will not find a configure script, you need to change to the unix directory first, before running what is now a standard configure/make command.

cd unix
./configure --prefix=/tools
make $CORES_TO_USE

Something we have touched on in passing so far are test suites.  These are command that you run on compiled software AFTER compilation but BEFORE installation.  They are supposed to tell you if something has gone wrong, but in my experience they give you lots of frightening looking warnings  which actually have no significance at all.  Ordinarily with the toolchain software we do not need to bother with running tests – other than the careful tests that GCC is working properly.  Still, we want to be thorough so lets do one now:

TZ=UTC make test

The [TZ=UTC] bit means Timezone=Universal Central Time.  The output of all that makes no sense to me whatsoever, but there do not appear to be any ERROR ERROR MUST KILL HUMAN RACE type messages.  Now just install the compiled programs:

make install

The software that we are installing comes with stuff called 'debugging symbols' included.  I am not entirely sure what these are, but in my mind they are little signs that programs hold up when they have turned pear shaped saying things like 'ooops' and 'my bad', and 'I shouldn't have done that should I?'.  These are not necessary, because I have no fucking intention of debugging any thing.  Later on we will be removing these debugging symbols to free up space.  We need to write enable one of the files we just installed so that we can change it later on.

chmod -v u+w /tools/lib/libtcl8.5.so

That [ch]anges the [mod]e of the file by allowing the current [u]ser to [w]rite to it.  Next we need to install Tcl's private headers.  I am not entirely sure what a private header is, but it probably involves a sealed room and a prostitute.

make install-private-headers

The program we have installed has its version number attached to it, which means some other software may not be able to find it, so lets just symbolic link away the problem, and then clean up.

ln -sv tclsh8.5 /tools/bin/tclsh
cd ../..
rm -rvf tcl8.5.8

Next up is Expect.  This is an extension to the TCL package we just installed.

tar -xzvf $LFS/sources/expect-5.43.0.tar.gz
cd expect-5.43

Patch away a bug that causes problems with GCC, and some sort of other bug that the book is curiously reticent about.

patch -Np1 -i $LFS/sources/expect-5.43.0-spawn-1.patch
patch -Np1 -i $LFS/sources/expect-5.43.0-tcl_8.5.5_fix-1.patch

Warning, more sed crap coming up!  Again, we edit a file (the configure script) to force it not to use the host system stuff, and then run the configure script.

cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig > configure
./configure --prefix=/tools --with-tcl=/tools/lib --with-tclinclude=/tools/include --with-x=no

The first two options make sure that this extension to TCL knows about the TCL we have just installed.  The last option tells it that we have not yet installed the 'X' window system.

make
make test

I've not bothered with the $CORES setting for this, as it takes a whopping 7 seconds to run on my 1.6Ghz celeron single threaded. I ended up with:

Files with failing tests: logfile.test send.test spawn.test

I have done everything right so far, so I am going to ignore that.  And according to the book failures are not surprising and not critical.  So why did we run the tests again?  Anyway, when we install the software we tell it not to install any scripts:

make SCRIPTS="" install
cd ..
rm -rvf expect-5.43 

Next is DejaGNU.  This is a package based on TCL and Expect which assist with running tests.

tar -xzvf $LFS/sources/dejagnu-1.4.4.tar.gz
cd dejagnu-1.4.4
./configure --prefix=/tools
make install
make check

The output of the check is unclear, it tells me that it expected 62 tests to pass, but brilliantly fails to tell me how many actually passed.  That's it though, just the clear up to go.

cd ..
rm -rvf dejagnu-1.4.4

No comments:

Post a Comment