NetCDF on Windows using PGI-CE 2017

This is related to posting

I have determined it’s likely NOT an installation problem. I can compile simple programs OK, so I’m starting a new thread here.

I’m starting with but using netcdf-4.1.1. That’s not the most recent version, and not version 4.0.1 that the PG docs used, but 4.1.1 is the last version before they split the Fortran and C interfaces.

I’m doing this all in the PGI CE Bash command shell. I’ve compiled many versions of netCDF on Linux using PGI, but never on Windows before.

The configure command I used is

./configure --prefix=$PWD --disable-shared --disable-netcdf-4 --without-udunits >& netcdf.configure.out 2>&1

Despite telling it to skip using udunits, the last lines of netcdf.configure.out are

checking for bison… no
checking for byacc… no
checking for flex… no
checking for lex… no
checking for library containing dirname… no
configure: error: cannot find function dirname
configure: error: ./configure failed for udunits

Still, it started to compile. The last few lines of output from “make” are

/bin/sh …/libtool --tag=FC --mode=link pgf90 -g -o fort-attio.lo fort-control.lo fort-dim.lo fort-genatt.lo fort-geninq.lo fort-genvar.lo fort-lib.lo fort-misc.lo fort-v2compat.lo fort-vario.lo fort-var1io.lo fort-varaio.lo fort-varmio.lo fort-varsio.lo …/f90/
libtool: link: (cd .libs/libnetcdff.lax/libnetcdff90.lib && pgar x “/cygdrive/x/mmif-3.4/netcdf-4.1.1-pgi-ce/fortran/…/f90/.libs/libnetcdff90.lib”)
pgar-F-00: unable to open archive file /cygdrive/x/mmif-3.4/netcdf-4.1.1-pgi-ce/fortran/…/f90/.libs/libnetcdff90.lib

Yet that file exists:

# ls f90/.libs/libnetcdff90.lib 
-rwxr--r-- 1 bbrashers 1.4M Jan 26 11:09 f90/.libs/libnetcdff90.lib*

The compilation of libnetcdff90.lib seems to have completed OK:

/bin/sh …/libtool --tag=FC --mode=compile pgf90 -I…/libsrc -I. -g -c -o typeSizes.lo typeSizes.f90
libtool: compile: pgf90 -I…/libsrc -I. -g -c typeSizes.f90 -o typeSizes.o
/bin/sh …/libtool --tag=FC --mode=compile pgf90 -I…/libsrc -I. -g -c -o netcdf.lo netcdf.f90
libtool: compile: pgf90 -I…/libsrc -I. -g -c netcdf.f90 -o netcdf.o
/bin/sh …/libtool --tag=FC --mode=link pgf90 -I…/libsrc -I. -g -o typeSizes.lo netcdf.lo
libtool: link: lib -OUT:.libs/libnetcdff90.lib typeSizes.o netcdf.o
Microsoft ® Library Manager Version 14.00.24215.1
Copyright © Microsoft Corporation. All rights reserved.

libtool: link: ( cd “.libs” && rm -f “” && ln -s “…/” “” )

Anyone have any hints for me?


Everything we see with netcdf on Windows usually starts with running
a Linux emulator on Windows to build it.

We see at unidata that they have some users who get it built
on windows, and then try to use it with Visual Studio. But no real
steps to get everything built from scratch using windows headers
and compiling tools.

Good luck to you. We are not good sources for info on building NetCDF on windows for Visual Studio.