Software Adventures:Building XCrySDen

There is nothing worse then obscure software with even more obscure dependencies. It just leads you down deep and dark holes, so its good to have a flashlight.

A user requested XCrySDen for their class, along with a few other visualization tools, but this one was the most difficult. It nicely has a prebuild binary, but its dynamically linked, thus it requires a few libraries to exist. I like stand alone statically linked binaries, just so much easier. Anyways this program depends on something called meschach(how do you pronouce that?).

Again a great example of when a scientist makes software vs when a software developer makes software. The package isn’t even tar’ed correctly, it extracts out into the current directory(Its convention for a tar file to extract into a new directory, keeping things clean). Then the configure script doesn’t work, can’t find gcc, and a header file is missing an include statement for stdio.h. Wow, a mess.

Luckily as with most things I wasn’t the only one who had to deal with this. Using this page as a starting point, I was able to get XCrySDen working.

The page details how to fix those problems, though use CC=”gcc -fPIC”, the rest of that line isnt needed as it doesn’t work. Run configure, then edit the make file to have the following added/modified:

basic: part1 part2 libpart

libpart: $(LIST1) $(LIST2)
       gcc -shared -o libmeschach.so.1.2 *.o

Then run “make basic”

Considering I put most stuff in /opt, i created /opt/lib and put the new library there. Though XCrySDen still isn’t done. Install tcl-devel and tk-devel, but even that isn’t enough. Using ln, make links to libtk.so and libtcl.so to libtk8.5.so.0 and libtcl8.5.so.0 respectivily in /opt/lib. I then create a file, xcrysden.sh, in /etc/profile.d and include the following:

LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH

Then XCrySDen should work.