ld: library not found for -lgsl

断了今生、忘了曾经 提交于 2019-12-18 14:46:41

问题


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.


回答1:


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.




回答2:


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



回答3:


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



来源:https://stackoverflow.com/questions/16682156/ld-library-not-found-for-lgsl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!