[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Problems with compiling Non Linear Fit Example

From: Patrick Alken
Subject: Re: [Help-gsl] Problems with compiling Non Linear Fit Example
Date: Tue, 20 Mar 2018 09:20:39 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0


  I just installed a clean version of GSL v2.4 in my home directory to try your program. Here are the commands I used:

> cd gsl-2.4
> ./configure --prefix=/home/palken/usr
> make
> make install
> gcc -g -Wall -o test test.c -lm /home/palken/usr/lib/libgsl.a -lgslcblas
> ./test
summary from method 'trust-region/levenberg-marquardt'
number of iterations: 16
function evaluations: 23
Jacobian evaluations: 17
reason for stopping: small step size
initial |f(x)| = 62.202928
final   |f(x)| = 5.454180
chisq/dof = 0.804002
A      = 5.17379 +/- 0.27938
lambda = 0.11104 +/- 0.00817
b      = 1.05283 +/- 0.05365
status = success

Note that when compiling test.c, I gave the full path to the new GSL v2.4 library (your issue is probably that the linker is trying to link with an old version of GSL). Hope this helps.


On 02/16/2018 01:45 AM, Dr. Jonny Birkhan wrote:
Dear all,

I have installed gsl-2.4 on a

Linux 4.4.0-103-generic #126-Ubuntu SMP Mon Dec 4 16:23:28 UTC 2017 x86_64.

The libraries are installed in /usr/local/lib.

My gcc version is: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.6) 5.4.0 20160609

When I try to compile the Exponential Fitting Example I get the following messages:

gcc -LLIBDIR=/usr/local/lib -o test test.c -lm -lgsl -lgslcblas

/tmp/ccuzgEIN.o:: In function `callback':
test.c:(.text+0x2b1): undefined reference to `gsl_multifit_nlinear_residual' test.c:(.text+0x2c1): undefined reference to `gsl_multifit_nlinear_position'
test.c:(.text+0x2d8): undefined reference to `gsl_multifit_nlinear_rcond'
/tmp/cclIWgcr.o: In function `main':
test.c:(.text+0x386): undefined reference to `gsl_multifit_nlinear_trust'
test.c:(.text+0x399): undefined reference to `gsl_multifit_nlinear_default_parameters'
test.c:(.text+0x640): undefined reference to `gsl_multifit_nlinear_alloc'
test.c:(.text+0x665): undefined reference to `gsl_multifit_nlinear_winit'
test.c:(.text+0x671): undefined reference to `gsl_multifit_nlinear_residual' test.c:(.text+0x6f6): undefined reference to `gsl_multifit_nlinear_driver'
test.c:(.text+0x708): undefined reference to `gsl_multifit_nlinear_jac'
test.c:(.text+0x729): undefined reference to `gsl_multifit_nlinear_covar'
test.c:(.text+0x755): undefined reference to `gsl_multifit_nlinear_trs_name'
test.c:(.text+0x764): undefined reference to `gsl_multifit_nlinear_name'
test.c:(.text+0x78f): undefined reference to `gsl_multifit_nlinear_niter'
test.c:(.text+0xa9e): undefined reference to `gsl_multifit_nlinear_free'
collect2: error: ld returned 1 exit status

I guess it's a problem with a missing library file. I couldn't find any bug report on that problem.

The source code is appended.

Can you help me?

Thanks in advance and best regards,

Jonny Birkhan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]