Contents |
We've finally made it to where we can try to make make again - Has it been an exciting experiance yet? Well, we left off at a decent pausing point, so this is where we pick up -
But building make with make installed, even to get just our own hand-polished version, seems kind of redundant. So we need to get rid of our packaged make.
removepkg /var/log/packages/make-3.81-i486-1
Now, we can ./configure and, following the advice snippeted from the documentation, try ./build.sh!
./build.sh
If we ls, we'll see we now have a make! if we ./make check, we'll find it passes its one internal regression test - which is good. But, without perl, we can't run a real make check.
make check on make to make sure make makes properly. (Sorry, little joke there.)
Now we need to install make
./make DESTDIR=/tmp/make install
ginstall -d /tmp/make/usr/doc/make-3.81
cp {ABOUT-NLS,AUTHORS,COPYING,ChangeLog,INSTALL,NEWS,README} /tmp/make/usr/doc/make-3.81
cd /tmp/make
mv usr/local/* usr/
rm -Rf usr/local
cd usr
gzip -9 man/*/*
gzip -9 info/*
strip --strip-uneeded bin/make
In this case, strip unneeded changes the size from 416K to 140K. Significant change. Now, ls -lR and check your permissions. Decide for yourself if they look good or not. Do any other preparation you need to do. When you're ready, makepkg and installpkg.
Test it with a make --version - Mine works.
It's a GNU FSF package. You can get it from gnu.org, of course. ./configure and make it. To install, use make DESTDIR=/tmp/diff install. Then, cp {ABOUT-NLS,AUTHORS,COPYING,INSTALLME,NEWS,README,THANKS} /tmp/diff/usr/doc/diffutils-2.8.1/ -- You need to have made the directory tree /tmp/diff/usr/doc/diffutils-2.8.1 first.
Cd /tmp/diff, and gzip usr/man/*/* -9 and usr/info/*. Strip usr/bin/*. Remember to ls -lR and check permissions - It's just a good habit to get in to. make and install the package - I'm sure you know how to by now.
We finally have what we need to check unifdef - cd into its' directory, and make check. Mine quickly passes all 3 tests - We now know that we can keep it around. Next, we want to double-check make - Which means we need PERL.
PERL is a big package.
There's an environment variable called CFLAGS. There's one similar to it, called CXXFLAGS. They both override compile flags for their respective file types on most programs. There's a number of things to think about - size vs. speed. On a VSP Link1 account, I'm interested in size, so I'm going to include -Os, which means optimize for size. I also want everything optimized for the architecture I'm on, so I'm going to toss -march=native in there. It means, basically, "Optimize for whatever we're on." So, I would run a command like this:
export CFLAGS="-Os -march=native" && CXXFLAGS=$CFLAGS
Generally, if something needs something esoteric like -felide-constructors, then it's going to either override or ignore then environment variables, or it's going to put it's own CFLAGS before yours so that yours will override anything both yours and theirs sets.
Go into your wget directory, and then ./configure and make. Everything should work just fine this time. However, if we make check, we get an error message that msgfmt is missing. Now, we have no list of installed packages that we can check against, but we do have the /usr/doc directory that everything (should generally) install some documents in. Looking at /usr/doc reveals we do not appear to have gettext installed.
Gettext wants ncurses, and expat. It will use its own versions of various other programs, so we'll ignore them for now. Lots and lots of things want ncurses. So we'll get ncurses. But we want to try wget, just to see if it works. So, cd into your ~. I have wget decompressed into ~, so the command I run will look like this:
wget-1.11.4/src/wget http://ftpmirror.gnu.org/ncurses/ncurses-5.7.tar.gz
Mine worked - does yours? Good stuff. We're pretty sure it works, we can use it, but we don't want to really install it until we can test it.
Decompress your ncurses tar.gz, and cd into it. Then ./configure --prefix=/usr and make.
Make will fail with an error that it can't find c++. In reality, it can't find any C++ compiler. What we need is one called g++. We could compile it ourselves, but we're still missing too many requirements to be comfortable doing that - and we have no ability (yet) to build the test harness that big projects like that use, in any case. So we'll install another package. It's in the d set of slackware packages, this time, g++.
gcc-g++-4.2.3-i486-1.tgz to be precise. Go snag it. I used wget again, this time to retrieve the file over http - It worked. installpkg it. Go back into your ncurses source directory.
make distclean
We know that ncurses failed to realize that not having a c++ compiler was a problem. We know the compile got seriously broken. We also know, if we dig a bit, that our c++ comiler is actually called g++, and ncurses errored out looking for c++. So we know it got that wrong. We don't know, and don't care to find out, what else it got wrong - so we use the distclean make target, which restores the source tree to "virgin" condition - i.e. it is now distribution-ready clean. ./configure --prefix=/usr --with-shared && make again.
Personally, at this point, I'm tired of seeing tons of output I'm not interested in, so I filter it:
function confy if ./configure $* > configurate.txt 2>&1; then echo "configure $* successful."; else echo "failure configuring $*."; tail -n 20 configurate.txt; fi;
Now if I type "confy --prefix=/usr --with-shared" in ncurses tree, this is what I see:
root@darkstar:~/ncurses-5.7# confy --prefix=/usr configure --prefix=/usr --with-shared successful. root@darkstar:~/ncurses-5.7#
It makes things simpler. You can do the same kind of thing for make, I call mine makes.
Ncurses does not have a test suite, per say. The easiest way to really test it is to run this command:
test/fireworks
Ctrl+C when you're satisfied it works. You can use test/rain as well, but don't let it run for long - This can use a bit of bandwidth.
make DESTDIR=/tmp/ncurses install
We want to cp ANNOUNCE,INSTALL,AUTHORS,MANIFEST,NEWS,README into /tmp/ncurses/usr/doc/ncurses-5.7
It should be noted, if you like html help files, ncurses has them. Copy them into your package, wherever you want them to show up if you want them.
ncurses is vital to programs we'll need to administrate if /usr is ever unavailable. mv ./usr/lib into ./lib
A quick check in man shows us ncurses was kind enough to gzip everything for us already. Nice of them.
Now, I don't want to strip everything by hand anymore, so here's a little cut 'n' paste you can use to make your own function and alias, or your own .sh file to run, to automagically strip everything strippable in deeper directories then the one we're in.
find . | while read filename; do
if [ -x $filename ]; then
if file $filename | grep shared | grep "not stripped"> /dev/null;
then
strip --strip-unneeded $filename;
fi;
fi;
done;
We can use du -sh . to check the size of everything - and we find out it's 12M uncompressed. After we makepkg it, it is only 2.3M in size - Impressive compression, is it not?
Now, we need to check for expat - The easiest way to do that is this:
cd / find . | grep expat
We find that it is, indeed, installed.
Get the package, ./configure --prefix=/usr, and make it. make test.
For once, (Drink more coffee and rejoice!) we do not have any problems running make test! But, seriously, get some coffee. You're going to sit there and wait a little while, while all the possible tests run. make DESTDIR=/tmp/gettext to install. Make your doc dir and install the specific text files there. mv lib .. and then strip everything in usr/bin and lib. mv usr/share/man so it's in usr/man. Same for info.
Just CD into it and make check. Then make test. It passes the 8 built in tests and then tries to execute the px test cases and fails - which is absolutely fine. Those exist for people who might find them useful, and are designed to be run by hand. wget passed its own internal checks and tests, and that's fine by us.
Don't forget to cp {AUTHORS,COPYING,ChangeLog,ChangeLog.README,DISTFILES,INSTALL,MAILING-LIST,NEWS,README} /tmp/wget/usr/doc/wget-1.11.4/ before you cd over there. Move info out of the share directory. Move etc so it'll install to /etc, then move the rc file to wgetrc.new - We'll write a script that includes something like if ! [ -e /etc/wgetrc ] then mv /etc/wgetrc.new /etc/wgetrc; so we don't overwrite anybodies favorite wgetrc file by mistake (Should we have to reinstall it in the future.)
cd /tmp/wget mkdir install cd install cat - >> doinst.sh << EOF ( if ! [ -e /etc/wgetrc ]; then mv /etc/wgetrc.new /etc/wgetrc; fi; ) EOF
Don't forget to ls -lR and strip everything that's applicable.
Makepkg it. Install it. ls /etc/wget* to make sure it installed properly - And it did.
There's only one thing left to wrap up before we move on - And that is making check on make, to make sure make makes properly. Sorry, I love saying things like that. Have some coffee, the next steps will take awhile.
Get it from here if you havn't already. Decompress it and get into the directory. The build system for perl is very different then what we're used to. The hint for how I decided to do this was, once again, "What did Pat do?"
./Configure -de -Dprefix=/usr -Dvendorprefix=/usr -Dcccdlflags='-fPIC' -Doptimize="$CFLAGS" \ -Dpager='/usr/bin/less -isr' -Darchname=Slackware-linux
Once that's done, do make. Hang out for awhile, call a friend, drink some joe. I like joe. Joe is good. When it's done making, make check (of course.) It will test itself really rather exhaustively.
I got one test failure, and followed up by running the full perl test harness. It passed the full 80204 tests, and maked the ones that couldn't be run because of a failure to allocate memory as skipped - all tests passed. Good enough for me.
The Perl package will use 53M uncompressed. After gzipping the man pages for install, we shave 10MB, down to 43. Stripping saves us another MB. When we're done, we're left with a 14MB install .tgz. Nifty.
So does make make make like make should make make? I love coffee. Anyway, now we get to make check on make. 351 tests in 96 categories later, no test failures. Even make says :-)
Now that we've had an adventure in recursive troubleshooting, we've tested everything and found our judgement calls to be sound, and we've exhaustively tested any number of things, we have pretty much a handbuild compilation environment. The only things we have installed from the slackware distribution are gcc and g++, and we reinstalled glibc to get the headers it should come with. Some day, we'll tackle rebuilding gcc for bragging rights, but for right now we'll just move on.
M4 is not only a nice gun, not just a celestial object, (and probably other things too), it's also the name of a turing-equivalent implementation of the traditional Unix macro-expansion program, according to gnu. It's also a requirement for autoconf, which is the program that generates the configure scripts we've frequently been using thus far. Get it, of course from [gnu.org gnu].
Set your prefix up appropriately, and make the program. I used --enable-threads=posix as well, since a multithreaded m4 on these VPSLink accounts makes sense.
Make check will take a little bit. It should pretty much pass everything.
I've gotten tired of ls -lR | less'ing everything, so here's a little one-liner that shows you all directory names, total sizes, and the names of any files that are not a directory (drwxr-xr-x) root.root or a file (-rw-r--r--) root.root - In other words, it'll show you all executables and properly permissioned libraries (since .so shared objects should be +x). It will not show you library archive (.la) files, because honestly, in linux, libtool library archives aren't really required to compile things very well.
ls -lR * | while read filename; do if ! echo $filename | grep "\-rw\-r\-\-r\-\-" | \ grep "root root" > /dev/null 2>&1; then if ! echo $filename | \ grep "drwxr\-xr\-x" | grep "root root" > /dev/null 2>&1; then echo $filename; fi; fi; done;
Here is its output for my m4:
usr: total 16 usr/bin: total 92 -rwxr-xr-x 1 root root 88460 2008-11-17 08:58 m4* usr/doc: total 4 usr/doc/m4-1.4.12: total 100 usr/info: total 104 usr/man: total 4 usr/man/man1: total 4
Make your package and install it.
Autoconf is the file that makes configuration scripts! Very useful. It is what we're building next. Test #51 fails. Spent a day searching for the bug.
Slackware 12.1 Bash has a bug in how it is parsing things. This results in expressions which SHOULD NOT be evaluated being evaluated. For example, when this bug kicks in, cat - >> filename << EOF, lines like
if [ $1 == "ls" ]; then do foo; fi;
may come out being
if [ == "ls" ]; then do foo; fi;
in the file itself.
This will be a pre-req for Bash. Made with --prefix=/usr. It doesn't have any shared libraries, and the binaries are only partially shared. This is normal for this package. Passed all tests, all times. Needed to regenerate a yacc parser for Bash 3.2 after all the patches are applied. Straightforward.
needed to generate the info pages in bash; none of the documentation gets installed without it, be careful. All tests passed. make DESTDIR=foo install.
Please, read the INSTALL file before you makepkg it, else you will end up with a nonfunctional texinfo. You've been warned! (If you can't figure it out, make the package and install it. Try to use info, read the error message, then read INSTALL again.)
Bash errors on make check in run-test test on lines 152 and 158, returning false instead of the expected true.
Basically, it (correctly) detects user does not actually have read access to /dev/fd/0 and /dev/stdin - Being as we're sort of in a virtual machine, and based off what I know about OpenVZ, I wouldn't have expected access to those files. Deciphering the four different files that are all sort of used at once to generate and then compare output (as well as deleting the files made during testing), it's taken me yet more hours to figure out this error, which is absolutely spurious and nothing to worry about. Spurious, FURIOUS!
Used the following command line to install all the patches before making.
find ../bash-patches/ | grep -v sig | sort | grep bash32 | while read patchname; do patch -Rp1 < $patchname; done;
When packaging, don't forget to move bash from usr/bin to bin, and ln -sf usr/bin/bash -> /bin/bash.
Do NOT uninstall the pre-existing bash package. use installpkg to overwrite it in this case. Otherwise, your default shell will go poof, possibly leaving you with a useless shell unless you know some ssh magic to switch out from the default shell with no environment parsing... Which is a pain.
Oh, and you'd have had to install that alternate shell yourself. We don't seem to get tcsh or anything by default.
After autoconf, we have automake.
Again, it's GNU software, so get it from the usual suspect. ./configure --prefix=/usr, make it, make check, and...
What, we have two errors?
Get a cup of coffee, I'll explain.
One error is instsh2.test, which failed simply because you're running it as root. There's several tests that can't be run as root, and this is one of them. This bug is fixed in automake 1.10.2.
The other error is mdate5.test - At least, it will fail if you, like me, forgot to update /etc/localtime with a new file out of /usr/share/zoneinfo. Either link the file or copy it over to /etc/localtime, and not only will the time be displayed properly, the "date" command won't tell you to use zic anymore. zic is actually only useful if you need to compile a new timezone definition. It won't install one to /etc/localtime for you.
Head back into autoconf and make check again. Some more tests should make, testing it in conjunction with automake. All tests should still pass. Pretty simple, we like to drink coffee, making check in something "Just to make sure" is a wonderful way to get more.
Things like GCC have dependancies on things like gmp. Snag it over here, and decompress it.
My CFLAGS is set to "-march=native -mmmx -msse -msse2 -maccumulate-outgoing-args -Os -mtune i686", and I exported ABI=32. This will allow gmp to build correctly, since we're using a 32bit ABI in slackware 12.1 but under a 64bit CPU, we need to enforce the information that hey, we really do want to be a 32bit binary with no 64bit math - We can't really access that under a 32bit kernel very effectively - not and maintain the ABI to other programs too!
Multi-Precision Floating Point math with correct Rounding. MPFR. Also used by gcc and such, depends on GMP. I didn't change my CFLAGS for this. It was pretty simple - tests don't take long on this either, unlike automake! You know the drill.
gperf does one thing, and one thing only - It generates perfect hash function and data structure. In a word, "Find something with 1 probe." When you're dealing with a large mash of data, a perfect hash is the only way.
If we're going to compile really complex things, we need to be able to handle really complex test suites. Just goes to reason, right? Well, the really complex testsuites are written in expect for DejaGNU, which means before we can build either we need TCL.
TCL 8.5.5 was the current stable release at the time of writing. In the unix subdir, execute the command "autoconf" - we might as well use one of our shiny new tools, even if the logical among us would inform us, candidly, while sipping coffee and looking over their pierce-nez spectacles, that there is no need to generate a new configure script when one is already there. But whatever, right?
I passed these options to mine:
--enable-man-compression=bzip2 --enable-threads --enable-shared --prefix=/usr
Now, this one I decompressed to /usr/local/src, because a segment of the test suite needs to be run as !root. Here's my results:
all.tcl: Total 24284 Passed 23303 Skipped 981 Failed 0
Your usual DESTDIR will work... Mostly. But then you need to tack this on the next line:
make DESTDIR=/tmp/tcl install-private-headers
And, it is now shiny and installed! Mmmm eggnog milkshake.
You can get it from this government site. It's a language for testing interactive things, ultimately - When you get this output, you provide this input, &c.
Now, for some nuts and bolts: In tcl 8.5, some things which had been extern or global were changed to module scope. This would've been fine, but (according to my understanding) expect had been muddying the namespace. As a result, expect won't compile against tcl 8.5.x.
Occasionally, when you run into strange situations, the LFS folks are a good idea of people to eyeball for a fix. Nine times out of ten, they don't have anything, but if a search for your strange bug turns up their site, check it out. Sometimes, like in this case, they have a patch. Here's the ones we want:
LFS expect patch to fix TCL 8.5.5 compatability.
Now, if you've removed the tcl8.5.5 source directory, your configure commandline will need to include --with-tclinclude=/usr/include or wherever you have the private TCL headers installed. To make INSTALL_ROOT=/tmp/expect, you will also have had to use --with-tcl=/usr/lib for it to find the libs. Otherwise, it gets all confused.
Basically, it's an old, touchy, but very valuable tool. Oh, and the test suite for make check on this one? Don't bother, it's effectively not there for us. It was never finished anyway.
It's a Gnu tool. Go snag it, you should know where by now. And, you're starting to see, I'm sure, why some people call it GNU/Linux - Many, if not the vast majority of the every day tools are from GNU FSF.
Go ahead and configure and make it. Now, for the catch:
DejaGNU is tested by DejaGNU. So, without a working DejaGNU, you can't test a new DejaGNU.
Go ahead and package & install it on blind faith. THEN make check. I saw 62 passes, which is great.
If you're naive, you can get guile here. If you're canny, you can get guile here. If you have mastered Ctrl-U, then you know it doesn't matter which you get, cause there's only 01 kinds of people... In big endian! (10 is little endian.) Mmm, Coffee.
I started off tossing --prefix=/usr --without-64-calls --with-gnu-ld --with-threads at configure. Now, it doesn't matter what you toss at it - You'll discover we're missing LIBTOOL! But hey, we can handle that, can't we?
Again, this is a FSF file. Snag it from your usual suspect.
Basic configure, basic make. Make check gave me 103 tests passed, so it should be pretty functional. Build your package and install it
This time, configure should be successful. Make test gave me lots of successes, a few expected failures, and a couple unresolved. Good enough.
Yet another "good thing to have around." It's from Gnu, again, so go snag it.
Autogen can link to libxml2. libxml2 can link to python. Python can link to all sorts of things.
We'll forgo libxml2 at this time and tackle that later.
Pretty simple. It's another Gnu program. Get it, configure it, make {,check} it. I got no failures. Package & install.
Here we run into a bundle of worms. Slackware 12.1 still uses tetex. It's obsolete. Pat said he's planning on moving over to something else for slack 13, however, almost nobody uses tex, and tex live (the generally recommended replacement) is pretty huge. i don't want to spend 300MB of bandwidth on TeX. So I'm not installing it. Also, I'm not going to be doing typesetting and such on this system, and I don't know much about it, and I don't want to spend hours figuring out how it works tonight.
We have everything we need (sans tex for dvi and ps/pdf documentation, but who uses those?) installed, except for one thing.
We don't have SVN, CVS, or GIT, which are some of the tools used to get development sources that aren't a release (Sometimes, useful.)
However, these have dependencies we don't really have installed yet. And their dependancies (Such as apache, APXS2, openssl, &c) are outside the realm of a compiling environment.
See my next article - Making a livable system! Bring some coffee.