Saturday, August 11, 2007

Getting jacORB working

I am back in the land of CORBA once more but with an ancient buggy version of Orbix. In an attempt to escape I thought I would try using jacORB then I could argue that we either use jacORB or a more recent version of Orbix. The great thing about jacORB with it being open source is that I thought it would be easy to try it out and get some basic development. Well that was the theory. The trouble is jacORB has a few wrinkles that caused me a bit of trouble setting things up. I did get it working eventually and it is just great now. Here's what I did:

Mistake number 1: I tried to use the binary distribution. It doesn't work. There are a few essential components missing. Apparantly some other developers have also been hit by this. The ant build of jacORB proceeds quite quickly and painlessly so the lesson here is just use the source distribution and build it using a top level ant build. Problem solved. See bug 765 at for the problems with the binary distribution.

Multiple java SDKs: On machines with multiple java SDKs, where the default one may be an old one, you will need to hack jaco script to avoid this error: Hack the script to force the complete path of a Java 5 compiler.

Edit to specify filename of NS OIR (you have to pick a path).

./ns -Djacorb.naming.ior_filename=

run grid demo:

jaco -cp 
 jaco -cp 

Now it works! Just remember to run your own app using jaco or setting up your own CLASSPATH manually to include all the jacORB jars that are needed.

trouble with xemacs and other X11 apps on solaris

I recently found out the cause for some strange problems on solaris when connecting to it via ssh and then trying to use X11 applications. This was when I tried to get xemacs working on solaris. The problem was that all was well until I tried to use cut-n-paste, including deleting characters or lines in xemacs. As soon as the function was invoked an X11 error message appeared and the application froze. It was necessary to kill xemacs (or whatever the X11 app was) using kill -9. For quite a while I thought it was because somehow I built the app wrongly. Eventually, I found this link with an explanation for cygwin users: It is an FAQ where the question is: X11Forwarding does not work with OpenSSH under Cygwin. This turns out to be generally applicable for users of X11 apps when connected to machines via ssh. It is not specific to cygwin. Just remember to always ssh using the -Y option. Then all will be solved!

Sunday, June 17, 2007

Getting eclipse working on solaris

Why is it so painful to set up eclipse on solaris? I have recently started working with java and although java on MicrosoftWindows is very nice I have to have java working on Solaris. Hence I thought, "let's get eclipse on solaris so I can use its great debugging facility". I put a request in with the helpdesk and left it at that. A couple of weeks later eclipse still hadn't arrived so I thought, "I'll do it myself, how hard can it be?". I have an ancient Ultra5 at home running Solaris 7 so I thought I would install it on that and bring it in on a small USB drive. It turns out the eclipse executable you download from the sun website has all sorts of library dependencies that take a while to get sorted out. But even when those are sorted there are still pitfalls. You would think that with solaris and java being invented by Sun Microsystems the company would find ways to get the things to work together. Well I say, "where's the evidence?". I tried to get eclipse working on my Ultra5 for a couple of weeks now. I just succeeded this weekend. Here is the long and painful story of how I did it: 1) The first step had to to be to abandon using solaris 7. The version of X11 that comes with solaris 7 is just too old. Eclipse has all sorts of problems using the so-called ready-built installs that are around, so there is some build from source needed. However, it turns out that this is just too hard to do on older versions of solaris due to X11 differences. It is easier said than done to get an alternative version of X11 installed. I tried building the latest X11 release 7.2 from source and it will only build with the very latest GCC. Unfortunately there are eclipse components that currently won't build with that version of GCC. So after a week of trying to build X11, install the right version of GCC and build the various parts of GTK that eclipse depends on, I gave up and installed solaris 9. This was also a painful experience but more due to bad luck than anything else. The machine threw a wobbly during the solaris install. I'll admit there was a thunderstorm at the time. Solaris managed to get itself in a state where it tried booting in CPR mode, then shutting down, then rebooting again, only to shutdown again. Apparently, this is rare condition with a very esoteric escape route. On the reboot, type STOP+A to get to the ROM prompt, then enter the command:- set-default boot-file This broke the CPR boot cycle and the system eventually booted normally. It was then I found the file system was corrupt. One very tedious fsck later I was up and running again. 2) Use the famous Freeware for Solaris website, I used to take a macho pride in building all the GNU tools I needed from source, and from knowing about the dependencies between the packages. But the trouble is some packages have become so big and complex that all the components required for a successful build have to be at particular versions, requiring particular versions of the GCC compiler. I can't cope any more. I made heavy use of this wonderful website. I wrote a little shellscript that used wget to suck all the pkgadd packages over in one go. Phew! Then the installs started. Here are the steps I took: a) create /usr/local, create other transfer dir someplace else. b) ftp the unzippd gzip package to the transfer dir from my linux machine (no openssh yet, so have to initiate ftp from linux to solaris). c) pkgadd -d gzipPackage to install into /usr/local/bin. d) ftp all the other packages to the transfer dir e) use gzip to unpack them all. f) Did selective installs of these packages. Started with bash (phew), bzip, gcc, zlib, tar, bison, flex, automake, autoconf, binutils and make. Installed many others that I won't mention here. g) Installed some of the packages eclipse requires, such as glib, atk, libtiff, pango and gtk. h) Tried to start eclipse and found a few libraries still missing, e.g. libglib-2.0, libgmodule-2.0 and libgobject-2.0. Installed glib-2.13.0 which made this problem go away. At last, doing an ldd on the eclipse executable says that all libraries are found. 3) Build gtk+-2.2.4 from source. This step was necessary because it turns out that the version of gtk on the sun freeware site has been built wrongly. Some of the symbols have internal linkage instead of external linkage. This problems shows up as a fatal relocation error, symbol gdk_font_equals not found when you try to run eclipse. The first thing to realise is that when you have to build a GTK component from source, do not make the mistake I did, which was to try to use the most recent version. Use the one closest to what you already have instead. I already tried using the latest GTK components when I was on solaris 7 and there are just too many problems. So I downloaded v2.2.4. It failed to configure. I had pkgadd'd glib1.2.10 but gtk+-2.2.4 requires at least glib-2.1.4. So I pkgadd'd glib-2.13.0 on top which seemed to work. The next problem was configure did not spot that I had installed freetype 2.3.1. This is because freetype changed the way you have to include their header files. I had to hack the configure script to cope, changing the include code to: #include #include FT_FREETYPE_H Next the X11 check failed. This was because the test app was failing to find gethostbyname but the configure script assumed it must be failing to find the X11 symbols. I hacked configure again to force -lsocket -lnsl. Next, it failed to find libexpat. I pkgadd'd it and then, eventually, configure succeeded. At last! Doing a make at this point also failed but the failure was in one of the demo programs. The libraries built so I did a 'make install' and tried to run eclipse. Eclipse said there were no fonts, but at least it ran. 4) Set up X11 fonts. At first I thought the problem was do with the fontconfig install, so I did a build from source of that. But it made no difference. Eventually, I realised that the fontconfig configuration was not being installed in the proper place and was not referring to the X11 fonts that come with solaris. The tipoff is to use the command "xlsfonts", which lists the fonts solaris-X11 knows about, then give the command "fc-list" which gives the fonts fontconfig knows about. The former gave a reasonable list, the latter gave an empty list. The fontconfig install creates the directory /usr/local/etc/fonts. This needs to be symbolically linked to /etc/fonts (which didn't even exist at this point). Then fonts.conf needs to be edited. The command "xset q" shows where the solaris standard X11 install puts its fonts. But beware! Do not add all of these to fonts.conf! Only add the dirs that contain compressed pcf files. Do not mention the directories with the TrueType fonts. If you do then fc-list will hang and so will eclipse. 5) Get JDK1.5.0. At this point eclipse ran but immediately produced an error saying that the JRE is too old. Solaris 9 comes with JRE1.4. This is not recent enough. Come on Sun! Eclipse is THE number 1 java development environment, so please make sure that your downloadable solaris installs support it. Tracking down suitable versions of the JDK is harder than I thought it would be, thanks to sun's confusing website, their mandatory registration proceedure, and the confusing plethora of java environment names (jdk, sdk, j2ee, standard edition, enterprise edition, java studio etc etc etc). Eventually, after a number of false starts, I got hold of which installed ok. 6) Take the rest of the day off. That's it! With the right sun freeware packages installed, with gtk+-2.2.4 built from source, the X11 fonts configured and JDK1.5.0 installed, eclipse is now up and running.

Friday, March 09, 2007

What to do when grub gets in the way of windoze

When you've put linux on a machine it tends to use grub during the boot. This can pose a problem if you decide to revert to windoze. Most windoze install procedures leave the MBR alone. This causes problems because a windoze install usually means at least one reboot during the installation process. If grub is still on the MBR this causes a problem because grub will then try to boot linux but will fail because the windoze install that is partway through overwrote it. At this point the boot tends to hang. Heres how to get around it: and save to a USB flash drive.Download MbrFix ( Whilst linux is still there use the following grub commands: grub> rootnoverify (hd0,0) grub> makeactive grub> chainloader +1 grub> boot Now you can install windoze. When it gets to the boot you will be put into grub again. Use the commands above to let the boot carry on and it will boot windoze. Once windoze has fully installed you need to run a MbrFix . Get it from the flash drive you prepared earlier. Help is builtin. Now grub will be gone and reboots will behave normally!

Sunday, February 11, 2007

postfix email forwarding issues

I tried to configure postfix to use email forwarding, both by postfix configuration and by the use of a .forward file. It failed silently. Eventually I found out that it was the fault of SELinux, which was enabled during my installation of Fedora Core 5. There doesn't seem to be any fix I know off other than turning it off via the command: setenforce 0. With selinux disabled, procmail does invoke my whitelist filter correctly.