Ticket #4408 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

GDAL configure doesn't pick up NetCDF4 in latest Ubuntu 11.10

Reported by: pds Owned by: etourigny
Priority: normal Milestone: 1.9.1
Component: default Version: svn-trunk
Severity: normal Keywords: netcdf, configure, nc4
Cc: etourigny, kyle, rouault

Description

When NetCDF4 is installed via apt-get on a Ubuntu 11.10 system in default location (/usr), and doing a configure without specifying a NetCDF install location explicitly (--with-netcdf option), netcdf4 isn't picked up.

./configure --with-java --with-python
NETCDF_HAS_NC4='no'

Attachments

configure.patch Download (441 bytes) - added by pds 5 months ago.
Patch with proposed simple fix.

Change History

Changed 5 months ago by pds

Patch with proposed simple fix.

  Changed 5 months ago by pds

  • cc etourigny added

The attached patch does seem to fix the issue:- it sets a netcdf root if standard /usr/include/netcdf.h is found.

follow-up: ↓ 4   Changed 5 months ago by etourigny

  • cc kyle added
  • owner changed from warmerdam to etourigny
  • status changed from new to assigned

Patrick - can you please post the complete configure invocation, the relevant output of configure and config.log (parts which pertain to netcdf and hdf5)?

Kyle - this seems similar to what you experienced today (on Fedora) - does this fix or something similar work for you?

Can you both comment on bug #2657 which is related?

  Changed 5 months ago by etourigny

Perhaps using 'nc-config --prefix' would make things easier and work in any distro, regardless of specifics in netcdf directory?

in reply to: ↑ 2   Changed 5 months ago by pds

Replying to etourigny:

Patrick - can you please post the complete configure invocation, the relevant output of configure and config.log (parts which pertain to netcdf and hdf5)?

I've installed netcdf4, hdf5 etc in standard locations via apt-get. specific apt-get packages I use:

  • libproj0, libhdf5-mpi-dev, libnetcdf-dev, netcdf-bin

Configure invocation including enviro variables

export CPPFLAGS="-I/usr/include/openmpi/"
export LDFLAGS="-lmpi_cxx"
./configure --prefix=/usr/local/gdal-trunk --with-java --with-python

(The 'prefix' chosen is not crucial to this issue of course)

Will attach the config.log relevant parts before and after patch.

A tip is to add the shell commands "set -x" and "set +x" around the relevant sections of the configure script if you really wish to see exactly what's being executed.

Can you both comment on bug #2657 which is related?

Hmmm - kind of related - if you specify a --with-netcdf then the NC4 does seem to get picked up. I'd have to have a proper look at the configure script again to comment further.

  Changed 5 months ago by pds

*Before patch*: config.log

NETCDF_HAS_HDF4='no'
NETCDF_HAS_NC4='no'
NETCDF_ROOT=''
NETCDF_SETTING='yes'

configure std output

checking for nc_open in -lnetcdf... yes
using pre-installed libnetcdf.
ncdump and/or nc-config not found, skipping netcdf-4 tests

*After patch*: config.log

NETCDF_HAS_HDF4='no'
NETCDF_HAS_NC4='yes'
NETCDF_ROOT='/usr'
NETCDF_SETTING='yes'

configure std output

checking for nc_open in -lnetcdf... yes
using pre-installed libnetcdf.
checking libnetcdf version with /usr/bin/ncdump... got 4.1.1
checking libnetcdf config with /usr/bin/nc-config
checking for netcdf-4 (and HDF5) support in libnetcdf... yes
checking for HDF4 support in libnetcdf... no

  Changed 5 months ago by etourigny

Fixed in trunk r23646 .

It seems that all recent ubuntu packages install netcdf (3 or 4) in /usr , as well as Fedora 16. Added a test for /usr/include/netcdf.h and /usr/local/include/netcdf.h and added output if path is not found.

Pat and Kyle, please confirm this works for you also.

  Changed 5 months ago by etourigny

  • cc rouault added

added a fix to #2657 (libnetcdf not tested when --with-netcdf is called).

Even, please advise if any of these commits breaks your system with netcdf3 (I tested with netcdf-4, but it should be ok).

  Changed 5 months ago by kyle

Etienne, Seems to work on fedora, even when --with-netcdf is not defined. The configure script picks up libnetcdf in /usr/local/[lib bin include] and gives me netcdf4 support.

  Changed 5 months ago by rouault

Works fine for me when using "--with-netcdf" with netcdf 3 in /usr/lib

  Changed 5 months ago by pds

I've tried the latest trunk version of GDAL with new configure, and can confirm it's detecting my standard NetCDF4 installation in Ubuntu 11.10 correctly now. Cheers.

  Changed 4 months ago by etourigny

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to 1.9.1

now using nc-config (if available) to detect compilation and linking parameters, with fallback to previous behaviour (which should not happen in recent Fedora and ubuntu's) - see bug #4424.

Note: See TracTickets for help on using tickets.