# Getting going with gsl-integration

**URL:** <https://racket.discourse.group/t/getting-going-with-gsl-integration/3164>\
**Category:** Questions & Answers\
**Tags:** gsl\
**Created:** [September 11, 2024, 12:40pm UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164 "2024-09-11T12:40:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexG](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@AlexG](https://racket.discourse.group/u/AlexG)\
**Post date:** [September 11, 2024, 12:40pm UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164/1 "2024-09-11T12:40:03Z")

</div>

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:

```scheme
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?

---

<div class="post-metadata">

**Author:** ![AlexG](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@AlexG](https://racket.discourse.group/u/AlexG)\
**Post date:** [September 11, 2024, 9:03pm UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164/2 "2024-09-11T21:03:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [September 12, 2024, 5:26am UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164/3 "2024-09-12T05:26:19Z")

</div>

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

```scheme
(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

```scheme
#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.

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [September 12, 2024, 5:34am UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164/4 "2024-09-12T05:34:35Z")

</div>

Made this pull request:

> <https://github.com/petterpripp/gsl-integration/pull/1>
>
> It looks like the current version of the code works only with versionless shared… libraries, and won't therefore work on (e.g.) debian or ubuntu after using apt-get to install libgsl. In order to make this work, it appears necessary to specify acceptable version numbers. Based on some really cursory research, it appears to me that this code "works" (that is, loads without error) with version 27 of libgsl and version 0 of libgslcblas. This pull request specifies that these are acceptable versions, and loads them.

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.

---

<div class="post-metadata">

**Author:** ![AlexG](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@AlexG](https://racket.discourse.group/u/AlexG)\
**Post date:** [September 21, 2024, 1:32am UTC](https://racket.discourse.group/t/getting-going-with-gsl-integration/3164/5 "2024-09-21T01:32:32Z")

</div>

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](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!
