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

Re: 960126: shared netCDF library on Linux



>Organization: University of Utrecht (The Netherlands)
>Keywords: 199601260826.AA05869 netCDF Linux

Hi Richard,

> I have just installed the netCDF library (version 2.4pl6) without 
> any problems! This wasn't the case with earlier versions. Thanks.
> I didn't install the Fortran part because g77 doesn't recognize 
> INTEGER*2 (known bug), and I do not have f2c.
> The C and C++ part are compiled without any problems using gcc,
> g++, flex and bison. 

Great, thanks for letting us know this worked.  We don't have a Linux
platform to test on, so this is useful to know.

> I have also installed a shared netcdf-library, which is useful
> when you are running more than one application linked with the 
> netcdf-library. I have attached a script which compiles a shared
> netcdf-library and recompiles ncdump and ncgen. It should be used 
> after the suggested compilation method, NOT followed by a "make 
> clean".

Thanks for the script.  At one time, we tried to distribute versions of
Makefiles that made shared libraries on all platforms that supported them,
but there were so many different ways to do this that we ultimately gave up
on trying to support building the netCDF libraries as shared libraries by
default.  But having your message in our e-mail support archive may help
someone else who needs to do this on Linux.

--Russ

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu

> #!/bin/sh -x
> #
> # Date:    20-Jan-96
> #
> # Purpose: 1) make a shared netCDF library using the gcc compiler
> #          2) recompile ncdump and ncgen with the shared library
> #
> # Use:     Compile the netCDF software
> #          I have used: - CC=gcc
> #                       - CFLAGS='-O2 -m486 -fPIC'
> #                       - CXX=g++
> #                       - FC=
> #                       - OS=linux
> #          Type "make_shared"
> #          Install ncdum and ncgen by hand otherwise they are recompiled
> #          which the static library!
> #
> # Note:    only tested on a Linux-PC, gcc 2.7.2, ELF
> #               ---> NO FORTRAN SUPPORT!!!  <---
> #
> # Author:  R.M. van Hees
> #          email address@hidden
> # 
> MAJOR_VERSION="2"
> MINOR_VERSION="4"
> PATCH_VERSION="6"
> 
> SH_NAME="libnetcdf.so"
> SH_LIB="${SH_NAME}.${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
> SH_BUILD="-shared -Wl,-soname,${SH_NAME}.${MAJOR_VERSION}"
> SH_OBJ='array.o attr.o cdf.o dim.o file.o iarray.o error.o globdef.o putget.o 
> putgetg.o sharray.o string.o var.o xdrposix.o'
> 
> cd libsrc
> gcc ${SH_BUILD} -o ${SH_LIB} ${SH_OBJ}
> ln -sf ${SH_LIB} ${SH_NAME}.${MAJOR_VERSION}
> ln -sf ${SH_NAME}.${MAJOR_VERSION} ${SH_NAME}
> cd ..
> 
> cd ncdump
> rm ncdump
> gcc -o ncdump ncdump.o vardata.o dumplib.o -L../libsrc -lnetcdf
> strip ncdump
> cd ..
> 
> cd ncgen
> rm ncgen
> gcc -o ncgen main.o load.o ncgentab.o escapes.o getfill.o init.o close.o 
> genlib.o -L../libsrc -lnetcdf
> strip ncgen
> cd ..
> 
> - --------------73865C1E390B--
> 
> 
> ------- End of Forwarded Message
>