Error Building netCDF-C 4.4.1 with macOS PGI 16.10

After deciding to give up on Open MPI with macOS PGI, I figured mpich3 is built-in, just use that!

So, I started building my Base libraries and got through hdf5 (usually the bad one) and hit netCDF-C and it’s erroring with:

Making install in libsrc4
source='nc4file.c' object='libnetcdf4_la-nc4file.lo' libtool=yes \
	DEPDIR=.deps depmode=pgcc /bin/sh ../depcomp \
	/bin/sh ../libtool  --tag=CC   --mode=compile mpicc -DHAVE_CONFIG_H -I. -I..  -I../include    -DpgiFortran  -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/zlib    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/szlib    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/jpeg    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/hdf5    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/hdf    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/uuid    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/netcdf    -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/udunits2     -c -o libnetcdf4_la-nc4file.lo `test -f 'nc4file.c' || echo './'`nc4file.c
libtool: compile:  mpicc -DHAVE_CONFIG_H -I. -I.. -I../include -DpgiFortran -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/ -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/zlib -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/szlib -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/jpeg -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/hdf5 -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/hdf -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/uuid -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/netcdf -I/Users/mathomp4/installed/MPI/pgi-16.10/mpich-3.2/Baselibs/5.0.2/Darwin/include/udunits2 -c nc4file.c -MD -o libnetcdf4_la-nc4file.o
PGC-S-0056-Attempt to call non-function (nc4file.c: 3058)
PGC-W-0095-Type cast required for this conversion (nc4file.c: 3058)
PGC/x86-64 OSX 16.10-0: compilation completed with severe errors
make[3]: *** [libnetcdf4_la-nc4file.lo] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [netcdf.install] Error 2
make: *** [install] Error 2

As I’m mainly a Fortran programmer, C errors are usually a bit outside my purview. The line in question is 3058 here:

3050 /* This function will free all allocated metadata memory, and close
3051    the HDF5 file. The group that is passed in must be the root group
3052    of the file. */
3053 static int
3054 close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
3055 {
3056    int retval = NC_NOERR;
3057 
3058    assert(h5 && h5->root_grp);
3059    LOG((3, "%s: h5->path %s abort %d", __func__, h5->controller->path, abort));
3060 
3061    /* According to the docs, always end define mode on close. */
3062    if (h5->flags & NC_INDEF)
3063       h5->flags ^= NC_INDEF;

which doesn’t seem that exciting since there are other asserts like that in that file.

Has anyone at PGI seen this before? Or, for me, what that Severe error means?

Matt

First see Error Building Open MPI 2.0.1 with PGI 16.10 macOS
for how to build openmpi 2.0.1 on OS X. It talks about an rcfile that
works around ‘configure’ calling gcc switches in pgcc.

Next make sure you have hdf5 built and its include directory and lib directory known to netcdf.

setenv CPPFLAGS “-I /path/to/hdf5/include”
setenv LDFLAGS “-L /path/to/hdf5/lib”

Then configure
setenv CC pgcc

(disabling netcdf-4 means you use hdf5.)

./configure --disable-netcdf-4 --prefix=/path/to/netCDF-4.4.1.1

make
make check
make install

dave

Oh, well we can’t disable netCDF4 at all. We need netCDF4. I’d just as soon lose netCDF3 and let others fend!

That said, the folks at netCDF informed me that passing in -DNDEBUG allows one to bypass the assert issue. At this point I have no problem not doing that (though it may make crashes more…exciting), but I’ll keep investigating.

I’ll also try out the siterc soon. I’ve almost got all my libraries built save ESMF and NCO. NCO is the one doing weird things. Expect another forum post soon.

Matt

I thought ‘disable netcdf 4’ meant you use hdf5 and not hdf4 to build netcdf.

Is that what you mean? You have to build it with hdf4?

I think disable-netcdf-4 means you don’t get netcdf4 capability (so you don’t need HDF5 and zlib). You’d still get netcdf3 capability, but that’s it. We also pass in enable-hdf4 which I think means HDF4 support within netCDF4.

(Actually, reading through netcdf-C’s configure and staring at my overall makefile, I think I might be passing in options that haven’t existed in netcdf-C in a while. Time to clean up!)

You are right. I was confused.

I have filed TPR 23320 to address the issue.

The workaround is to
setenv CFLAGS “-DNDEBUG”

./configure --prefix=/path/to/built/netcdf/package
make
make check
make install
now works.

dave