Learn C the Hard Way – Arch is a bastard for this and I’m fine with that

Ex 4.

Valgrind is available in the /extra repository in Arch. We’re going to make it ourselves, though. Fair enough. I’ve made a few packages as far as I recall, but not in a while. When I was initially setting up my machine, inkscape wasn’t so good and I was using inkscape-bzr and now I don’t need that any more.

$ tar -xf <FILE>

is enough to unpack most things. ‘eXtract File’. The tool will work out what sort of file it’s working on and just does it.

$ ./configure

– error. Valgrind works on kernels 2.4 and 2.6 – Arch is a rolling release. I’m on kernel 4.something. Soooo. Package manager it is. At some point I’ll need to work out what about the package has been changed to make it work in Arch. The README.aarch has instructions on cross-compiling and paths and hosts which have a shape that makes sense but I’m not looking at the detail. I’ve used pacman and I have valgrind on the system. I stared at the Makefiles that my attempt generated, though, in the hope of absorbing their strength by drooling. On with the lesson.

The output of valgrind is already similar to Zed’s, but at some point I may diverge – Arch is like that. For now, though, I’m getting error tracking.

By fixing the uninitialised variable in ex 4, I fix all the actual errors. This is odd, as valgrind doesn’t pick up the %d without a related integer, in the first printf function. I can’t see why that might be in the manual. However, I know what the program should say, so I know what to fix. An uninitialised variable is an error that could lead to unexpected problems, and valgrind picks it up. A variable that’s missing could lead to, well, also unexpected problems. But valgrind doesn’t pick it up. Odd. Maybe an Arch thing but I don’t think so. It was not there in Zed’s print-out either.

The compiler tells me what the other problem is, so I’ll deal with that. Variables are now initialised and don’t go unused, and all format sequences are filled.

I did some messing about with making downloaded packages, but I’ve got to look into Arch’s installation process to really understand that. pacman is a powerful tool, and like all powerful tools, it hates me right from the off. I know I can make a package and then have pacman install it from my local file, but for now I’m not using that. Onward, upward, and avoid the Pevensey children on the way.

Leave a Reply

Your email address will not be published. Required fields are marked *