Getting going with gsl-integration

I am trying to set up the gsl-integration package.
I have installed the package itself, and I have (I think) installed the GNU GSL libraries too.
I am using DrRacket 8.6 under Ubuntu 22.04

I tried to install the C libraries with

sudo apt-get install libgsl0ldbl
as suggested on the the gsl site, but was informed that they were superseded so I installed

  • libgsl27 and
  • libgslcblas0
    instead as recommended.
    However if I click "Run" now, with the line
    (require gsl-integration)
    I get:
xxxX ../../../../../usr/share/racket/collects/ffi/unsafe.rkt:131:0: ffi-lib: could not load foreign library
  path: libgslcblas.so
  system error: libgslcblas.so: cannot open shared object file: No such file or directory

Interactions disabled: racket does not support a REPL (no #%top-interaction)

So I guess that either libgslcblas.so has not been installed, or the system has not been updated with its successor.

Has anyone actually managed to get it going?

Or, for that matter, is there another numerical integration library available for Racket?

PS. -----
I have checked the paths, and this lib is available
/usr/lib/x86_64-linux-gnu/libgslcblas.so.0

Perhaps there is a package file that needs updating?

I tried looking at the racket/collects/ff/unsafe.rkt file, but there is no text "libgslcblas" in it, it's getting it from somewhere external.

There is also a comment section relating to problems with "C" ffi files with .so suffix, but my knowledge is insufficient to make out head or tail of it.

It looks to me like this racket library was written in a way that works only with versionless shared libraries. I can't say for sure which versions of the libraries are common across operating systems, but I can tell you that I got it working by editing the uses of ffi-lib in the wrap.rkt file to read

(define-ffi-definer gslcblas (ffi-lib "libgslcblas" '("0" #f) #:global? #t))
(define-ffi-definer gsl (ffi-lib "libgsl" '("27" #f)  #:global? #t))

... and when I say "working", what I mean is that the file

#lang racket
(require gsl-integration)

... runs without error.

It would be nice to hear from the package author, peter pripp, what versions of libgsl and of libgslcblas are expected to work with this code.

I'm going to go ahead and make a pull request, just for the heck of it, but I would expect the quick solution for you would be to make the edits I describe above. Let me know if you have trouble finding the right place to make the edits.

Made this pull request:

To be clear (in case this wasn't already obvious sorry), this pull request doesn't improve your life in any way unless the PR is accepted. Changing the code manually as I described above should work, though.

The first examples from the gsl-integration docs work too, with this fix, thanks very much!

https://docs.racket-lang.org/gsl-integration/index.html

I will assume all the rest is OK, I'll have a chance to explore it a bit over the w/e. Nice library to have around! I think it contains a lot more than first meets the eye...


I don't really understand much of the ffi/lib interfacing stuff, but it seems that you have added the '("0" #f) to the first line and the ("27" #f) to the second one.
Is it possible to explain in a line or so what their significance is?
PS. Ah, OK, I saw your post on github and I have at least a vague idea now.
(The suggestion also exists in the docs, but I missed it first time)

Cheers!