tantalum <[email protected]> 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 ...
