jeudi 12 novembre 2009

CNS installation on Ubuntu Jaunty

Crystallography & NMR System (CNS)
http://cns.csb.yale.edu/v1.2/
CNS installation on Ubuntu Jaunty

I don’t if I’m the only one, but it appears tricky for me to compile properly cns under Ubuntu Jaunty.
It requires gfortran 4.1, which is not longer supported by ubuntu jaunty. I tried with more recent gfortan version but with no success.

So I had to build the gfortran-4.1 myself from this depository:
https://launchpad.net/ubuntu/hardy/i386/gfortran-4.1/4.1.2-21ubuntu1
After few downloads and installations, I succeed to build properly with all dependencies gfortran-4.1.
the command line is

sudo dpkg -i nom_du_package.deb

My next steps was to tell to cns to use the right gfortran. thus I created a specific makefile based on the one provide by cns.

To do so you have to go under

cns_solve_1.21/intel-i686-linux/

and create a makefile like this:

###############################################################################
# #
# Machine dependent Makefile header for CNSsolve #
# Paul Adams 20-10-98 #
# copyright Yale University #
# #
###############################################################################

# fortran options
F77 = gfortran-4.1
F77STD = -w
F77OPT = -O3 $(CNS_MALIGN_I86) -funroll-loops -ffast-math
F77FLAGS = $(F77STD) $(F77OPT) $(EXT_F77FLAGS) $(F77BUG)

# C options
CC = gcc
CCFLAGS = -O -DCNS_ARCH_TYPE_$(CNS_ARCH_TYPE) $(EXT_CCFLAGS)

# link options
LD = gfortran-4.1
LDFLAGS = -w $(EXT_LDFLAGS)

# utility programs
compile-utils:
@ cd $(CNS_INST)/utils; \
make utils F77="$(F77)" CC="$(CC)" \
F77FLAGS="-w -O" CCFLAGS="-O" \
F77LINK="" CCLINK="-lm"

#==============================================================================

And name it

Makefile.header.2.gfortran-4.1

Note: that my gcc version is 4.3 but doesn’t seems to be a problem.

After that it’s straight forward:
You go in your cns installation folder and run

make install compiler=gfortran-4.1

It will peak the right Makefile from cns_solve_1.21/intel-i686-linux/
and it should work.

Alternatively you could also change the symlink for gfortran towards the 4.1 version. But I don’t like messing around with the symlink.
You have to be super user remove the previous one and make the new one under :

/usr/bin/

Something like “ln -s nom_pointé nom_du_symlink »

ln –s gfortran-4.1 gfortran

However i didn't tested so i don't know if it's working or not.....

Aucun commentaire:

Enregistrer un commentaire