guile-user
[Top][All Lists]
Advanced

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

Re: how to use gsl with the guile ffi


From: Matt Wette
Subject: Re: how to use gsl with the guile ffi
Date: Fri, 28 Dec 2018 12:01:04 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

tantalum <address@hidden> writes:
im getting the error "In procedure dynamic-link: file: "libgsl",
message: "file not found"" with the following code:

      (import (system foreign))
      (define gsl (dynamic-link "libgsl"))

* gsl (optionally?) depends on libgslcblas, which itself links without
error, but loading it with (dynamic-link) beforehand did not help
* some libraries work, for example libmagic. libm for example gives the
same error message
* the file /usr/lib/libgsl.so exists and is a symlink to the regular
file libgsl.so.23.1.0 whose content begins with ELF>
* similar problem on the mailing list
https://lists.gnu.org/archive/html/guile-user/2016-05/msg00010.html
* ive tried to set LD_LIBRARY_PATH with export to /usr/lib with no
apparent effect
* i was going from this manual entry
https://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html
* guile (GNU Guile) 2.2.4

the issue can actually be reproduced with a c program:

      #include <dlfcn.h>
      #include <stdio.h>

      int main () {
        void* a = dlopen("libgsl.so", RTLD_NOW);
        printf("got %p\n", a);
        if (a) printf("ok\n"); else printf("error: %s\n", dlerror());
      }

gcc t.c -ldl && ./a.out

the program only works without error when compiled with -lgslcblas.
so, it could be a more basic issue, but i dont know how to proceed.


I see this often enough.  It is not a Guile issue.  Your runtime needs to know
where to find the .so file.  Typically you can fix this problem by setting
LD_LIBRARY_PATH prior to "guile".  For HDF5 I need to ...
$ LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial
$ export LD_LIBRARY_PATH
$ guile hdf5demo.scm
...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]