I am trying to compile the simplest example program of the GNU Scientific Library with the current stable version: GLS-2.8, following the first example in the documentation at example.
The installation of the library was done in the default directories, as the example.
The steps of compilation of the example are:
1 gcc -Wall -I/usr/local/include -c example.c
2 gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm
These procedures worked fine and created the a.ou file, but when the ./a.out command was executed, the following message appears
“./a.out: Error loading shared libraries: libgsl.so.28: Cannot open shared object file: No such file or directory”.
Well, in the directory of the library (/usr/local/lib) is the file libgsl.so.28 inside like the others:
libgsl.a
libgslcblas.a
libgsl.so
libgslcblas.so
libgls.so.28
libgsl.so.28.0.0
Why did the linker not find the library? How should I change step 2 of the compilation?
Maybe the new version 2.8 needs some modification of the manual or I am missing some step.
I expected the example to work fine since the steps of the example in the manual were followed.
I am using gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 under Ubuntu 24.04.
Leonardo Miceli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.