Control: tags -1 patch

On 22-11-15 21:06, Bas Couwenberg wrote:
> Your package fails to build with GSL 2:
> 
>  fitting.cpp: In member function 'virtual bool 
> FunctionFitDerivative::fit(const blitz::Array<float, 1>&, const 
> blitz::Array<float, 1>&, const blitz::Array<float, 1>&, unsigned int, 
> double)':
>  fitting.cpp:222:40: error: 'struct gsl_multifit_fdfsolver' has no member 
> named 'J'
>     gsl_multifit_covar (gsldata->solver->J, 0.0, gsldata->covar);
>                                          ^
> 
> This needs to be fixed for the ongoing gsl transition (#804246).
> 
> The full build log is attached, as is a patch to update the build
> dependencies for GSL 2 (changing libgsl0-dev to libgsl-dev).

The attached debdiff includes a patch with the GSL 2 related changes
from the upstream VCS in addition to the updated dependencies.

 http://sourceforge.net/p/od1n/code/8551/

With the updated dependencies and the changes in gsl-2.patch, odin
builds successfully with libgsl2.

Please include the changes from the debdiff in the next upload.

Also consider using dh-autoreconf to automatically regenerate the build
system, so you don't need to patch generated files as was required for
the gsl-2.patch.

 https://wiki.debian.org/Autoreconf

Kind Regards,

Bas

-- 
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
diff -Nru odin-1.8.8/debian/changelog odin-1.8.8/debian/changelog
--- odin-1.8.8/debian/changelog 2015-09-16 16:30:32.000000000 +0200
+++ odin-1.8.8/debian/changelog 2015-12-04 14:15:17.000000000 +0100
@@ -1,3 +1,11 @@
+odin (1.8.8-1.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Update build dependencies for GSL 2, change libgsl0-dev to libgsl-dev.
+  * Add patch for GSL 2 support.
+
+ -- Bas Couwenberg <sebas...@debian.org>  Sun, 22 Nov 2015 20:37:25 +0100
+
 odin (1.8.8-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru odin-1.8.8/debian/control odin-1.8.8/debian/control
--- odin-1.8.8/debian/control   2014-10-09 08:42:34.000000000 +0200
+++ odin-1.8.8/debian/control   2015-12-03 15:39:55.000000000 +0100
@@ -6,7 +6,7 @@
  Yaroslav Halchenko <deb...@onerussian.com>
 Build-Depends: debhelper (>= 7.0.50~),
  autotools-dev,
- libgsl0-dev,
+ libgsl-dev,
  libblitz0-dev (>= 0.8) | libblitz-dev,
  libnifti-dev,
  libvtk5-dev,
@@ -26,7 +26,7 @@
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends},
  libodin-dev,
- libgsl0-dev,
+ libgsl-dev,
  libc6-dev | libc-dev,
  g++,
  libblas-dev | libatlas-base-dev,
diff -Nru odin-1.8.8/debian/patches/gsl-2.patch 
odin-1.8.8/debian/patches/gsl-2.patch
--- odin-1.8.8/debian/patches/gsl-2.patch       1970-01-01 01:00:00.000000000 
+0100
+++ odin-1.8.8/debian/patches/gsl-2.patch       2015-12-04 13:36:49.000000000 
+0100
@@ -0,0 +1,126 @@
+Description: porting to GSL2
+Origin: http://sourceforge.net/p/od1n/code/8551/
+Bug-Debian: https://bugs.debian.org/805819
+
+--- a/odindata/fitting.cpp
++++ b/odindata/fitting.cpp
+@@ -107,6 +107,7 @@ int FunctionFitDerivative_func_fdf (cons
+ 
+ 
+ bool FunctionFitDerivative::init(ModelFunction& model_func, unsigned int 
nvals) {
++  Log<OdinData> odinlog("FunctionFitDerivative","init");
+ 
+   data4fit= new ModelData(nvals);
+ 
+@@ -114,8 +115,10 @@ bool FunctionFitDerivative::init(ModelFu
+ 
+   gsldata=new GslData4Fit;
+ 
+-  // allocate and initialize GSL stuff
+   unsigned int npars=model_func.numof_fitpars();
++  ODINLOG(odinlog,normalDebug) << "npars=" << npars << STD_endl;
++
++  // allocate and initialize GSL stuff
+   gsldata->covar  = gsl_matrix_alloc (npars, npars);
+   gsldata->solver = gsl_multifit_fdfsolver_alloc 
(gsl_multifit_fdfsolver_lmsder, data4fit->n, npars);
+   
+@@ -164,7 +167,7 @@ bool FunctionFitDerivative::fit(const Ar
+ 
+   ModelFunction* func=data4fit->modelfunc;
+   unsigned int npars=func->numof_fitpars();
+-  ODINLOG(odinlog,normalDebug) << "n/numof_fitpars=" << data4fit->n << "/" << 
 npars << STD_endl;
++  ODINLOG(odinlog,normalDebug) << "n/npars=" << data4fit->n << "/" <<  npars 
<< STD_endl;
+ 
+   // copy Blitz arrays to data4fit
+   for (unsigned long i=0;i<data4fit->n;i++) {
+@@ -219,7 +222,30 @@ bool FunctionFitDerivative::fit(const Ar
+     return false;
+   }
+ 
+-  gsl_multifit_covar (gsldata->solver->J, 0.0, gsldata->covar);
++
++  gsl_matrix* J=0;
++#ifdef HAVE_GSL_MULTIFIT_FDFSOLVER_JAC // for GSL2
++  ODINLOG(odinlog,normalDebug) << "solver->f->size=" << 
gsldata->solver->f->size << STD_endl;
++  ODINLOG(odinlog,normalDebug) << "solver->x->size=" << 
gsldata->solver->x->size << STD_endl;
++  J = gsl_matrix_alloc(gsldata->solver->f->size, gsldata->solver->x->size);
++  status = gsl_multifit_fdfsolver_jac(gsldata->solver, J);
++  if(status!=GSL_SUCCESS) {
++    ODINLOG(odinlog,errorLog) << gsl_strerror(status) << STD_endl;
++    return false;
++  }
++#else // pre GSL2
++  J=gsldata->solver->J;
++#endif
++
++  status = gsl_multifit_covar(J, 0.0, gsldata->covar);
++  if(status!=GSL_SUCCESS) {
++    ODINLOG(odinlog,errorLog) << gsl_strerror(status) << STD_endl;
++    return false;
++  }
++
++#ifdef HAVE_GSL_MULTIFIT_FDFSOLVER_JAC // for GSL2
++  gsl_matrix_free(J);
++#endif
+ 
+   // copy results
+   for(unsigned int i=0;i<npars;i++) {
+--- a/configure.in
++++ b/configure.in
+@@ -281,14 +281,14 @@ else
+   dnl GSL is used in tjutils and odindata so we add it to the global LIBS
+   valid_gsl=yes
+   AC_CHECK_LIB(gslcblas,main,LIBS="-lgslcblas $LIBS"; BASELIBS="-lgslcblas 
$BASELIBS")
+-  AC_CHECK_LIB(gsl,gsl_multifit_fdfsolver_iterate,BASELIBS="-lgsl 
$BASELIBS",valid_gsl=no)
++  AC_CHECK_LIB(gsl,gsl_multifit_fdfsolver_iterate,LIBS="-lgsl $LIBS"; 
BASELIBS="-lgsl $BASELIBS",valid_gsl=no)
+   AC_CHECK_HEADER(gsl/gsl_multifit_nlin.h,,valid_gsl=no)
+   AC_CHECK_HEADER(gsl/gsl_multimin.h,,valid_gsl=no)
+   if test "x$valid_gsl" = "xno" ; then
+     AC_MSG_ERROR([Please install the GNU Scientific Library (There is 
probably a precompiled package for your UNIX/Linux distribution, otherwise see 
http://www.gnu.org/software/gsl)])
+   fi
+   
AC_CHECK_DECL(gsl_multimin_fminimizer_nmsimplex2,have_gsl_multimin_fminimizer_nmsimplex2=yes,,[#include
 <gsl/gsl_multimin.h>])
+-
++  AC_CHECK_FUNCS(gsl_multifit_fdfsolver_jac)
+ 
+   if test "x$macos" = "xyes" ; then
+     AC_MSG_NOTICE([Using vecLib for lapack support])
+--- a/configure
++++ b/configure
+@@ -15891,7 +15891,7 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_gsl_gsl_multifit_fdfsolver_iterate" >&5
+ $as_echo "$ac_cv_lib_gsl_gsl_multifit_fdfsolver_iterate" >&6; }
+ if test "x$ac_cv_lib_gsl_gsl_multifit_fdfsolver_iterate" = xyes; then :
+-  BASELIBS="-lgsl $BASELIBS"
++  LIBS="-lgsl $LIBS"; BASELIBS="-lgsl $BASELIBS"
+ else
+   valid_gsl=no
+ fi
+@@ -15921,6 +15921,16 @@ if test "x$ac_cv_have_decl_gsl_multimin_
+   have_gsl_multimin_fminimizer_nmsimplex2=yes
+ fi
+ 
++  for ac_func in gsl_multifit_fdfsolver_jac
++do :
++  ac_fn_cxx_check_func "$LINENO" "gsl_multifit_fdfsolver_jac" 
"ac_cv_func_gsl_multifit_fdfsolver_jac"
++if test "x$ac_cv_func_gsl_multifit_fdfsolver_jac" = xyes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_GSL_MULTIFIT_FDFSOLVER_JAC 1
++_ACEOF
++
++fi
++done
+ 
+ 
+   if test "x$macos" = "xyes" ; then
+--- a/tjutils/config.h.in
++++ b/tjutils/config.h.in
+@@ -81,6 +81,9 @@
+ /* Define to 1 if you have the `gettimeofday' function. */
+ #undef HAVE_GETTIMEOFDAY
+ 
++/* Define to 1 if you have the `gsl_multifit_fdfsolver_jac' function. */
++#undef HAVE_GSL_MULTIFIT_FDFSOLVER_JAC
++
+ /* "existence of newer gsl_multimin_fminimizer_nmsimplex2 algorithm" */
+ #undef HAVE_GSL_MULTIMIN_FMINIMIZER_NMSIMPLEX2
+ 
diff -Nru odin-1.8.8/debian/patches/series odin-1.8.8/debian/patches/series
--- odin-1.8.8/debian/patches/series    2015-09-16 16:29:42.000000000 +0200
+++ odin-1.8.8/debian/patches/series    2015-12-03 15:07:52.000000000 +0100
@@ -1 +1,2 @@
 ld-as-needed.diff
+gsl-2.patch

Reply via email to