Opened 10 years ago

Closed 9 years ago

#3957 closed defect (worksforme)

Configuring gdal 1.8.0 with hdf and netcdf at the same time fails

Reported by: William Valencia Owned by: warmerdam
Priority: normal Milestone:
Component: ConfigBuild Version: 1.8.0
Severity: normal Keywords: hdf hdf4 hdf5 netcdf configure gdal
Cc:

Description

I was able to configure and make gdal with hdf4 and hdf5 by themselves on a x86_64 GNU/Linux Machine(hdf4 was built with --disable-fortran --disable-netcdf --with-pic)

configure --with-hdf4=/home/wvalenci/gdal/hdf-4.2.5/hdf4 --with-hdf5=/home/wvalenci/gdal/hdf5-1.8.5-patch1/hdf5

and netcdf by itself

configure --with-netcdf=/home/wvalenci/gdal/netcdf-4.1.1

But when I combine them

configure --with-hdf4=/home/wvalenci/gdal/hdf-4.2.5/hdf4 --with-hdf5=/home/wvalenci/gdal/hdf5-1.8.5-patch1/hdf5 --with-netcdf=/home/wvalenci/gdal/netcdf-4.1.1

I get the following error:

configure: error: HDF4 support requested with arg "/home/wvalenci/gdal/hdf-4.2.5/hdf4", but neither hdf4 nor mfhdf lib found

Change History (10)

comment:1 Changed 10 years ago by William Valencia

Summary: Configuring gdal 1.8.0 with hdf and netcdf at the same time falesConfiguring gdal 1.8.0 with hdf and netcdf at the same time fails

comment:2 Changed 10 years ago by warmerdam

I wonder if this is related to the issue noted with netcdf incompatability in http://trac.osgeo.org/gdal/wiki/HDF ?

comment:3 in reply to:  2 Changed 10 years ago by William Valencia

Replying to warmerdam:

I wonder if this is related to the issue noted with netcdf incompatability in http://trac.osgeo.org/gdal/wiki/HDF ?

I compiled HDF4 with the --disable-fortran --disable-netcdf --with-pic options as mentioned in the wiki to (supposedly) avoid the issue. If I do the configure gdal with just hdf5 and netcdf, gdal still fails configuring saying it cannot find the hdf5 libs. Still can configure gdal with hdf5 or netcdf separately with no issues.

comment:4 Changed 9 years ago by etiennesky

I can build all 3 together fine. Here are my configures:

  • hdf5: ./configure --prefix=$prefix --with-szlib=$prefix --disable-fortran --enable-cxx
  • hdf4: ./configure --prefix=$prefix --with-szlib=$prefix --disable-netcdf --disable-fortran --enable-shared
  • netcdf: ./configure --prefix=$prefix --with-hdf5=$prefix --enable-netcdf4 --enable-hdf4 --with-hdf4=$prefix --with-szlib=$prefix --with-zlib=/usr --enable-shared

You might need to add "--enable-hdf4" ? No need for --with-pic.

You should probably do a "make install" for hdf4 hdf5 and netcdf and point to the path where you installed them, instead of your source tree.

Please check this and come back so this ticket can be resolved.

comment:5 Changed 9 years ago by William Valencia

I tried configuring netcdf as mentioned above(configure --prefix=$prefix --with-hdf5=$prefix --enable-netcdf4 --enable-hdf4 --with-hdf4=$prefix --with-szlib=$prefix --with-zlib=/usr --enable-shared ) but I get the following error:

checking for library containing deflate... none required checking for floor in -lm... yes checking for library containing H5Fflush... no configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors. f4eil01{wvalenci}106:

It works if I replace --enable-netcdf4 with -disable-netcdf4, but why would I disable netcdf when that is what I am make? This is with netcdf-4.1.3.

comment:6 Changed 9 years ago by etiennesky

You are talking about configuring netcdf right?

netcdf4 is a "new" version of netcdf, which requires hdf5. When you use --disable-netcdf4 you are disabling the new functions, effectively building netcdf3.

Your problem is that hdf5 is not found. When you configure with --disable-netcdf4, hdf5 is not searched, therefore you don't get the error.

Have you built and installed hdf5? You should not refer to the hdf5 sources, but where it was installed. I suggest you look more into the netcdf, hdf4 and hdf5 docs for how to install them together.

comment:7 Changed 9 years ago by William Valencia

my main goal is to configure gdal with hdf4, hdf5, and netcdf(4 if possible). I am able to configure and make gdal with hdf4 and hdf5 together. I am also able to configure gdal with netcdf(including netcdf4). However when I try to combine them all together(or any hdf with netcdf4) I get the error first mentioned.

I have tried building netcdf from scratch using the method recommended above. Yes I have built and installed hdf5(hence I can build gdal with hdf5 support). My hdf5 path does point to where I installed hdf5 and not the source.

I have also tried using the binaries distributions for hdf4 hdf5 and netcdf and still get the same error. Error repeated below when configuring gdal: configure: error: HDF4 support requested with arg "<hdf4 install dir>", but neither hdf4 nor mfhdf lib found

comment:8 Changed 9 years ago by etiennesky

Did you manage to get netcdf compiled with hdf5, which is different from the gdal configure problem ?

Also have a look at config.log, there might be more useful information.

Well I'm stumped. Are your libs all installed in the same directory, (e.g. prefix=/usr/local) or at least in your LD_LIBRARY_PATH? Your initial comment shows that they are all installed in separate directories, I suspect this could cause a problem.

If that is the case, I suggest starting from scratch (with new source trees) and install everything in a common tree (such as /usr/local, or $HOME/local/) and add that path to the LD_LIBRARY_PATH (before other values).

I would suggest writing to the mailing list, as someone else might have a solution, if this fails.

comment:9 Changed 9 years ago by etourigny

A user reported the following on the mailing list:

I solved the problem by appending "--without-libtool" to my ./configure call

Although his problem was related to -fPIC, perhaps this can solve yours?

comment:10 Changed 9 years ago by etourigny

Resolution: worksforme
Status: newclosed

closing this bug due to lack of activity - setting to worksforme.

Note: See TracTickets for help on using tickets.