Opened 10 years ago

Closed 10 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 10 years ago.
Patch with proposed simple fix.

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by pds

Attachment: configure.patch added

Patch with proposed simple fix.

comment:1 Changed 10 years 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.

comment:2 Changed 10 years ago by etourigny

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 Changed 10 years ago by etourigny

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

comment:4 in reply to:  2 Changed 10 years 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.

comment:5 Changed 10 years 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

comment:6 Changed 10 years 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.

comment:7 Changed 10 years ago by etourigny

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 Changed 10 years ago by Kyle Shannon

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 Changed 10 years ago by Even Rouault

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

comment:10 Changed 10 years 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.

comment:11 Changed 10 years ago by etourigny

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.