Sunday, December 7, 2008

Building Qt 4.4 for RHEL 5

As explained here, I wanted to build RPMs for Qt 4.4 for Red Hat Enterprise Linux 5. Compiling from sources was taking way too much time and was not attracting any developer love.

If you want to use Qt 4.4 with RHEL 5, you'll need an updated version of KDevelop ( > 3.4) too. And that requires an updated version of GDB (v6.8). So you'll need to find those RPMs as well.

Building an RPM is apparently a complicated process and you'll find lots of articles online (some very dated). But there's a way to reuse the packaging generated for Fedora. That way, you don't have to mess with source archives, patches and write spec files from scratch.

Getting the source packages

Koji is Fedora Project's build system. You can checkout source packages from http://koji.fedoraproject.org/koji/ and use it to build on RHEL. Cool, huh? But be aware of possible compatibility issues.
Using the search facility of Koji site, I downloaded the following src.rpm files.
qt-4.4.0-11.fc10.src.rpm
kdevelop-3.5.3-1.fc8.src.rpm
gdb-6.8-23.fc9.src.rpm


In Koji, you'll find packages for several Fedora versions. I'll recommend using the lower Fedora versions (which matches the version of software you are looking for, of course), since RHEL is an old (F6 based) distro. Later Fedora versions may use different package versions or install paths and may cause problems with RHEL.

Preparing the build setup

Information on how to do this can be found in all rpm building tutorials. But I'll put it here too ;-)
1. Create an RPM build directory structure

$ cd ~
$ mkdir myrpms
$ cd myrpms
$ mkdir SOURCES SPECS BUILD SRPMS
$ mkdir -p RPMS/i386 RPMS/athlon RPMS/i486 RPMS/i586 RPMS/i686 RPMS/noarch

2. Create a file named .rpmmacros in your home directory with contents:
%_topdir /home/yourusername/myrpms
or whatever to reflect your settings.

Apparently, this says that you can do all that with:
$ mkdir -p ~/myrpms/{BUILD,RPMS,S{OURCE,PEC,RPM}S}
$ echo -e "%_topdir\t$HOME/myrpms" >> ~/.rpmmacros


Installing the source rpm
$ rpm -ivh qt-4.4.0-11.fc10.src.rpm

The source (and patches) will go to the SOURCES directory, SPEC file in SPECS, and rpms after build will go in the RPMS directory.

Building Qt 4.4

The 'spec' file contains the instructions to the rpmbuild command to build the rpm. Open SPECS/qt.spec and see how it looks like. Note the BuildRequires: lines. Those are the packages that you must have inorder to build a package.
Some spec files will have conditional constructs using which they handle multiple build environments. To compile Qt 4.4 on RHEL 5, do this:
$ cd ~/myrpms/SPECS
$ ls qt.spec
$ rpmbuild --define "webkit:1" --define "rhel 5" -bb qt.spec


Most probably the above command will fail with lots of BuildRequires messages. You need to install all those packages before you can continue. You can make use of EPEL and RPMForge repositories to locate packages that are not in the official RHEL repos. The --define stuff is only required for Qt 4.4, and not for KDevelop, gdb etc. (in case you were wondering!).

In some cases (KDevelop, for example), you'll find that the spec file (originally meant for later versions of Fedora) will require packages like kdelibs3-devel, kdesdk3-devel etc. You need to install kdelibs-devel, kdesdk-devel etc. instead and modify the spec file.

Once you've installed the required packages, execute the rpmbuild command again. If all goes well, you'll see the RPM file in RPMS/ directory. For me it's i386. Try installing the rpm on your machine before you start distributing!

Note on KDevelop 3.5.3

You can find this RPM from http://kdevelop.org. This works fine with RHEL 5. But if you want to customize an RHEL install DVD, don't use that package. It has a self-obsoletion problem which will make the installer fail. Building the RPM by yourself is the only safe way.

Packages I've successfully built
Qt 4.4
KDevelop 3.5.3
GDB 6.8
Kst 1.7

Good luck. Build away..

Update: RHEL 5.3 now comes with gdb 6.8.27. Combined with a new kernel, all issues with debugging are now resolved. Hooray!

Saturday, December 6, 2008

Remastering Red Hat Enterprise Linux 5 DVD

In my office, the Linux buzz is growing, with more and more engineers trying their hand at Qt programming. I've been helping people install Red Hat Enterprise Linux 5 (RHEL 5) and get started with Qt 4. RHEL 5.1 comes with older (aka stable, or proven, as we like to call in our industry) versions of Qt, KDevelop and GDB.

So, to make things easier, I set out to customise an RHEL 5 DVD. My original plan was to create a kick-start file for easier installation. Then I became too ambitious and decided to customise the whole damn thing. After several days of meddling with rpms and xml files, I'm happy to announce SUCCESS!!

This post is meant to be a guide to all those brave souls who wish to do the same. Fear not, comrades, it's not as difficult as it looks like. In fact, if you don't want to build any new RPMs, it's quite easy. You can reportedly use a tool called Revisor to easily customise a Fedora / Red Hat distribution. I'm no sure about the effectiveness of this tool for RHEL, since I want to update and add packages to the base distro. The manual method I describe here involves copying RPM files, editing some XML files (simple) and re-creating the ISO image.
Here we go..


Before we start

I guess it's possible to do this from another installed distro, Fedora for instance. Since I wanted to download additional packages and didn't know how to do that from another distro, I first installed RHEL 5.1 on my machine. All steps I describe were done within that installation.
If you want to add more packages to your custom RHEL, checkout EPEL and RPMForge repositories. You'll find the setup instructions in the repective sites. You'll also need yumdownloader tool from the yum-utils package to download RPM files from the repositories. To install, do:

yum install yum-utils

Similarly, install the following programs/packages:
createrepo - for re-creating the YUM repo information
mkisofs - for creating the ISO image
anaconda-runtime - for inserting the 'media check' checksum

The install media structure

Make a copy of the install media tree. You can either copy files from the DVD, or mount the ISO file and copy from it.
To mount the ISO file:

mount -o loop /path/to/iso/file /path/to/mount/point


Make sure you copy all files. Including the hidden ones. There's one file named .discinfo. Make sure you get that one, otherwise the installer will not recognise your DVD. I'll assume you 've copied all files to some directory named rhel_custom.
The RPMs are located in Client, VT and Workstation directories. The isolinux directory contains files for the boot. We have license for Workstation edition, and so I'll explain for Client and Workstation directories, and I believe the steps are same for VT as well.

The repository information

Let's consider the Client directory. You'll find a directory called repodata which contains the repository information for YUM. You can delete all files except comps-rhel5-client-core.xml from that directory. We will re-create the repo information once we are done customizing.
Open the comps-rhel5-client-core.xml file using a text editor. Don't let the multi-lingual stuff scare you. The file is fairly straight forward. Scan through the first 7-8 lines.
As you can see, this file describes what you see in the package selection step of the installer. the tag defines the group called admin-tools and whose name is Administration Tools. Sound familiar?
Scroll down the the list of translations of the name, and you'll see description, and further down, the default and uservisible values. If default is true, that group will be selected by default. uservisible decides whether the group is visible to the user installing the distro. You'll find that some groups have this set to false.


Now comes the packagelist. Here are two sample lines:

<packagereq type="default">authconfig-gtk</packagereq>
<packagereq type="conditional" requires="aspell">aspell-af</packagereq>


The possible values for type are "mandatory", "default", "optional" and conditional.
Mandatory packages are installed if the group is selected, and won't even show up in the list. Default packages are shown in the list, and selected by default. Optional ones are listed, but not selected by default. Conditional packages are selected if the required package is selected.

Now it must be fairly simple to add a new package. For example, let's say we want to include kchmviewer, a CHM file viewer, to the distro.
We first download the RPM file (I assume you've setup EPEL and RPMForge correctly, and have yum-utils installed).

yumdownloader --resolve kchmviewer

This fetched the kchmviewer-3.1-1.el5.rf.i386.rpm file from RPMForge repo. Depending on your system configuration, it might pull other rpms also. make note of the files downloaded.
Copy the RPM file to the Client directory. If the RPM had dependencies, make sure you copy those files as well. Sometimes, an older version of the same package might be available on the DVD. In that case, you need to delete the old ones and copy the new ones. In short, make sure you don't violate any dependencies. Don't forget to check the Workstation directory too. You'll find that the devel packages for several libraries are available in the Workstation directory.

Once you've copied all necessary RPM file, edit the XML file to add the new package listing. Identify the group to which the package should belong. Select a group, and add an entry in the packagelist, selecting "mandatory", "default" or "optional". The XML file is supposed to be sorted. But don't worry about that now. We'll do an automatic cleanup later.

Sorting the XML files

Once you have a consistent RPM setup and XML files (in Client, Workstation and VT directories), it's time to do cleanup. You'll need a file comps-cleanup.xsl for doing cleanup. Download from https://fedorahosted.org/revisor/browser/conf/comps-cleanup.xsl.
To prepare Client, copy the file to Client/repodata folder, and in a terminal, type:

xsltproc --novalid -o sorted-file.xml comps-cleanup.xsl comps-rhel5-client-core.xml

This will generate sorted-file.xml from the original XML file, printing some information as well. If everything is OK, you can backup the original XML file and rename the sorted file to comps-rhel5-client-core.xml. Delete all other files in 'repodata'.

Repeat the steps for Workstation and VT directories, if you've modified something there too. Note that the XML filenames are different for each directory.

Re-creating the repository information

cd to the Client directory, and do:
createrepo -g repodata/comps-rhel5-client-core.xml .


Repeat the same for Workstation and VT directories (again, note that the XML filenames are different). If all is OK, move on..

Creating the ISO image

All right! Move to the root directory (rhel_custom). Make sure .discinfo file is available there. Issue the following commands:

chmod a+w isolinux/isolinux.bin
find -name TRANS.TBL -exec rm '{}' \;

(Not sure if it is really necessary to delete TRANS.TBL file).

mkisofs -J -T -o ../rhel5_custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -m TRANS.TBL .

../rhel5_custom.iso is obviously the output image file. Change the path if you need to.

Once you have the image file, move to the directory containing the image. Now we need to insert MD5 checksum in to this image. The Anaconda 'media check' feature uses this checksum to verify the integrity of the DVD. If you skip this step, media check will not be available.

/usr/lib/anaconda-runtime/implantisomd5 rhel5_custom.iso


Done!

That's it. Your very own RHEL 5 is ready. Before you burn to a DVD, it's better to test the image using a virtualized environment. Checkout Sun VirtualBox if you've never used one. This way, you need not use physical DVDs to test your distro.

Good luck.

Sunday, November 16, 2008

KNetWalk - A cool KDE game

KDE 4 has a great collection of small games and educational tools. Unlike the edu-package, the games hadn't got much publicity IMHO. I was testing Fedora 10 Preview Release, and I came across this game called KNetWalk.
It's a wonderful game, and I'd strongly recommend you give it a go, if you like those small puzzle-solving games.


The objective of this 'build the network' game is to connect all clients to a server (the icon looks more like the Internet) using wires.
The screenshot explains it well. You can click on the wires (and the server/clients) to rotate them. In the above screenshot, 3 machines have connectivity and 3 don't.
I don't know if the game was in KDE 3.5. Check your KDE to see if it has KNetWalk. The Fedora 10 Preview is looking quite awesome and I can't wait for the final release.

Update: It seems the game is theme-able. In the game settings, there was an electronis theme. Instead of building a LAN, you've to connect ICs to a power cell. Neat..

Sunday, November 9, 2008

Quantum of ugliness

I watched Quantum of Solace a couple of days back. What an ugly movie! I never really liked Bond flicks, but Casino Royale had made me a fan of Daniel Craig. I had high hopes for this one, but it was all too disappointing. I'd rather watch MI 3 than the poorly choreographed action scenes in this one.

The story line is pretty lame and predictable, the action scenes are shaky and badly edited, the bond girl can't act and there are boring chase scenes scattered all over!

Casino Royale had realistic fight scenes. This one has very physical action sequences too, but they are more like cut-scenes and are terrible.

The chase
Bond gets chased on land, water and of course air! The movie opens with a lame car chase, has the all too familiar speed boat chase and an unimpressive airplane chase, with a stupidifying parachute deployment.

Overall, I'd give this one 1/5. It's more of a terrible edit-job than a movie.

Wednesday, October 8, 2008

A trip to remember - Mookambika - Murudeswar - Kudajadri

I've never been an ardent temple goer. Till recently, my visits to the temple coincided with my birthdays. Yup, that's almost once a year.. So, I was not too enthusiastic when ma family planned a trip to Sri Mookambika temple. But the promised trip to Kudajadri wooed me in. My sister and her husband did all the planning and route preparation. I did absolutely no research or enquiries on the planned route or the destinations.. lazy me! അതെ, നാണമില്ല എന്ന് തന്നെ കൂട്ടിക്കോളൂ.. ;-)


We reached Kollur (that's in Karnataka) one evening, and the very next morning had a visit to the temple. The temple near the Sowparnika river is quite serene and peaceful (thanks to proper crowd management).
No photos to publish though.. എന്നാലും, ചെരുപ്പിട്ട പശുവിനെ കണ്ടിട്ടില്ലെങ്കില്‍, ഇതാ ഒരെണ്ണം!


Murudeshwar


After the temple visit, we hired a Scorpio and sped off to Murudeshwar. Murudeshwar is a new generation temple-cum-tourist spot! There are impressive constructions around the small temple. Unlike the Kerala temples, you can wear shirts/pants (but not footwear) to the temple and can even cary your camera inside.
The place is more of a tourist attraction than a temple. There is a huge 249ft tall Raja Gopura at the entrance, flanked by life-sized elephant statues.
The 37m tall Siva statue is also impressive, with some minor (but not small) sculptures scattered around it.
Apart from all these, there's a beautiful beach, a beach-view-restaurant and a big Hotel! Yup, told ya.. it's a new gen temple complex!



The beach was awesome. You can walk several meters in to the sea and the water stays only up to neck-deep. The waves are not very strong either. I've not been to Goa or Mauritious yet, so can't comment on the അന്താരാഷ്ട്ര നിലവാരം of the each ;-) എന്തായാലും ബീച്ചില്‍ ഒരുഗ്രന്‍ കുളി പാസ്സാക്കി..




ഏതാനും ചിത്രങ്ങള്‍ ചുവടെ..















Kudajadri

The next day, we took off to Kudajadri. The only mode if transport is the omnipotent Jeep, and it costs Rs.1400 for a trip. No use bargaining, as one driver explained:
"ഇവിടെ ടോക്കണ്‍ സിസ്റ്റെം ആണ്.. 65 ജീപ്പുകള്‍ ഉണ്ട്.. രണ്ടു ജീപ്പുകള്‍ വീതം സ്റ്റാന്റില്‍ വന്നു കിടക്കും. കോമ്പററീഷന്‍ ഇല്ല, അതുകൊണ്ട് ഫിക്സെഡ് പ്രൈസ്.."
സംഗതി 'clear' ആയതുകൊണ്ട് തര്‍ക്കിച്ചില്ല.. ഞങ്ങളുടെ ഡ്രൈവര്‍ ദിനേശ് എന്ന് പേരായ ഒരു മലയാളി ആയിരുന്നു (ഇവിടെയുള്ള മിക്കവര്‍ക്കും മലയാളം അറിയാം..). നല്ല മനുഷ്യന്‍.. (ഫോട്ടോയില്‍ നടുക്ക് നില്ക്കുന്ന ആള്‍)
ജീപ്പ് എന്ന വാഹനത്തിനോട് ബഹുമാനം തോന്നിയ ഒരു യാത്രയായിരുന്നു അത്.. അതുകൊണ്ടു, അതിന് ഒരു സ്പെഷ്യല്‍ പോസ്റ്റ്.

കുടജാദ്രി ഒരു സുന്ദരമായ സ്ഥലമാണ്. പോകുന്ന വഴിയും അങ്ങനെത്തന്നെ. മഞ്ഞ് നിമിഷങ്ങള്‍ക്കുള്ളില്‍ വന്നും പോയുമിരിക്കും. ജീപ്പ് നിര്‍ത്തുന്ന സ്ഥലത്ത് മൂകാംബികാ ദേവിയുടെ ഒരു ചെറിയ അമ്പലവും, അതിനോടു ചേര്‍ന്ന് ദേവി താരകാസുരനെ വധിക്കാനുപയോഗിച്ചതെന്ന് വിശ്വസിക്കപ്പെടുന്ന ഒരു വലിയ ശൂലവും ഉണ്ട്.
കുടജാദ്രി മലയുടെ മുകളില്‍ 'സര്‍വജ്ഞപീഠം' എന്ന ഒരു ചെറിയ മണ്ഡപവും ശങ്കരാചാര്യരുടെ പ്രതിഷ്ഠയും ഉണ്ട്. ജീപ്പ് നിര്‍ത്തുന്ന സ്ഥാലത്തു നിന്ന് ഏകദേശം 2കി.മീ. നടന്നാല്‍ അവിടെയെത്താം. അതാണ് കുടജാദ്രി മലയുടെ മുകള്‍. നടന്നു പോകാന്‍ വലിയ പ്രയാസമൊന്നുമില്ലാത്ത വഴിയാണ്.






അധികം ആള്‍ക്കാര്‍ പോകാന്‍ ശ്രമിക്കാത്ത 'ചിത്രമൂല' എന്ന ഒരു ഇടം കൂടിയുണ്ട്. It's a tricky descent from the Sarvajnapeetom point. Some places are really steep and slippery. Out of the 100 or so people coming to Kudajadri, less than 10% dare to visit this place. We hesitated for a while and then decided to go on. Even my parents climbed down slippery mountain.
After a while, the terrain got a little too risky for my parents, and they decided to stop there and wait for us. We (me, my sister and brother-in-law) continued on the trail.
The slippery mud-coated terrain was too much for my Woodland shoes, and we all left our shoes and continued barefoot. That turned out to be the wise decision of the day. Barefoot, I managed the terrain with relative ease. So, next time you find your shoes too slippery for a road, try barefoot trekking.



Once we reached the end of the trail, there was a small waterfall, and 'chithramoola' was a cave in the steep vertical rock face of the mountain. There was a 'Sivalinga' in the cave, with water falling from above. നല്ല തണുപ്പുള്ള വെള്ളം.
ആ ചെറിയ ഗുഹക്കുള്ളില്‍ ചാലക്കുടിക്കാരായ രണ്ട് സഞ്ചാരികള്‍ തമ്പടിച്ചിട്ടുണ്ടായിരുന്നു. ഗുഹക്കുള്ളില്‍ ഒന്നു കയറിയിറങ്ങി, തിരിച്ച് സര്‍വജ്ഞപീഠത്തിലേക്ക് ഞങ്ങള്‍ പുറപ്പെട്ടു.
കന്നഡക്കാരായ കുറച്ചു കോളേജ് വിദ്യാര്‍ത്ഥികളെ വഴിയില്‍ കണ്ടു. അവര്‍ കുടജാദ്രിയിലേക്ക് നടന്നു വന്നതായിരുന്നു (ഏകദേശം 12കി.മീ.). ഒരു കന്നഡ സിനിമ കുടജാദ്രിയില്‍ വച്ചു ഷൂട്ട് ചെയ്തതില്‍പിന്നെ ഒരുപാട് കോളേജ് പിള്ളേര്‍ വരുന്നുണ്ടെന്ന് ദിനേശ് പറഞ്ഞു.
ഉച്ച വൈകി ഞങ്ങള്‍ തിരികെ കൊല്ലൂരിലെത്തി. അധികം താമസിക്കാതെ ഉഡുപ്പിയിലേക്ക് ബസ്സ് കയറുകയും ചെയ്തു. ഉഡുപ്പിയിലെ വിശേഷങ്ങള്‍ അധികം താമസിപ്പിക്കാതെ എഴുതുന്നതാണ്.

Monday, October 6, 2008

The Jeep has a new fan


The Mahindra & Mahindra Jeep is a very popular vehicle around here. The Police use it, and so do the Miltary (at least they used to). The M&M Jeep can be found almost everywhere in Kerala (and throughout India, I'm told), and is a hot favourite in high-range areas.

I had a trip to കുടജാദ്രി (Kudajadri or Kodachadri) a couple of days back, and now the Jeep has a new ardent fan - me!

The Jeep is a famous off-road vehicle. I've been impressed by it's performance and the so called hanuman gear (in the 4x4 version) during our trip to Paithalmala last month.

But this was a whole new experience for me. The road was virtually non-existant, and our 2x2 Jeep did the 10km climb with ease.

It was rocking journey, quite literally. Dinesh, our driver (ഒരു നല്ല മലയാളി), told us that the Jeep is quite rugged and the only maintenance it requires are the occasional broken leaf springs and pierced fuel tanks.

The previous day, we had asked the driver of a Mahindra Scorpio if he could drive us to Kudajadri. "ഈ വണ്ടിയില്‍ അങ്ങോട്ട് പോയാല്‍ പിന്നെ വാപസ് വരില്ല" was his honest reply.

തിരിച്ചു വീട്ടില്‍ എത്തിയപ്പോള്‍ ഞാന്‍ 'ജീപ്പ്' എന്ന വാഹനത്തെക്കുറിച്ചു ഒരു ചെറിയ research നടത്തി. It seems Mahindra started assembling Willys-Overland Jeeps. In the late 50's and early 60's the demand for Jeeps soared and M&M keeps making them to this day (models named Naya Commander and Major).

അറിയാന്‍ പറ്റിയ മറ്റൊരു കാര്യം, റ്റാറ്റ-യെപ്പോലെ മഹീന്ദ്രക്കും ഒരു വിദേശ പേരിനോട് കമ്പം! - ഏതാണെന്നോ? സാക്ഷാല്‍ Hummer! വലിയ ഭാവി കാണാത്തത് കൊണ്ടു GM ചിലപ്പോള്‍ അത് വില്കാന്‍ ഇടയുണ്ടത്രേ!

Who knows.. Tomorrow we'll see Tata Land Rover and Mahindra Hummer competing on Indian (off-)roads!

ഏതാനും ലിങ്കുകള്‍:

http://en.wikipedia.org/wiki/Jeep
http://www.film.queensu.ca/Cj3b/World/India.html
http://www.film.queensu.ca/Cj3b/World/India2.html
http://www.film.queensu.ca/Cj3b/World/MahindraJp.html
http://en.wikipedia.org/wiki/Hummer

Update: GM has sold the Hummer brand to China-based Sichuan Tengzhong Heavy Industrial Machinery Company Ltd. ഒരു പക്ഷേ മഹീന്ദ്ര രക്ഷപ്പെട്ടു എന്ന് പറയുന്നതായിരിക്കും ശരി! എന്തായാലും കഴിഞ്ഞ ആഴ്ച നെടുമങ്ങാടിനടുത്ത് വച്ച് ഒരു ഹമ്മര്‍ കാണാനിടയായി. അത്ര പോര ;-)