[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [DebianGIS] NetCDF version dep for GDAL -dev package



[I'm not quite sure who the netcdf maintainer is so cc'ing about..]

Hamish wrote:
> > The upcoming netcdf 3.6.2 package now in experimental* has renamed the
> > libnetcdf3 package  to be  libnetcdf4**. (also netcdfg-dev  is renamed
> > libnetcdf-dev but there is a transition package for that.)
> >
> > 'apt-cache  show' says  that libgdal1-1.4.0  (version 1.4.2-1~bpo40+1)
> > depends on libnetcdf3 (>= 3.6.0+3.6.1-beta3); gdal's control file just
> > asks for netcdfg-dev***.
> >
> > I'd like to backport the experimental package to Etch without breaking
> > or rebuilding  GDAL and  everything that depends  on it.  Possible? Is
> > there a way to have libgdal1 accept libnetcdf3 | libnetcdf4?

Francesco Lovergine wrote:
> Definitively not if the netcdf soname changes (which is what I think). 
> Of course, you can build-dep on both libnetcdf3 or libnetcdf4 and build 
> against one of them. The two libraries can also coexist on the box, but
> the whole toolchain would depend on one and only one of them. One could
> estimate if the new libraries introduces major API or ABI changes,
> which is what it is expected for a change in its soname.

I am not sure if there is a real incompatible change or the maintainer was
just getting ready for the upcoming release of NetCDF 4.

> > Any ideas  on a best  approach? What I am  really after is  the NetCDF
> > fortran -dev stuff  to be built &  installed in a clean  way. My other
> > idea  was  to  get the  Etch  package  via  deb-src  and make  my  own
> > replacement package with the fortran stuff turned in.
> >
> > I can build NetCDF from source locally and install to /usr/local/, but
> > then I wish to remove the  Debian packages to avoid cross pollination,
> > which in turn tries to remove gdal (and everything that needs gdal).
>
> The packages would be compatible at source level, I would use ad-hoc
> versions to identify the experimental stuff anyway.
>
> > To complicate matters, IIUC shared  packages are only available in the
> > new 3.6.2 version for netcdf.


For the archives, this is what I've done. I decided to fetch the debian
etch sources for NetCDF 3.6.1 and tweak the package to include the
missing F90 headers. This way I wouldn't have to rebuild/remove GDAL etc.

diff to the rules file attached. I also added the following to the top of
debian/changelog:

-----snip------------
netcdf (3.6.1-1.90) stable; urgency=medium

  * Custom package with F90 turned on.

 -- Hamish Bowman <hamish bowman otago.ac nz>  Thu, 29 Nov 2007 19:00:28 +1300
-----snip------------

The trick (found in the NetCDF forum archives) was to pretend to be the
PGI fortran compiler, not gFortran. I don't know if it matters, but
 CXXFLAGS="$(CFLAGS)" was missing from the static lib build.
The static build failed the "make test" in the nf_ test dir so I
commented that out. The model I am using seems to run ok and read/
write its NetCDF files ok so I won't bother to try and figure out
why the test failed. Compiling NetCDF 3.6.2 by hand worked fine,
and all tests passed.

I tried gdalinfo on one of my outputted NetCDF files and it segfaulted,
but I'm not too worried about that, I can use another machine to
analyze the results.



Hamish
--- netcdf_3.6.1-1.rules	2007-12-01 22:28:13.000000000 +1300
+++ netcdf-3.6.1/debian/rules	2007-12-01 22:29:08.000000000 +1300
@@ -20,7 +20,7 @@
 CFLAGS += -g
 endif
 
-CPPFLAGS=-Df2cFortran -DNDEBUG -D_REENTRANT
+CPPFLAGS=-DpgiFortran -DNDEBUG -D_REENTRANT
 FFLAGS=-g -O2
 
 build:	build-libc6
@@ -37,19 +37,20 @@
 	  CFLAGS="$(CFLAGS) -fPIC" \
 	  CXXFLAGS="$(CFLAGS) -fPIC" \
 	  FFLAGS="$(FFLAGS) -fPIC" \
-	  FC=g77 \
+	  FC=gfortran \
+	  F90=gfortran \
 		./configure --prefix=/usr
 
-#	  F90=gfortran \
-
 	$(MAKE) -C src all
+	$(MAKE) -C src test
+	$(MAKE) -C src check
 
 	mkdir -p shlib
 	rm -f shlib/*.o
 	cd shlib && ar x ../src/libsrc/libnetcdf.a
 	ls -l shlib
 	$(CC) -shared -Wl,-soname,libnetcdf.so.$(soname) \
-	    -o src/libsrc/libnetcdf.so.$(version) shlib/*.o #-lgfortran
+	    -o src/libsrc/libnetcdf.so.$(version) shlib/*.o -lgfortran
 	ln -sf libnetcdf.so.$(version) src/libsrc/libnetcdf.so
 	rm -f shlib/*.o
 
@@ -68,13 +69,15 @@
 	cd src && \
 	  CPPFLAGS="$(CPPFLAGS)" \
 	  CFLAGS="$(CFLAGS)" \
+	  CXXFLAGS="$(CFLAGS)" \
 	  FFLAGS="$(FFLAGS)" \
-	  FC=g77 \
+	  FC=gfortran \
+	  F90=gfortran \
 		./configure --prefix=/usr
 
-#	  F90=gfortran \
-
 	$(MAKE) -C src all
+#	$(MAKE) -C src test
+#	$(MAKE) -C src check
 
 	$(RM) build-libc5
 	touch build-libc6
@@ -338,6 +341,7 @@
 	gzip -9v debian/tmp-dev/usr/share/doc/$(package)g-dev/[^e]*	\
 	  debian/tmp-dev/usr/share/doc/$(package)g-dev/examples/*
 	$(RM) -r debian/tmp-dev/usr/share/man/man3f
+	$(RM) -r debian/tmp-dev/usr/share/man/man3f90
 	gzip -9v debian/tmp-dev/usr/share/man/*/*
 	install -m 644 debian/copyright	\
 	  debian/tmp-dev/usr/share/doc/$(package)g-dev/.

Reply to: