[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #NOX-902701]: netcdf-fortran-4.2/netcdf-cxx-4.2 build problem
- Subject: [netCDF #NOX-902701]: netcdf-fortran-4.2/netcdf-cxx-4.2 build problem
- Date: Wed, 15 Aug 2012 10:26:46 -0600
Hi Morten,
> I'm in the process of installing netcdf-4.2.1.1 with the netcdf-cxx-4.2
> and netcdf-fortran-4.2 overlayed on top of it.
>
> I have experienced the following problems (which I have managed to work
> my way around):
>
> If I build only static libraries of hdf5 and netcdf, the configure script
> for netcdf-fortran fails to detect that the netcdf C library already
> compiled is a netcdf 4 library, unless I put "-lnetcdf -lhdf5_hl -lhdf5
> -lz" in the LIBS and/or LDFLAGS environment variable.
>
> If you compile shared these libraries might be pulled in automatically.
> This should probably be pointed out in the documentation somewhere.
Yes, thanks for reporting this. We'll be making some fixes to nf-config for
the upcoming netCDF-Fortran update. I'd rather just make it work for static
libraries, but have fixed the online documentation until then, in step 2,
here:
http://www.unidata.ucar.edu/netcdf/docs/netcdf-fortran-install.html
> Currently I can only find find that you need to set LDFLAGS so it
> includes "-L/my/installation/path/lib". (see
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html)
>
> When I build the netcdf-cxx-4.2 (the old interface) the define USE_NETCDF4
> which is is used in the NcFile constructor never seems to be set. It is
> either my configure that fails at some point (but I cannot spot which
> test that should be), or it is never set. This means that all files
> will be created in Classic format. If I specify -DUSE_NETCDF4 in the
> CPPFLAGS at configure time the NcFile class correctly creates Netcdf-4
> files when requested.
>
> In case I have done something wrong please let me know, else I think it
> would be a good idea to either improve the configure scripts or add more
> specific information to the documentation. That would make it easier
> to figure out :)
No, I don't think you are doing anything wrong. It's just that the legacy
(old) C++ library has never been updated to include support for netCDF-4.
That's one of the main purposes of the new cxx4 library, to provide support
for the enhanced netCDF-4 data model.
It looks like the "USE_NETCDF4" macro is only used in the NcFile constructor,
perhaps as a way to support the testing framework used with the C library
with minimum code changes. If you wanted to make use of any netCDF-4 classic
model features such as compression or chunking, you would find there are no
APIs for them in the cxx distribution. The developer who separated out the
legacy cxx code into a separate distribution is no longer at Unidata, so I'm
just guessing at intentions, but I expect not allowing a way to define the
USE_NETCDF4 macro in configure may have been intended as a simple way to not
raise expectations that you could do anything useful with netCDF-4 files
created
in this API.
> In addition I think there is a bug in nc_set_var_chunk_cache_ints in
> the netcdf library itself in nc_var4.cpp
>
> The code if (size >= 0)
> real_size = size * MEGABYTE;
>
>
> overruns if size is greater than ~2048 (chunk caches over 2Gb , Yes I
> know that is large) You take an int size multiply it with a big number
> so it overflows and then you assign it to a size_t.
>
> I think it should read if (size >= 0)
> real_size = (size_t)(size) * MEGABYTE;
>
>
> Hope this can be of some help to you
Thanks for pointing that out. I found the code you're referring to in the
netCDF C distribution in libsrc4/nc4var.c, so I hope that's what you meant.
I've fixed the bug there for future releases.
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: NOX-902701
Department: Support netCDF
Priority: Normal
Status: Closed