Monthly Archives: October 2008

Testing the gold linker on Mozilla

I decided it is time to do something that isn’t Fedora or JBoss related. I noticed that Dave Humphrey would like to test the new Gold linker included in binutils with Firefox.

I used kvm test this.
I launched kvm with sudo qemu-kvm -hda gold-tests -cdrom F10-Snap2-i686-Live.iso -boot d -smp 2 -m 3500. I installed the required software to build Firefox then make 2 additional copies of the hard disk image, giving me three in total. One as backup, one for regular ld and one for gold. I compiled binutils from source without using RPM because this is a one off test system which I don’t care about breaking. If I was going to continue using this system I would have modified the package descriptor for binutils to enable gold.

The Following packages were installed to facilitate compilation:

  • groupinstall “Development Tools”
  • gtk2-devel
  • libXt-devel
  • freetype-devel
  • dbus-glib-devel
  • alsa-lib-devel
  • curl-devel
  • ORBit2-devel

According to this news list post when you compile binutils you either get the regular linker or the gold linker. To do this you specify --enable-gold when running ./configure. I am going to install binutils using both to test both with the same version of binutils. I will start from my clean image each time.

Since the version of binutils in my installation is different to my tarball, i used the –version option to verify that it installed successfully. As suggested in the original contributions page, I will export LD=gold as an environmental variable, but only on the vm with gold for obvious reasons. I am compiling firefox with the default options from the tarball as ./configure --prefix=/home/jhford --enable-application=browser; time make -j8 -s > ~/mozbuildtime; make install. I also bumped my -smp flag to 4 to match my host and to ensure I get the best possible performance out of my vms.

Here is the time for a non-gold build.

real 9m3.720s
user 4m28.562s
sys 11m1.834s

And the times for a gold build I aliased ld to ‘ld –threads –thread-count 4′ for these runs as well as exporting LD=gold.

real 8m41.445s
user 4m18.749s
sys 10m45.263s

Initially, I was getting that gold was cutting my builds in half, but it turns out I accidentally did make with j4 instead of j8. I found that consistently, gold builds were faster but not by a substantial enough amount to justify having to manually enable it in your package manager of choice.

Packaging JBoss 0.1 Goes Sizzle

I have finished my 0.1 release. I have posted the deliverables on my zenit wiki project page I start off by downloading the tarballs of JBoss from sourceforge. I later found out that these aren’t sufficient during my meeting with Deepak and Andrew. They informed me that in the java world, most tarballs aren’t able to build, but instead are for source code review. I wrote a script that would check out the source from the subversion repository and make a tarball. After I did this I ran the build scripts in my checkout to ensure my system is capable of building the software. To do the dependency chart part of my 0.1, I went into my build’s maven2 repository and wrote a perl script to turn the jar paths into an HTML table which I then manually reviewed. I then converted it to wiki markup and put it on the Fedora wiki.

During my meeting with Andrew and Deepak, I learned that the JBoss build system uses Apache Ant with Build Magic to drive the build and Maven 2 to satisfy dependencies. This complicates my work because I will have to modify the build scripts to use a special version of maven (mvn-jpp) instead of the normal maven (mvn). This special verison of maven is designed to be used offline with the jpackage-utils package tools. Normally, maven will download dependencies if they aren’t in the local repository. If packages that JBoss depends on don’t have a pom.xml (maven configuration) this will complicate dependencies as I understand it. I will be looking at the JPackage JBoss 4 packages to see how they did this, providing maven was used in JBoss4.

I also wrote a simple specfile which intalls JBoss. This package definition is severely broken in it’s contents, but it is a fully formed and rpmlint passing rpm. I plan to read the Apache Tomcat specfile to see how it was packaged to get some ideas. An init script needs to be written to control the server startup and shutdown as well as appropriate symlinks to the JBoss directoryies. I need to learn Apache Ant, Build Magic and Maven a lot more than I do currently and I will likely spend a significant amount of time this reading week on these applications. I also need to figure out which jars JBoss depends on are already on the system and if they are satisfactory for running JBoss against.

For my 0.2 release, I’d like to do some more reading and work before I declare my goals. I will also be at the Free Software and Open Source Symposium this coming Thursday and Friday where I will hopefully get a chance to meet some JBoss and RedHat people.

KVM Woes

Today I decided that I was going to install a rawhide instance at school. I wanted to do this for a multitude of reasons. Chris suggested that I use KVM and libvirtd/virt-manager instead of VirtualBox (what I usually use). I have had a little experience with this, but I have never had a specific reason to use it over VirtualBox. First off, Chris suggested that I use an LVMvolume instead of an image file. To do this he suggested the command lvcreate china --name rawhide1 --size 20G where china is the volume group’s name. I have used LVM before but only through anaconda. After this, when creating my VM, I just pointed to /dev/china/rawhide1 for my image file. This seems like a great way of doing it, as by my limited understanding of LVM, this volume would be relatively easy to transition to bare metal. Once completed, I started running my VM and noticed that it was painfully slow, Qemu slow. Qemu is a full emulation virtualizer unlike KVM, KQemu, VirtualBox and Xen. Like VirtualBox, however, KVM uses Qemu as a base.

I was almost certain that my virt-manager wasn’t using KVM. I tried to modprobe the kvm module, but when I did this I saw in my dmesg output that it was disabled in the BIOS. After setting it to enabled in the bios I restarted my machine, modprobed kvm and noticed it was the same speed. After this, I tried running qemu-kvm which is the executable to launch a kvm virtual machine outside of virt-manager. This gave me an error that /dev/kvm did not exist and that kvm would be disabled. Part of the problem with this method of diagnosis is that I wasn’t running with super user permissions which are required to read/write to this interface. This seems to have been one of my many seniors moments as I have run into similar issues before.

I finally figured it out I beleive. I have played around with this at home and noticed a couple things regarding kvm:

  1. Always select the exact same architecture that your host is running. (i.e. If your os is 64bit, use x86_64 only even though your CPU can run a 32bit system
  2. Always run qemu-kvm with superuser permissions if you want to use KVM
  3. Check dmesg for useful messages, generally piping dmesg to grep with the module name (dmesg | grep kvm) will be a good first step
  4. When running virt-manager and you want to ensure you are using kvm, a great check is to run ps -ef | grep qemu. If you get results, make sure the executable name is qemu-kvm. Anything else that isn’t qemu-kvm is NOT kvm in any way shape or form. This sounds silly, but with all the symlinking you can get confused
  5. Check that your bios is set up as you think it should be

After all this, I have decided that I really like KVM and might even replace my VirtualBox habit with it. The main advantages I see are that it is a fully free solution (i.e. no Sun PUEL) and it integrates really tightly with Fedora. It also implements startup service which VirtualBox sorely lacks. I am really excited for when DomU (host) Xen support is fixed for Fedora 10 and I can test out paravirtualization. All and all, if you have hardware that supports it and want a free solution give this a shot.

Declaring 0.1 Goals

This past Tuesday I was lucky enough to meet Andrew and Deepak from Red Hat’s Toronto office. They are both heavily involved with Fedora and both work on packaging Java projects for Fedora. After a presentation about packaging in Fedora given to the LUX program which I sat in on, I met with Chris Tyler, Andrew and Deepak in one of our meeting rooms.

Basically, I was able to get help in developing a game plan for the rest of the semester. For my 0.1 release, what I would like to have done is a Spec file which installs JBoss AS with all binary and dependant files. This will serve as a starting point. From there, I would like to build a dependency chart. For this release, I will hopefully become a Fedora Package Maintainer. I have submitted a spec file to Fedora’s bugzilla and created all the accounts I need to become a contributor.

Compiz on Fedora 9

Since switching to Fedora I have figured out how to configure everything the way I like it, except for Compiz. I found that while Compiz works with Fedora out of the box, it isn’t configured as I like it, and the tool included only has support to enable a desktop cube and wobbly windows. The annoying thing is that there is a great program called ccsm (Compiz Config Settings Manager) which works out of the box on Ubuntu but wouldn’t work for me in Fedora. The program ran exactly as it should but none of the settings were applied. I started by installing fusion-icon and starting it. After doing this, I found that I had no window decorations. I fixed this by installing compiz-gnome which provides a program called gtk-window-decorator. This progam decorates windows, but it uses a very plain decoration which I don’t particularly like. My next attempt was to install the beryl emerald them engine. I have never liked emerald because of the themes available. I really wanted my metacity themes in compiz. After googling for a while, i struck gold! There is a gconf key to set gtk-window-decorator to use metacity themes

Here is the command to change the required key:
gconftool-2 -s /apps/gwd/use_metacity_theme -t bool true

Thanks to ‘David’ for his post on OSDir.com