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

Re: Netcdf on red hat Linux



Hi Xuguang,

> I am trying to install netCDF library on red hat Linux using Portland
> Group's pgf90 compiler.  I defined the enviroment variables as below:
> 
> CC=pgcc
> CPPFLAGS=-DpgiFortran
> CFLAGS=-g
> FC=pgf90
> FFLAGS="-g -w"
> CXX=pgCC
> 
> pgcc and pgCC are the Portland Group's c compiler and c++ compiler,
> respectively.  My g++ compiler can not find iostream.h and strstream.h
> files.  It seems g++ does not work well in my machine.  That's why I
> decided to use pgCC.   

Note that you the C and Fortran part of the library will still work
fine without the C++ interface, so unless you actually have C++
programs that call netCDF, you can always just disable the compilation
and testing of the netCDF C++ interface by setting the environment
variable

  CXX=""

before invoking the configure script (after removing config.cache and
running "make clean").

However, assuming you need the C++ interface ...

> When the 'make all' command was invoked, warnings and
> errors happened in the 'cxx' directory.  
> 
> warnings like: 
> *************************************************************************
> pgCC -c -g  -I../libsrc  -DpgiFortran ncvalues.cc (ALL .cc FILES)
> ncvalues.cc:
> "ncvalues.hh", line 40: warning: integer conversion resulted in a change
> of
>           sign
>   static const ncbyte ncBad_byte = NC_FILL_BYTE;
> *************************************************************************
> 
> errors like:
> *************************************************************************
> pgCC -o nctst -I../libsrc  -DpgiFortran -g   nctst.o libnetcdf_c++.a
> -L../libsrc -lnetcdf 
> libnetcdf_c++.a(ncvalues.o): In function `NcValues_ncbyte::print(
> const(std::basic_ostream__tm__31_cQ2_3std20char_traits__tm__2_c &))':
> ncvalues.o(.text+0x9bf): undefined reference to
> `_cZ1Z::__ls__tm__30_Q2_3std20char_traits__tm__2_c__3stdFRQ2_3std25
> basic_ostream__tm__5_cZ1ZUc_RQ2_3std25basic_ostream__tm(void)'
> *************************************************************************
> 
> Did you meet the same problem before?  Could you give me a hand? Thanks a
> lot!

Bill McKie <address@hidden> encountered the same problem, see

  http://www.unidata.ucar.edu/glimpse/netcdf/3201

and the only solution he found was to use g++ instead of pgCC.  We
haven't heard whether anyone else has gotten pgCC to work, but we
don't have pgCC here, so we can't duplicate the problem unfortunately.

We just use "c++" for the C++ compiler with Linux, and it seems to
work fine.  I think that's a link to g++.  Here's the settings we used
for netCDF 3.4 on Redhat Linux 2.2.6 and an i686 platform

CPPFLAGS="-DNDEBUG -Df2cFortran"
CFLAGS=-O
FC=/usr/bin/fort77
FFLAGS="-O -Nx400 -w"

where we didn't even specify CC or CXX but instead let the configure
script find "cc" and "c++".  But I doubt that it's possible to use
pgcc for the C compiler and c++ for the C++ compiler.  I've appended
the results of running the configure script on that platform, in case
that's of any help ...

--Russ

_____________________________________________________________________

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

creating cache ./config.cache
checking for m4... m4
checking for xlc... no
checking for c89... no
checking for acc... no
checking for cc... cc
checking C compiler... works
checking how to make dependencies... false
checking for CC... no
checking for cxx... no
checking for c++... c++
checking C++ compiler "c++"... works
checking how to run the C preprocessor... cc -E
checking user-defined Fortran compiler "/usr/bin/fort77"... works
checking for Fortran .F compiler... 
checking if Fortran compiler handles *.F files... yes
checking for C-equivalent to Fortran routine "SUB"... sub_
checking for Fortran "byte"... yes
checking for Fortran "integer*2"... yes
checking if Fortran "byte" is C "signed char"... yes
checking if Fortran "byte" is C "short"... no
checking if Fortran "byte" is C "int"... no
checking if Fortran "byte" is C "long"... no
checking if Fortran "integer*2" is C "short"... yes
checking if Fortran "integer*2" is C "int"... no
checking if Fortran "integer*2" is C "long"... no
checking if Fortran "integer" is C "int"... yes
checking if Fortran "real" is C "float"... yes
checking if Fortran "doubleprecision" is C "double"... yes
checking for Fortran-equivalent to netCDF "byte"... byte
checking for Fortran-equivalent to netCDF "short"... integer*2
checking for math library
checking for -lc... no
checking for -lm... yes
checking for ar... ar
checking for ranlib... ranlib
checking for stdlib.h... yes
checking for sys/types.h... yes
checking for strerror... yes
checking whether cross-compiling... no
checking for working ftruncate()... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for st_blksize in struct stat... yes
checking for IEEE floating point format... yes
checking for ANSI C header files... yes
checking for size_t... yes
checking for off_t... yes
checking for ssize_t... yes
checking for ptrdiff_t... yes
checking for uchar... no
checking whether char is unsigned... no
checking whether byte ordering is bigendian... no
checking size of short... 2
checking size of int... 4
checking size of long... 4
checking size of float... 4
checking size of double... 8
checking size of off_t... 4
checking size of size_t... 4
checking for manual-page index command... 
checking binary distribution directory... /home/ftp/pub/binary/linux_2.2-i686
updating cache ./config.cache
creating ./config.status
creating macros.make
udcreating fortran/nfconfig.inc
creating libsrc/ncconfig.h