Hmmmm... Does no one use the Fortran libraries on Windows with MinGW? Do
people use it on Windows with other compilers? (I got it working with
Cygwin, but I'd like something more portable and up-to-date.)
The NetCDF 4.2.1 Release notes states "We will also be including support
for using Fortran with Windows in an upcoming version of the netCDF Fortran
package." (http://www.unidata.ucar.edu/blogs/news/entry/netcdf_4_2_1_release)
Does anyone know the status of that, or how support will be provided? (A
dll, like for the main library on Windows?)
-Leon
On Thu, Jan 10, 2013 at 2:46 PM, Leon Maurer <leon.maurer@xxxxxxxxx> wrote:
> Howdy,
>
> I've got some noob questions for you.
>
> I'm writing some code that uses NetCDF's Fortran 90 interface. It works
> nicely on Linux, but I'm having trouble getting it working under Windows
> with MinGW. So, I downloaded the pre-compiled NetCDF
> libraries<http://www.unidata.ucar.edu/software/netcdf/win_netcdf/>,
> used that to compile the NetCDF Fortran source
> code<http://www.unidata.ucar.edu/downloads/netcdf/netcdf-fortran/index.jsp>
> without
> any special options, and I'm having trouble using the resulting libraries.
>
> When I try to compile my program
>
> gfortran -IwinLibs/include -LwinLibs/lib -static -ffree-line-length-none
> -O3 -o pmcWGFortran -march=core2 comparams.f95 usenetCDF.f95 surfGen.f95
> phonon.f95 initPhonons.f95 phononSubs.f95 initConst.f95
> distributionTracking.f95 main.f95 -lfftpack5.1 -lM_kracken -lnetcdff
> -lnetcdf
>
>
> I get the following output
>
> winLibs/lib\libnetcdff.a(fort-nc4.o): In function `nf_create_par_':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-nc4.c:22:
> undefined reference to `nc_create_par_fortran'
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-nc4.c:22:
> undefined reference to `nc_create_par_fortran'
> winLibs/lib\libnetcdff.a(fort-nc4.o): In function `nf_open_par_':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-nc4.c:25:
> undefined reference to `nc_open_par_fortran'
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-nc4.c:25:
> undefined reference to `nc_open_par_fortran'
> collect2: ld returned 1 exit status
>
>
> Any idea what I should do?
>
> I guess I don't really know that the Fortran libraries built correctly in
> the first place; "make check" wasn't happy (output below). Maybe I should
> have used some special options to compile the Fortran libraries?
>
> Thanks.
> -Leon
>
> --------------------------------------------------------------------------
> C:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2>make check
> Making check in f90
> make[1]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/f9
> 0'
> make check-am
> make[2]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/f9
> 0'
> make[2]: Nothing to be done for `check-am'.
> make[2]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/f90
> '
> make[1]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/f90
> '
> Making check in fortran
> make[1]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/fo
> rtran'
> make check-am
> make[2]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/fo
> rtran'
> make[2]: Nothing to be done for `check-am'.
> make[2]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/for
> tran'
> make[1]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/for
> tran'
> Making check in nf_test
> make[1]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/nf
> _test'
> make nf_test.exe tst_f77_v2.exe ftst_vars.exe ftst_vars2.exe
> ftst_vars3.exe fts
> t_vars4.exe ftst_vars5.exe ftst_vars6.exe ftst_types.exe ftst_types2.exe
> ftst_ty
> pes3.exe ftst_groups.exe f90tst_vars.exe tst_types.exe tst_types2.exe
> f90tst_var
> s_vlen.exe tst_f90_nc4.exe f90tst_grps.exe f90tst_fill.exe
> f90tst_fill2.exe f90t
> st_vars3.exe f90tst_vars4.exe f90tst_vars2.exe ftst_v2.exe ftest.exe
> tst_f90
> .exe
> make[2]: Entering directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/nf
> _test'
> make[2]: `nf_test.exe' is up to date.
> /bin/sh ../libtool --tag=F77 --mode=link gfortran -I../fortran -I../f90
> -g -O
> 2 -L/usr/local/lib -o tst_f77_v2.exe tst_f77_v2.o ../fortran/
> libnetcdff.la -ln
> etcdf
> libtool: link: gfortran -I../fortran -I../f90 -g -O2 -o
> .libs/tst_f77_v2.exe tst
> _f77_v2.o -L/usr/local/lib ../fortran/.libs/libnetcdff.a -lnetcdf
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o): In function `c_ncpopt':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:200:
> un
> defined reference to `ncopts'
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o): In function `ncgopt_':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:221:
> un
> defined reference to `ncopts'
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o): In function `c_nccre':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:243:
> un
> defined reference to `ncerr'
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:249:
> un
> defined reference to `ncerr'
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o): In function `c_ncopn':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:295:
> un
> defined reference to `ncerr'
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:289:
> un
> defined reference to `ncerr'
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o): In function `c_ncddef':
> c:\Users\Leon\Dropbox\winLibs\netcdf-fortran-4.2\fortran/fort-v2compat.c:321:
> un
> defined reference to `ncerr'
>
> ../fortran/.libs/libnetcdff.a(fort-v2compat.o):c:\Users\Leon\Dropbox\winLibs\net
> cdf-fortran-4.2\fortran/fort-v2compat.c:349: more undefined references to
> `ncerr
> ' follow
> collect2: ld returned 1 exit status
> make[2]: *** [tst_f77_v2.exe] Error 1
> make[2]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/nf_
> test'
> make[1]: *** [check-am] Error 2
> make[1]: Leaving directory
> `/c/Users/Leon/Dropbox/winLibs/netcdf-fortran-4.2/nf_
> test'
> make: *** [check-recursive] Error 1
>