Thursday, 22 November 2007

Fun and games with gfortran and the NAG library

I am trying to install the NAG library at work to run with gfortran. The problem is that it won't work with the old version of gfortran (4.1.2), which is the only package available for my version of the Mandriva linux kernel (2007). I had to update gfortran to 4.2.0 or better. First I needed to find out which kernel version I had (32 bit or 64 bit on a 64-bit processor?). I typed:
cat /etc/issue
which seemed to tell me that I have a 32 bit kernel. An alternative is to try:
uname =a
I then downloaded the 32 bit gfortran binaries for Linux, and saved them in a temporary file. I then changed to the directory in which I wished to install them:
cd /etc
Next I un-tarred them:
tar -zxvf $temp_folder_path/gfortran-linux.tar.gz
/etc/irun/bin/gfortran -v
told me all about the new version I had installed. When trying to compile my test code, I had to explicitly give the path to the new version, otherwise it used the old version (haven't worked out how to change this yet!)
/etc/irun/bin/gfortran -o test test.f90
So far, so good, but when I tried to run it:
The computer screamed:
./test: error while loading shared libraries: cannot open shared object file: No such file or directory
ldd test
showed me which libraries the program calls, and which (might) be missing. To solve this:
export LD_LIBRARY_FLAG=/etc/irun/lib
and similarly...
export LD_LIBRARY_PATH=/etc/irun/lib
To see what the variables contain:
More fun to come, as I try and get the NAG library to work...

No comments: