[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20040910: environment variable for netcdf



>From: "Lawrence Lim" <address@hidden>
>Organization: ?
>Keywords: 200409100551.i8A5punJ014156

Lawrence,

>Good afternoon. I am a student from Singapore and currently on a project 
>that requires the use of netcdf. As the project needs to be done on Linux 
>and I am new to this OS. Moreover I am unfamiliar with the setting of 
>environment, may I know where can I set the environment variable in order to 
>install netcdf?

The way one sets an environment variable in Linux/Unix depends on the
shell being used.  So, the first thing to do is see what shell
you are using:

- first, login to a Linux session and type:

echo $SHELL

  This should come back with something that looks like:

  /bin/bash
   -- or --
  /bin/tcsh
   -- or --
  /bin/csh

- the next thing you need to decide is which interfaces you want to
  build the netCDF for.  The choices are C, C++, Fortran 77, and Fortran 90
  A typical build under Linux uses the gcc C compiler, the g77 Fortran 77
  compiler, and the g++ C++ compiler.

- after you know what shell you are using and which interface(s) you
  want to build, you will be able to set the environment variables needed
  to build the netCDF.  Here are two examples:

  C (gcc), Fortran 77 (g77) and C++ (g++) interfaces when shell is /bin/bash:

  export CC=/usr/bin/gcc
  export CPPFLAGS=-Df2cFortran
  export CFLAGS=-O
  export FC=/usr/bin/g77
  export FFLAGS=-Wno-globals
  export CXX=/usr/bin/g++

  C (gcc), Fortran 77 (g77) and C++ (g++) interfaces when shell is /bin/csh:

  setenv CC /usr/bin/gcc
  setenv CPPFLAGS -Df2cFortran
  setenv CFLAGS -O
  setenv FC /usr/bin/g77
  setenv FFLAGS -Wno-globals
  setenv CXX /usr/bin/g++

If you are using other compilers, like the PGI Fortran compiler, you will
need to modify one or more of these enviroment variable settings.  More
complete information can be found in the netCDF installation web pages:

Unidata HomePage
http://my.unidata.ucar.edu
  Software
  http://my.unidata.ucar.edu/content/software
    netCDF
    http://my.unidata.ucar.edu/content/software/netcdf
      Installation instructions for C, Fortran, and C++ libraries
      
http://my.unidata.ucar.edu/content/software/netcdf/INSTALL.html?unidata=85b90ed748fe7a714514decf0d96ae53

>Sorry for inconvenience caused.
>Thank you.

No worries.

Cheers,

Tom Yoksas
--
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.