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

20040131: Installation Problem of netCDF package



>From: address@hidden
>Organization: Buffalo
>Keywords: 200401311709.i0VH9NAl013525 netCDF f77 g77

Vikas,

>My name is Vikas Patel and I am currently doing research in which I am 
>required to use the netCDF package. But I am having some trouble with 
>it. I have a fortran program [sbbx2nc.f - attached], which converts 
>binary data file into netCDF file using g77 compiler. Now, the program 
>is compiled fine [command to compile: g77 -c -I/usr/include 
>sbbx2nc.f], but when I run the program [command to run: g77 -w -o 
>sbbx2nc sbbx2nc.o /usr/lib/libnetcdf.a], I get errors [e.g. 
>Undefined                       first referenced
> symbol                             in file
>nf_create__                         sbbx2nc.o]

In looking through the log files you attached, I see that you built
the netCDF library using the Sun compilers, but are trying to use the
g77 compiler to compile and link your module, sbbx2nc.f.  I suspect
that the entry points in libnetcdf.a have a single trailing underscore
while the code compiled with g77 expects to see two (i.e., nf_create__
versus nf_create_).

Note that the output in test.log shows that the Fortran test routine
builds and runs fine using the Sun Fortran compiler: it finds and uses
nf_create with no problems:

   ...
  
  Making `test' in directory /home/unmdue/vkpatel/netcdf-3.5.1-beta13/src/libsrc
  
   ...
  
  c89 -c -O   -DNDEBUG fortlib.c
  f77 -o nf_test   test_get.o    test_put.o      nf_error.o      nf_test.o      
 test_read.o     test_write.o    util.o  fortlib.o ../libsrc/libnetcdf.a  -lm 
  ./nf_test -c
  ./nf_test
  *** Testing nf_strerror ... 
  *** Testing nf_open ... 
  *** Testing nf_close ... 
  *** Testing nf_inq ... 
  *** Testing nf_inq_dimid ... 
  *** Testing nf_inq_dim ... 
  *** Testing nf_inq_dimlen ... 
  *** Testing nf_inq_dimname ... 
  *** Testing nf_inq_varid ... 
  *** Testing nf_inq_var ... 
  *** Testing nf_inq_natts ... 
  *** Testing nf_inq_ndims ... 
  *** Testing nf_inq_nvars ... 
  *** Testing nf_inq_unlimdim ... 
  *** Testing nf_inq_vardimid ... 
  *** Testing nf_inq_varname ... 
  *** Testing nf_inq_varnatts ... 
  *** Testing nf_inq_varndims ... 
  *** Testing nf_inq_vartype ... 
  *** Testing nf_get_var1_text ... 
  *** Testing nf_get_var1_int1 ... 
  *** Testing nf_get_var1_int2 ... 
  *** Testing nf_get_var1_int ... 
  *** Testing nf_get_var1_real ... 
  *** Testing nf_get_var1_double ... 
  *** Testing nf_get_var_text ... 
  *** Testing nf_get_var_int1 ... 
  *** Testing nf_get_var_int2 ... 
  *** Testing nf_get_var_int ... 
  *** Testing nf_get_var_real ... 
  *** Testing nf_get_var_double ... 
  *** Testing nf_get_vara_text ... 
  *** Testing nf_get_vara_int1 ... 
  *** Testing nf_get_vara_int2 ... 
  *** Testing nf_get_vara_int ... 
  *** Testing nf_get_vara_real ... 
  *** Testing nf_get_vara_double ... 
  *** Testing nf_get_vars_text ... 
  *** Testing nf_get_vars_int1 ... 
  *** Testing nf_get_vars_int2 ... 
  *** Testing nf_get_vars_int ... 
  *** Testing nf_get_vars_real ... 
  *** Testing nf_get_vars_double ... 
  *** Testing nf_get_varm_text ... 
  *** Testing nf_get_varm_int1 ... 
  *** Testing nf_get_varm_int2 ... 
  *** Testing nf_get_varm_int ... 
  *** Testing nf_get_varm_real ... 
  *** Testing nf_get_varm_double ... 
  *** Testing nf_get_att_text ... 
  *** Testing nf_get_att_int1 ... 
  *** Testing nf_get_att_int2 ... 
  *** Testing nf_get_att_int ... 
  *** Testing nf_get_att_real ... 
  *** Testing nf_get_att_double ... 
  *** Testing nf_inq_att ... 
  *** Testing nf_inq_attname ... 
  *** Testing nf_inq_attid ... 
  *** Testing nf_inq_attlen ... 
  *** Testing nf_inq_atttype ... 
  *** Testing nf_create ... 
  *** Testing nf_redef ... 
  *** Testing nf_enddef ... 
  *** Testing nf_sync ... 
  *** Testing nf_abort ... 
  *** Testing nf_def_dim ... 
  *** Testing nf_rename_dim ... 
  *** Testing nf_def_var ... 
  *** Testing nf_put_var1_text ... 
  *** Testing nf_put_var1_int1 ... 
  *** Testing nf_put_var1_int2 ... 
  *** Testing nf_put_var1_int ... 
  *** Testing nf_put_var1_real ... 
  *** Testing nf_put_var1_double ... 
  *** Testing nf_put_var_text ... 
  *** Testing nf_put_var_int1 ... 
  *** Testing nf_put_var_int2 ... 
  *** Testing nf_put_var_int ... 
  *** Testing nf_put_var_real ... 
  *** Testing nf_put_var_double ... 
  *** Testing nf_put_vara_text ... 
  *** Testing nf_put_vara_int1 ... 
  *** Testing nf_put_vara_int2 ... 
  *** Testing nf_put_vara_int ... 
  *** Testing nf_put_vara_real ... 
  *** Testing nf_put_vara_double ... 
  *** Testing nf_put_vars_text ... 
  *** Testing nf_put_vars_int1 ... 
  *** Testing nf_put_vars_int2 ... 
  *** Testing nf_put_vars_int ... 
  *** Testing nf_put_vars_real ... 
  *** Testing nf_put_vars_double ... 
  *** Testing nf_put_varm_text ... 
  *** Testing nf_put_varm_int1 ... 
  *** Testing nf_put_varm_int2 ... 
  *** Testing nf_put_varm_int ... 
  *** Testing nf_put_varm_real ... 
  *** Testing nf_put_varm_double ... 
  *** Testing nf_rename_var ... 
  *** Testing nf_put_att_text ... 
  *** Testing nf_put_att_int1 ... 
  *** Testing nf_put_att_int2 ... 
  *** Testing nf_put_att_int ... 
  *** Testing nf_put_att_real ... 
  *** Testing nf_put_att_double ... 
  *** Testing nf_copy_att ... 
  *** Testing nf_rename_att ... 
  *** Testing nf_del_att ... 
  *** Testing nf_set_fill ... 
   Total number of failures:   0
  *** Success ***
  
  Returning to directory /home/unmdue/vkpatel/netcdf-3.5.1-beta13/src
  
  
  Making `test' in directory 
/home/unmdue/vkpatel/netcdf-3.5.1-beta13/src/fortran
  
  ar cru ../libsrc/libnetcdf.a fort-attio.o      fort-control.o  fort-dim.o     
 fort-genatt.o   fort-geninq.o   fort-genvar.o   fort-lib.o      fort-misc.o    
 fort-v2compat.o         fort-vario.o    fort-var1io.o   fort-varaio.o   
fort-varmio.o   fort-varsio.o
  ranlib ../libsrc/libnetcdf.a
  f77 -o ftest   ftest.o ../libsrc/libnetcdf.a  
  ./ftest
  *** Testing nccre ...
  *** Testing ncddef ...
  *** Testing ncvdef ...
  *** Testing ncapt, ncaptc ...
  *** Testing ncclos ...
  *** Testing ncvpt1 ...
  *** Testing ncvgt1 ...
  *** Testing ncvpt ...
  *** Testing ncopn, ncinq, ncdinq, ncvinq, ncanam, ncainq ...
  *** Testing ncvgt, ncvgtc ...
  *** Testing ncagt, ncagtc ...
  *** Testing ncredf, ncdren, ncvren, ncaren, ncendf ...
  *** Testing ncacpy ...
  *** Testing ncadel ...
  *** Testing fill values ...
  
  Returning to directory /home/unmdue/vkpatel/netcdf-3.5.1-beta13/src


There are two simple solutions to the situation you are in now:

1) compile your module using the Sun f77 compiler

2) rebuild libnetcdf.a using g77 as the Fortran compiler.  Note that
   this will require that you specify the -Df2cFortran flag in
   the Unix environment variable CPPFLAGS _before_ you create
   the new netCDF library:

   make distclean
   <define CPPFLAGS correctly>
   ./configure
   make
   
Option 1) is probably the first thing to try since you already have
a libnetcdf.a built using the Sun f77 compiler.

>I do not know if there is a problem in the program or in the 
>installation of the netCDF package.

The problem lies in your mixing use of Sun Fortran and g77.

>The program works fine on Mac OS 
>X, but it is not available to me. So, it may be the case where the 
>netCDF pacakge is not compatible with my system.

The netCDF runs with no problems on Sun systems.

>Following is the list 
>of information, which you require to find out if there is any 
>installation problem.
>
>A. SunOS yeager.cse.Buffalo.EDU 5.9 Generic_112233-08 sun4u sparc 
>SUNW, Ultra-4
>
>B. 3.5.1-beta13
>
>C. macros.make - attached
>
>D. C compiler: /opt/SUNWspro/bin/c89
>   Fortran compilers: /opt/SUNWspro/bin/f77
>                      /opt/SUNWspro/bin/f90
>                      /oldutil/bin/g77
>   C++ compiler: /opt/SUNWspro/bin/CC
>
>E. configure.log - attached
>F. config.log - attached
>G. make.log - attached
>H. test.log - attached
>
>Please let me know if I have installation problem or any other problem 
>regarding the netCDF package and the solution for it.
>
>Thank you for your help.
>
>Sincerely,
>Vikas Patel.
>---MOQ10755689631b9c65ba382ceaef8f364e0a2d57b6a6
>Content-Type: text/plain; name="macros.make"
>Content-Transfer-Encoding: 8bit
>Content-Disposition: attachment; filename="macros.make"
>
># $Id: macros.make.in,v 1.33 2001/07/11 16:30:33 steve Exp $
>
># The purpose of this file is to contain common make(1) macros.
># It should be processed by every execution of that utility.
>
>
># POSIX shell.  Shouldn't be necessary -- but is under IRIX 5.3.
>SHELL          = /bin/sh
>
>
># Installation Directories:
>SRCDIR         = /home/unmdue/vkpatel/netcdf-3.5.1-beta13/src
>prefix         = ..
>exec_prefix    = $(prefix)
>INCDIR         = $(exec_prefix)/include
>LIBDIR         = $(exec_prefix)/lib
>BINDIR         = $(exec_prefix)/bin
>MANDIR         = $(prefix)/man
>
>
># Preprocessing:
>M4             = m4
>M4FLAGS                = -B10000
>CPP            = c89 -E
>CPPFLAGS       = $(INCLUDES) $(DEFINES) -DNDEBUG
>FPP            = 
>FPPFLAGS       = 
>CXXCPPFLAGS    = $(CPPFLAGS)
>
>
># Compilation:
>CC             = c89
>CXX            = CC
>FC             = f77
>F90            = f90
>CFLAGS         = -O
>CXXFLAGS       = 
>FFLAGS         = 
>F90FLAGS       = 
>CC_MAKEDEPEND  = cc -xM
>COMPILE.c      = $(CC) -c $(CFLAGS) $(CPPFLAGS)
>COMPILE.cxx    = $(CXX) -c $(CXXFLAGS) $(CXXCPPFLAGS)
>COMPILE.f      = $(FC) -c $(FFLAGS)
>COMPILE.F90    = $(F90) -c $(F90FLAGS)
># The following command isn't available on some systems; therefore, the
># `.F.o' rule is relatively complicated.
>COMPILE.F      = $(COMPILE.f) $(FPPFLAGS)
>
>
># Linking:
>MATHLIB                = -lm
>FLIBS          = 
>F90LIBS                = 
>LIBS           = 
>F90LDFLAGS     = $(LDFLAGS)
>LINK.c         = $(CC) -o $@ $(CFLAGS) $(LDFLAGS)
>LINK.cxx       = $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS)
>LINK.F         = $(FC) -o $@ $(FFLAGS) $(FLDFLAGS)
>LINK.f         = $(FC) -o $@ $(FFLAGS) $(FLDFLAGS)
>LINK.F90       = $(F90) -o $@ $(F90FLAGS) $(F90LDFLAGS)
>
>
># Manual pages:
>WHATIS         = windex
># The following macro should be empty on systems that don't
># allow users to create their own manual-page indexes.
>MAKEWHATIS_CMD = catman -w -M $(MANDIR)
>
>
># Misc. Utilities:
>AR             = ar
>ARFLAGS                = cru
>RANLIB         = ranlib
>TARFLAGS       = -chf
>
>
># Dummy macros: used only as placeholders to silence GNU make.  They are
># redefined, as necessary, in subdirectory makefiles.
>HEADER         = dummy_header
>HEADER1                = dummy_header1
>HEADER2                = dummy_header2
>HEADER3                = dummy_header3
>LIBRARY                = dummy_library.a
>MANUAL         = dummy_manual
>PROGRAM                = dummy_program
>
>
># Distribution macros:
>FTPDIR         = /home/ftp/pub/$(PACKAGE)
>FTPBINDIR      = /home/ftp/pub/binary/dummy_system
>VERSION                = dummy_version

Please let us know if the options I suggested above do not get you
going.

Tom Yoksas
--
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publically 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.