It sounds like your LD_LIBRARY_PATH environment variable doesn't include the directory where the GSL libraries are, which implies that it was installed to a nonstandard location. The simple fix will be to set LD_LIBRARY_PATH to include the directory where the GSL library was installed. Alternatively, you can link with the GSL static library, libgsl.a, if it was created as part of the installation procedure. Read this: https://www.gnu.org/software/gsl/manual/gsl-ref.html#Shared-Libraries and you can find the directory by checking the output of gsl-config --libs If you want the latest version of GSL to be available to your entire system, you may prefer to change the installation directory to a standard one, like /usr/local. To do that, repeat the installation procedure and pass the --prefix=/directory option to configure. ./configure --prefix=/usr/local You don't need to use sudo for make, by the way. Only for make install.
:) David On 5/5/16 7:22 PM, Niftitech wrote: > Hi, > > I’m struggling with GSL, I’m on Ubuntu 14.04 and have just installed GSL. > I downloaded the latest GSL release, and ran ./configure in the extracted > folder, then sudo make, and after that sudo make install. > Everything seems to have worked fine during the installation. > > I’ve tried some basic examples from the documentation. The first example from > this page works great. > > But this example does not work. I get the following error: > gcc main.c -o main -lgsl -lgslcblas -lm > /tmp/cclZjB9J.o: I funktionen "main": > main.c:(.text+0xe): undefined reference to `gsl_interp2d_bilinear' > main.c:(.text+0x88): undefined reference to `gsl_spline2d_alloc' > main.c:(.text+0xbc): undefined reference to `gsl_spline2d_set' > main.c:(.text+0xde): undefined reference to `gsl_spline2d_set' > main.c:(.text+0x10e): undefined reference to `gsl_spline2d_set' > main.c:(.text+0x130): undefined reference to `gsl_spline2d_set' > main.c:(.text+0x156): undefined reference to `gsl_spline2d_init' > main.c:(.text+0x26b): undefined reference to `gsl_spline2d_eval' > main.c:(.text+0x308): undefined reference to `gsl_spline2d_free' > collect2: error: ld returned 1 exit status > > So I googled for a while, found another way to reference the libraries needed: > gcc -o main main.c `gsl-config --cflags --libs` > simon@simon-bnt:~/Skrivbord/gsl-test$ ./main > ./main: error while loading shared libraries: libgsl.so.19: cannot open > shared object file: No such file or directory > > But as you can see that did not work either. > I’d like to be able to compile the whole program into an executable file, so > I’d rather link the libraries. > > I’d be really happy for your’e help. > > Kind regards, > Simon Månsson > Niftitech >
