Re: Problem with some Fortran compilers using --disable-v2

Mark Hadfield <m.hadfield@xxxxxxxxxx> writes:

> Hello folks
> I imagine the following is of little interest to most of the netCDF
> community, but perhaps this warning will help some poor lost soul in
> the future...
> The --disable-v2 flag was introduced into the netCDF configure script
> at 3.6.2-beta3. It suppresses the building of the netCDF-2
> API. However it causes a problem for some Fortran compilers. The
> problem arises because contains declarations for version 2
> functions: nccre, ncopn, etc (see the section beginning at line 1113,
> entitled "begin netcdf 2.4 backward compatibility". However these
> functions do not appear in the library when --disable-v2 has been used.
> So, any time is included in a Fortran source file there
> will be declarations for version-2 functions that are (presumably) not
> referenced in the executable code. Some compilers (g77, gfortran)
> ignore them, but other compilers (g95, Cray f90) insert entries in the
> object file indicating that these functions are undefined and need to
> be supplied during linking. With the latter compilers, the linker will
> give an error.
> This is essentially the same compiler-dependent problem that occurred
> when a declaration for nf_set_log_level (a netCDF-4 function) was
> added by mistake to in 3.6.2 beta6 or thereabouts.
> The solution is pretty obvious: remove the offending lines from
> At the moment, is not modified during the
> netCDF build process. so you'll need to do that yourself.

Thanks for pointing this out Mark!

This is now fixed in the code base, and in the netCDF-3 snapshot,
available here:

Now, when --disable-v2 is used, the file will contain only
the netCDF-3 API, not the netCDF-2 API. When --disable-v2 is not used
(i.e. the default situation), it will contain both the v2 and the v3
APIs, just as it does now.

Please give the snapshot a try, Mark, and let me know if this fixes
your problem.

Thanks again!


Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

To unsubscribe netcdfgroup, visit: