|Perl Monk, Perl Meditation|
How To Downgrade Perl on Ubuntuby Ovid (Cardinal)
|on Jul 30, 2009 at 12:59 UTC||Need Help??|
Ubuntu has recently offered a Perl upgrade to 5.10 and I accidentally accepted the upgrade. Unfortunately, since our development Perl is 5.8.8, I've encountered a few annoying problems. Since many people are confused about how to do this, I decided to slog through and figure it out. Not fun. The answers to the various problems are scattered hither and yon, making this a very unpleasant process.
First, you need to get Perl and apply a regex patch which closes a security hole (many thanks to Rufus Cable for alerting me to the patch):
Be sure to read the INSTALL file for more information about the Configure options.
At this point, everything should be fine, but you can't run make yet. Actually, you can run make, but it will likely fail. Fortunately, you can keep fixing errors and rerunning make until all errors go away.
The first problem is a strange "You haven't done a make depend yet" error. As it turns out, this is because Ubuntu has decided to link /bin/sh to /bin/dash instead of /bin/bash. It's a faster shell, but not only does it not support everything bash does, it also is less tolerant of errors. The makedepend file has an unterminated quote string, so doing this gets you over the first hurdle:sudo ln -s /bin/bash /bin/sh
Be sure to change the symlink back after you're done if you want dash instead of bash (note that using a correct shebang line at the top of your bash scripts makes this a non-issue for you).
If you've already tried to run make, you might see this error:makedepend: Already running, exiting
That's because it previously exited abnormally (anyone remember "abend"?) and left a .depending directory lying around. Simply remove this directory and rerun.
If you run make now, you might hit the second error:No rule to make target `<command-line>', needed by `miniperlmain.o'.
Apparently, we filter out some of the gcc output, but it's changed over time and we missed this. The following fixes it:perl -i~ -nle 'print unless /<command-line>/' makefile x2p/makefile
That command tells perl to edit those files in place, reprinting all lines except those containing the string <command-line>. If for some bizarre reason you don't yet have Perl installed (or if it's broken), you can edit those files manually, but it's tedious and error prone.
You can rerun make and it might be fine, but you might hit this error:SysV.xs:7:25: error: asm/page.h: No such file or directory
Arg! I don't know what this is, but apparently it's related to the linux headers. What I don't understand is that I have them installed (sudo apt-get install linux-headers-$(uname -r)), but page.h is not symlinked in /usr/include/asm/. A locate '/page.h' | grep asm returned many candidates, but the most likely fix seemed like this:sudo ln -s /usr/src/linux-headers-2.6.28-13/arch/x86/include/asm/page.h /usr/include/asm/page.h
Obviously, the exact page.h you're linking to will vary depending on your architecture and kernel.
Assuming all is well and make completes successfully, you can now run make test && make install and you'll have successfully downgraded perl (I would recommend you set your prefix when you run Configure to ensure that you don't overwrite the system perl. You can always set up a symlink to ensure you have the proper Perl running).