Linking libgsl and libgslcblas failing

Viewed 24

I am attempting to create a shared library that provides an easier interface for calling FFT and IFFT functions from GSL in C.

My C file.

  • fft.c

Building the object file. gcc -c -Wall -Wextra -O2 -fPIC fft.c -o fft.o

Object file builds perfectly.

Then the link command. gcc -L/usr/local/lib -Wl,-rpath=/usr/local/lib -shared -o libfft.so fft.o -lgsl -lgslcblas

No errors...

However, running the following command ldd libfft.so

prints the following output.

linux-vdso.so.1 found
libgsl.so => /usr/local/lib/libgsl.so  <--- CORRECT
libc.so.6 => found
libm.so.6 => found
/lib64/ld-linux-x86-64.so.2
libgslcblas.so => not found   <--- This is confusing me...

For some reason the libgsl.so is found in the correct location on my computer, but the libgslcblas.so is saying not found. Both libraries are in that directory.

Thank you so much for any answers.

EDIT (09/07/2022) After looking into the recommendation by https://stackoverflow.com/users/2581418/vitsoft the Dynamic section of the shared library was only showing libgsl.so as being (NEEDED). Then I thought maybe the actual libgsl.so I have is dependent upon libgslcblas.so.

Running the ldd command on libgsl.so, shows that it relies on libgslcblas.so, and it is not found. So, I may have built GSL incorrectly from source?..

This was exactly the problem, make sure to follow the directions of GSL when they tell you how to build their source code!

0 Answers
Related