AugJoh
AugJoh

Reputation: 33

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

Upvotes: 3

Views: 1918

Answers (2)

Harry
Harry

Reputation: 11638

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

gcc -Wall -O3 -g -lgslcblas -lgsl -std=c11 -pedantic-errors

Upvotes: 2

duffymo
duffymo

Reputation: 308733

You need to find the shared library that contains _cblas_dnrm2 and link it into your application.

Upvotes: 1

Related Questions