Opened 12 years ago

Closed 12 years ago

#4408 closed defect (fixed)

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 Shannon, Even 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 (1)

configure.patch (441 bytes ) - added by pds 12 years ago.
Patch with proposed simple fix.

Download all attachments as: .zip

Change History (12)

by pds, 12 years ago

Attachment: configure.patch added

Patch with proposed simple fix.

comment:1 by pds, 12 years ago

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.

comment:2 by etourigny, 12 years ago

Cc: Kyle Shannon added
Owner: changed from warmerdam to etourigny
Status: newassigned

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?

comment:3 by etourigny, 12 years ago

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

in reply to:  2 comment:4 by pds, 12 years ago

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.

comment:5 by pds, 12 years ago

*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

comment:6 by etourigny, 12 years ago

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.

comment:7 by etourigny, 12 years ago

Cc: Even 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).

comment:8 by Kyle Shannon, 12 years ago

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.

comment:9 by Even Rouault, 12 years ago

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

comment:10 by pds, 12 years ago

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.

comment:11 by etourigny, 12 years ago

Milestone: 1.9.1
Resolution: fixed
Status: assignedclosed

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.