Octcdf package installation with NetCDF4

View: New views
2 Messages — Rating Filter:   Alert me  

Octcdf package installation with NetCDF4

by E. Joshua Rigler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hopefully Alexander Barth is paying attention, so he might incorporate
a small fix into his Octcdf package that anticipates certain changes
in the upcoming NetCDF 4 release, but here's what I did to get Octcdf
working with a development snapshot of NetCDF 4:

For starters, while I leave most of the compilation and installation
of NetCDF4 as an exercise for the reader, note that this is a
substantial deviation from the current 'mature' version, namely NetCDF
v3.6.  As I understand it, NetCDF 4 relies heavily on the recently
released HDF5 v1.8 for its low-level data model.  HDF5 v1.8, in turn,
now seems to have two important libraries instead of one, these being
libhdf5.so and libhdf5_hl.so.

Why is this relevant for Octave?  The Octcdf package Autoconf
configure script currently tests for the function nc_open to see if
the libnetcdf.so library is suitable for compiling the netcdf.oct
file.  nc_open in turn relies on functions that originally all resided
in libhdf5.so, but some of which now apparently reside inside
libhdf5_hl.so.  So, if one simply tries to type 'pkg install
octcdf-1.0.9.tar.gz', it will fail when the configure script fails to
ascertain that suitable NetCDF libraries exist, since its attempt to
compile a test function that calls nc_open will fail due to 'undefined
reference' errors.

My Solution:  start Octave and run the pkg install script in the
following manner:

  $> LDFLAGS=-L/path/to/libs CPPFLAGS=-I/path/to/headers LIBS='-lhdf5
-lhdf5_hl' octave -q
  octave:1> pkg install -verbose octcdf-1.0.9.tar.gz

I'm not sure if a more 'permanent' solution lies with the NetCDF
maintainers (can they fix libnetcdf.so to automatically link to both
HDF5 libraries?), or is it up to A. Barth to modify his Octcdf
package's Autoconf script to check for, and link to, both required
HDF5 libraries in a manner similar to my somewhat ad hoc solution?
BTW, I have not tested Octcdf extensively with the new NetCDF 4
libraries, but the Octcdf package's built-in test suite passed.

-EJR
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: Octcdf package installation with NetCDF4

by E. Joshua Rigler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK, it might be bad form to reply to my own post, but I just realized
something.  NetCDF 3.6 (the current version) does not actually link to
either of the HDF5libraries, so it's entirely possible that what I
said about HDF5 v1.8 having once had all of its functions in a single
library file (libhdf5.so) was completely wrong.  It is still necessary
to link to both libhdf5.so and libhdf5_hl.so in order to compile a
function that calls nc_open however, and to get Octcdf to compile
properly using the new NetCDF 4 (the new version) libraries.

-EJR


On Tue, May 6, 2008 at 3:58 PM, E. Joshua Rigler <relgire@...> wrote:

> Hopefully Alexander Barth is paying attention, so he might incorporate
>  a small fix into his Octcdf package that anticipates certain changes
>  in the upcoming NetCDF 4 release, but here's what I did to get Octcdf
>  working with a development snapshot of NetCDF 4:
>
>  For starters, while I leave most of the compilation and installation
>  of NetCDF4 as an exercise for the reader, note that this is a
>  substantial deviation from the current 'mature' version, namely NetCDF
>  v3.6.  As I understand it, NetCDF 4 relies heavily on the recently
>  released HDF5 v1.8 for its low-level data model.  HDF5 v1.8, in turn,
>  now seems to have two important libraries instead of one, these being
>  libhdf5.so and libhdf5_hl.so.
>
>  Why is this relevant for Octave?  The Octcdf package Autoconf
>  configure script currently tests for the function nc_open to see if
>  the libnetcdf.so library is suitable for compiling the netcdf.oct
>  file.  nc_open in turn relies on functions that originally all resided
>  in libhdf5.so, but some of which now apparently reside inside
>  libhdf5_hl.so.  So, if one simply tries to type 'pkg install
>  octcdf-1.0.9.tar.gz', it will fail when the configure script fails to
>  ascertain that suitable NetCDF libraries exist, since its attempt to
>  compile a test function that calls nc_open will fail due to 'undefined
>  reference' errors.
>
>  My Solution:  start Octave and run the pkg install script in the
>  following manner:
>
>   $> LDFLAGS=-L/path/to/libs CPPFLAGS=-I/path/to/headers LIBS='-lhdf5
>  -lhdf5_hl' octave -q
>   octave:1> pkg install -verbose octcdf-1.0.9.tar.gz
>
>  I'm not sure if a more 'permanent' solution lies with the NetCDF
>  maintainers (can they fix libnetcdf.so to automatically link to both
>  HDF5 libraries?), or is it up to A. Barth to modify his Octcdf
>  package's Autoconf script to check for, and link to, both required
>  HDF5 libraries in a manner similar to my somewhat ad hoc solution?
>  BTW, I have not tested Octcdf extensively with the new NetCDF 4
>  libraries, but the Octcdf package's built-in test suite passed.
>
>  -EJR
>
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave