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

20021011: building netCDF with pgf90: undefined references



Nguyen Dang Quang,

>Date: Fri, 11 Oct 2002 19:35:10 +0200 (MET DST)
>From: "Nguyen Dang Quang" <address@hidden>
>Organization: ICTP, Italy
>To: address@hidden
>Subject: Re: 20021011: building netCDF with pgf90: undefined references

The above message contained the following:

> I didnt see configure.log in present dir. Although I get error but
> You can see that now I can read the Netcdf file ( by compilling a fortran
> file which need udunits and netcdf ) and I think that netcdf is working
> normaly?
> And I repeat my question is:
> How can I recongnize if (netcdf or udunits) install ( or work) successful ? 

The output from the "make test" command will tell you if the netCDF
package was built correctly.  The "test.log" file that you sent earlier
indicates a problem:

> Making `test' in directory /scratch/quangnd/Ncep/tmp/netcdf-3.5.0/src/nf_test
> 
> make[2]: Entering directory 
> `/scratch/quangnd/Ncep/tmp/netcdf-3.5.0/src/nf_test'
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w test_get.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w test_put.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w nf_error.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w nf_test.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w test_read.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w test_write.F
> + /usr/local/pgi/linux86/bin/pgf90 -c -O -w util.F
> /usr/bin/gcc -c -O   -DNDEBUG -DpgiFortran fortlib.c
> /usr/local/pgi/linux86/bin/pgf90 -o nf_test -O -w  test_get.o test_put.o 
> nf_erro
> r.o nf_test.o test_read.o test_write.o util.o fortlib.o ../libsrc/libnetcdf.a 
>  -
> lm 
> test_get.o: In function `test_nf_get_var1_text_':
> test_get.o(.text+0x4d): undefined reference to `nf_open_'
> test_get.o(.text+0x110): undefined reference to `nf_get_var1_text_'
> test_get.o(.text+0x16a): undefined reference to `nf_get_var1_text_'

The above indicates that the Fortran-90 compiler/linker couldn't find
the necessary Fortran-77 routines in the netCDF library (libnetcdf.a).
This means that you will not be able to use the netCDF library from
a Fortran-90 program. If this is OK, then go ahead and install the
netCDF package. If, however, you need to use the netCDF package from a
Fortran-90 program, then this problem must be solved.

The first step in solving the problem is to look at the netCDF library
to see what Fortran-77 routines it contains. On my computer, this can be
done with the following command:

    $ nm -g libnetcdf.a | grep nf_open
    [21]    |      1376|     236|FUNC |GLOB |0    |2      |nf_open_
    [898]   |         0|       0|FUNC |GLOB |0    |UNDEF  |nf_open_

Something similar should work for you.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>