Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example code given for curve fitting with Gnu Scientific Library wont run.

I am trying to use GSL for least square fitting, but I can't even make the example run properly. It compiles, but when running the program it gives the error

dyld: lazy symbol binding failed: Symbol not found: _cblas_dnrm2

Referenced from: /usr/local/lib/libgsl.0.dylib

Expected in: dynamic lookup

I believe I have narrowed down the problem to the line

gsl_multifit_fdfsolver_set (s, &f, &x.vector);

but I have not the slightest clue why.

I am running it on OSX with GSL 1.15 (though I innitially insalled the wrong version, 1.9). I compile it in the terminal using: gcc unchanged_example.c -o examplefitter -lgsl -lm

EDIT: solution was found here. adding '-lgslcblas' when compiling sorted it out

like image 831
AugJoh Avatar asked Dec 01 '25 13:12

AugJoh


1 Answers

For anyone coming across this you need to link against two libraries...

gcc -Wall -O3 -g -lgslcblas -lgsl -std=c11 -pedantic-errors
like image 172
Harry Avatar answered Dec 03 '25 10:12

Harry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!