Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld: library not found for -lgsl

Tags:

path

macos

gsl

I'm working in OSX and I'm attempting to run a make file and when I try I get the following:

ld: library not found for -lgsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [harm] Error 1

Earlier I found out the I needed to get the gsl library and I used mac ports and typed:

sudo port install gsl

into my command line window and it seemed to isntall okay. Is the missing lgsl not configured correctly or does it not come with gsl? I tried googling lgsl but didn't get much. I've only been at programming a few days and I don't know if I was supposed to set a path, or even really how to do that.

Thanks for any help you guys could offer.

like image 264
Novice C Avatar asked May 22 '13 01:05

Novice C


3 Answers

I just wanted to say that I had the exact problem on OSX. Rather than setting an environment variable, I used an additional compiler flag -L/opt/local/lib, which then lets one use -lgsl. I reference this answer.

like image 121
Mani Avatar answered Nov 14 '22 20:11

Mani


I got the same issue and here is how I fixed it:

export LIBRARY_PATH=/usr/local/Cellar/gsl/1.16/lib/

I had previously installed gsl using:

brew install gsl
like image 21
Chevdor Avatar answered Nov 14 '22 20:11

Chevdor


You need to add the path for where the macports installed the gsl library to your LD_LIBRARY_PATH environment variable (or most likely into the build script environment). I believe macports stores things in /opt/local/lib

like image 5
Aditya Nagrath Avatar answered Nov 14 '22 22:11

Aditya Nagrath