Opened 12 years ago
Closed 12 years ago
#4424 closed defect (fixed)
configure script does not support static netcdf build
Reported by: | etourigny | Owned by: | etourigny |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.1 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | netcdf, configure |
Cc: | kyngchaos@…, Kyle Shannon |
Description
Current configure script only supports a shared netcdf build, which does not require additional linking parameters and is also the default for most linux distribution packaging.
William Kyngesburye reported on the gdal-dev list problems in building gdal on osx with a static netcdf build, with hdf5 and curl:
OK, I have NetCDF now with HDF4/5 & DAP. Now configure problems again (again, netcdf is static library, as are HDF4, HDF5 and DAP): My netcdf needs curl (it defaults to using curl), but GDAL doesn't test netcdf with that (curl is tested much later). Netcdf4 also needs some symbols from libhdf5_hl, but this is not checked for. ... OK, looking good, after patching configure to work around netcdf problems mentioned.
nc-config --libs should give the libs necessary for a particular netcdf build, and resolve the problems stated above.
Can William (what is your username?) provide the patch used to resolve the configure problems here?
Also, is it a requirement or limitation to have static builds on osx?
Attachments (6)
Change History (17)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
William, I am not sure if I understand the problems you encountered, is it just that the necessary libraries are not checked for, or some compilation or linking problem?
I build a static netcdf and was able to compile and run the autotests fine without any modifications to configure.
comment:3 by , 12 years ago
When I build HDF5 (static), I get libhdf5 and libhdf5_hl. When I build netcdf (static) with HDF5 support, it needs symbols in both those. Now, when configuring GDAL for netcdf and it tests for HDF5 support in netcdf, it does a link test with just libhdf5 (whatever was added to LIBS when HDF5 was checked) and I get missing symbol errors (and those missing symbols are in libhdf5_hl).
Undefined symbols for architecture x86_64: "_H5DSiterate_scales", referenced from: _nc4_rec_read_vars in libnetcdf.a(libnetcdf4_la-nc4file.o) "_H5DSis_scale", referenced from: _nc4_rec_read_vars in libnetcdf.a(libnetcdf4_la-nc4file.o) "_H5DSget_scale_name", referenced from: _nc4_rec_read_vars in libnetcdf.a(libnetcdf4_la-nc4file.o) "_H5DSget_num_scales", referenced from: _nc4_rec_read_vars in libnetcdf.a(libnetcdf4_la-nc4file.o) "_H5DSdetach_scale", referenced from: _rec_detach_scales in libnetcdf.a(libnetcdf4_la-nc4hdf.o) _nc4_rec_write_metadata in libnetcdf.a(libnetcdf4_la-nc4hdf.o) "_H5DSattach_scale", referenced from: _rec_reattach_scales in libnetcdf.a(libnetcdf4_la-nc4hdf.o) _nc4_rec_write_metadata in libnetcdf.a(libnetcdf4_la-nc4hdf.o) "_H5DSset_scale", referenced from: _nc4_rec_write_metadata in libnetcdf.a(libnetcdf4_la-nc4hdf.o)
For this, I just just added -lhdf5_hl to the test for HDF5 so that it will be in the netcdf test.
Same goes for curl, the test for nc_open in -lnetcdf doesn't know netcdf4 needs curl (a default configuration).
For this I added -lcurl to the netcdf test.
But for both, probably the nc-config --libs method would be better - it has all the necessary linking flags (including -L flags). I can easily add the netcdf/bin to the PATH before configuring.
comment:4 by , 12 years ago
I will try to work on this in the next few days and post here a patch for testing. Will probably not make it into 1.9.0 unless there is a new RC (which is unlikely).
by , 12 years ago
Attachment: | configure.in added |
---|
comment:5 by , 12 years ago
Cc: | added |
---|
Please test the attached patch (against svn trunk/1.9.0) or complete configure.in, or the generated configure script.
I have tested against static and shared netcdf-4.1.3 builds as well as netcdf-3.6.3 under ubuntu 11.04. It uses nc-config if found, and if not falls back to previous behaviour. Probably does not work for a static build of netcdf-3.6.3 as there is not nc-config available in older versions.
kyle - can you please test that this does not break configuration and building in fedora?
comment:7 by , 12 years ago
Etienne, configure script picks up my system and user defined netcdf shared libs. Seems good to me.
comment:8 by , 12 years ago
sorry for the wait - the patch works for my case. Just add netcdf/bin to my PATH and configure finds nc-config and gdal links without error.
comment:9 by , 12 years ago
Milestone: | 1.9.0 → 1.9.1 |
---|
William, thanks for your help.
I have a slightly modified version, can you please test again before I commit?
Attaching patched configure.in and configure.
by , 12 years ago
Attachment: | patch-4424-2.txt added |
---|
by , 12 years ago
Attachment: | configure.2.in added |
---|
by , 12 years ago
Attachment: | configure.2.gz added |
---|
comment:11 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
related ticket which I have recently closed (perhaps prematurely...) #3154
A simple fix would be to add the output of 'nc-config --libs' to LIBS, which should work for both static and shared netcdf-4. When nc-config is not found, use previous behaviour.