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

[netCDF #TZQ-243589]: Linking problems



Hi Chad,

> Package Version: 3.5.0
> Operating System: Windows XP
> Hardware:
> Description of problem: I downloaded the prebuilt binaries for WinXP
> from
> ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-3.5.0.win32bin.zip 
>  

I believe The Fortran library included in that DLL was compiled with a
Compaq Visual Fortran compiler, which uses different conventions than
g77 for calling C functions from Fortran.

> I added ncdump/ncgen.exe and netcdf.dll to my System32 directory. I
> pointed my compiler to the appropriate include and library files. I
> used MinGW's g77 to compile and link one of the example Fortran 77
> programs (simple_xy_wr.f) that creates a simple netCDF file. I invoked
> the following command and got the following output:
> 
> g77 simple_xy_wr.f -IC:\netCDF\include -LC:\netCDF\lib
> 
> cc6pR35H.o:simple_xy_wr.f:(.text+0xb8): undefined reference to
> `nf_create> __'
> cc6pR35H.o:simple_xy_wr.f:(.text+0xff): undefined reference to
> `nf_def_di> m__'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x146): undefined reference to
> `nf_def_d> im__'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x1a8): undefined reference to
> `nf_def_v> ar__'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x1d0): undefined reference to
> `nf_endde> f__'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x209): undefined reference to
> `nf_put_v> ar_int__'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x231): undefined reference to
> `nf_close> __'
> cc6pR35H.o:simple_xy_wr.f:(.text+0x2e7): undefined reference to
> `nf_strer> ror__'
> collect2: ld returned 1 exit status

A program compiled with g77 in general can't be linked with a DLL
containing code compiled with a different Fortran compiler.  You would
either have to use the same compiler used to make that DLL or
regenerate a new DLL using gcc and g77 (or gfortran).

If you decide to recompile from source, you would probably have more
luck with a more recent source distribution than 3.5.0, with bug fixes
and protability improvements.

The best advice we have at this time for building netCDF on Windows is
here:

  http://www.unidata.ucar.edu/netcdf/docs/faq.html#windows_netcdf4

--Russ

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



Ticket Details
===================
Ticket ID: TZQ-243589
Department: Support netCDF
Priority: Normal
Status: Closed