mmottl / gsl-ocaml

OCaml bindings to the GSL (GNU Scientific Library).
Other
36 stars 10 forks source link

Build fails with gsl 2.1 #10

Closed opoplawski closed 8 years ago

opoplawski commented 8 years ago

Looking to update gsl to 2.1 in Fedora, build fails with:

lib/mlgsl_fit.c: In function 'ml_gsl_multifit_linear_svd':
lib/mlgsl_fit.c:154:35: warning: passing argument 2 of 'gsl_multifit_linear_svd' from incompatible pointer type [-Wincompatible-pointer-types]
     gsl_multifit_linear_svd(&m_x, &v_y, 
                                   ^
In file included from lib/mlgsl_fit.c:6:0:
/usr/include/gsl/gsl_multifit.h:74:1: note: expected 'gsl_multifit_linear_workspace * {aka struct <anonymous> *}' but argument is of type 'gsl_vector * {aka struct <anonymous> *}'
 gsl_multifit_linear_svd (const gsl_matrix * X,
 ^
lib/mlgsl_fit.c:154:5: error: too many arguments to function 'gsl_multifit_linear_svd'
     gsl_multifit_linear_svd(&m_x, &v_y, 
     ^
In file included from lib/mlgsl_fit.c:6:0:
/usr/include/gsl/gsl_multifit.h:74:1: note: declared here
 gsl_multifit_linear_svd (const gsl_matrix * X,
 ^
foretspaisibles commented 8 years ago

Are you building with opam or using another procedure? Do you know which compiler is used?

It looks like the code had a type error which is know uncovered by a C compiler which is more clever than it used to. :)

opoplawski commented 8 years ago

GSL's API changed a fair amount with version 2, so I figure that's what's triggering it. Full build information is here: https://copr-be.cloud.fedoraproject.org/results/orion/gsl2/fedora-rawhide-x86_64/00139365-ocaml-gsl/build.log.gz

mmottl commented 8 years ago

Sorry for the delay, I was too busy lately. Yes, indeed, the problem is due to significant API changes in GSL. They are apparently trying to make it more extensible by passing argument records to functions instead of adding more function parameters. This should make future extensions less intrusive and more backward compatible. Sadly, this may impose some significant changes right now. I haven't looked too carefully into how much work it would be. Hopefully, only a few functions will be affected. If not, I may need to constrain the compatibility of this library to GSL major version 1. I'll get back to you once I know more.

opoplawski commented 8 years ago

No problem, thanks for looking into it. Most other projects seem to have been able to handle it with just a few #fdef GSL_MAJOR_VERSION >= 2 conditionals so hopefully that will be the case here.

mmottl commented 8 years ago

Ok, I've uploaded a new version that should compile with the new GSL. I simply removed an offending function that is apparently not fully supported anymore anyway and which probably nobody is using. I also (temporarily) commented out a few special functions for Legendre polynomials for which I got linking errors even though they are part of the distributed header file. Probably an oversight by the GSL team. I may fix this later in the unlikely case that somebody complains about missing functionality. The new GSL package should be in OPAM soon.

opoplawski commented 8 years ago

Looks good here, thanks!