Installing the FAN Library onto Ubuntu (or not as the case may be).

Setting up the FAN Library for Ubuntu takes some work. I started by trying to install the Python Scientific Library but this didn’t seem to give the packages I wanted.

sudo apt-get install pyton-scientific

So I then looked at doing it from source.

1) Get the Source files from UNiDAta

wget ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/fan.tar.Z

2) Uncompress them from their delivery package and cd into the src folder.

uncompress fan.tar.Z

tar -xvf fan.tar

cd fan-2.0.3/src

3) Now if you take a moment to read the README and INSTAL files you will realise that you need to install the udunits binaries and development libraries.

sudo apt-get install libudunits2-dev

sudo apt-get install udunits-bin

4) As well as install ingthe netcdf binaries and development libraries

sudo apt-get install libnetcdf-bin

sudo apt-get install netcdf-bin

5) Now you can try and configure the FAN package but before you do there will be things that need configuring such as:

CPP_NETCDF Compiler reference for netCDF header-file, e.g. “-I/usr/local/netcdf/include”. Ubuntu10(ish) /usr/include
CPP_UDUNITS Compiler reference for UDUNITS header-file, e.g. “-I/usr/local/udunits/include”. Ubuntu10(ish) /usr/lib
LD_NETCDF Linker reference for netCDF library, e.g. “-L/usr/local/netcdf/lib -lnetcdf”.
LD_UDUNITS Linker reference for UDUNITS library, e.g. “-L/usr/local/udunits/lib -ludunits”.

And then you can try this

./configure

6) Next try building the install packages

make install

Now at this point I started getting some errors so how did I fix/not fix them. The first error was something to do with MAX_NC_OPEN but I was able to follow this link which appeared to fix the issue. Open the nc header file

pico fanlib/nc.h

and then add this code under the #include entry.

#define MAX_NC_OPEN 32

Rather than just use 32 you can use the script providing on the link above to find out what number your machine can cope with. When I compiled the script and ran it.

gcc sysconf_test.c -o sysconf_test
./sysconf_test

the output was:

daviesc@big-blue:~/software/fan-2.0.3/src$ ./sysconf_text
sysconf _SC_OPEN_MAX says you can use the following:
#define MAX_NC_OPEN 1024

which was perfect so I updated nc.h again. The next error I had was

nasParse.y:30:1: error: initializer element is not constant

which I think was related to my haphazard approach to the Configure section so I went back to step 5 to add some more detail.

One Comment on “Installing the FAN Library onto Ubuntu (or not as the case may be).”

  1. Hi chris,

    I followed your instructions to install the package in my computer. I am running a linux mint maya 13, MATE-64 bits edition. Here is the complete profile of my distribution: Linux version 3.2.0-23-generic (buildd@crested) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu4) ) #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012.
    Everything good until the last error message (nasParse.y:30:1: error: initializer element is not constant) after which I have tried everything with no success. Do you have a hint on how to solve the problem? I was also asked for the location of the xdr library during the configuration process. I would be very grateul if you could help me with this. Many thanks in advance.

    Best regards,

    Sandro Makowski Giannoni

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.