Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] linking gsl with atlas-sse2
- Date: Mon, 6 Nov 2006 15:57:31 +0100
- From: Michal Hajek <hajek1@example.com>
- Subject: [tlug] linking gsl with atlas-sse2
- User-agent: Mutt/1.5.13 (2006-08-11)
Hello list, I am trying to compile a simple program based on gsl (Gnu Scientific Library) example, look below for source. I also have atlas-sse2 libraries installed on my system [1] and I want to link it with the program. But here is the result: # gcc -Wall -c test.c # -- so far everything seem to go well # gcc test.o -lgsl -lcblas -latlas -lm /usr/bin/ld: cannot find -lcblas collect2: ld returned 1 exit status # -- this is my problem. First I thougt the /etc/ld.so.conf is my friend, but: # cat /etc/ld.so.conf /usr/X11R6/lib /usr/lib/atlas/sse2 /usr/lib/sse2 include /etc/ld.so.conf.d/*.conf # And after that I looked if actually I have the required lib's # ls -la /usr/lib/sse2 total 25464 drwxr-xr-x 2 root root 4096 Nov 6 15:33 . drwxr-xr-x 103 root root 24576 Nov 6 15:39 .. -rw-r--r-- 1 root root 8572678 May 23 03:40 libatlas.a lrwxrwxrwx 1 root root 13 Nov 6 15:33 libatlas.so -> libatlas.so.3 lrwxrwxrwx 1 root root 15 Nov 3 14:00 libatlas.so.3 -> libatlas.so.3.0 -rw-r--r-- 1 root root 5805888 May 23 03:40 libatlas.so.3.0 -rw-r--r-- 1 root root 302296 May 23 03:41 libcblas.a lrwxrwxrwx 1 root root 13 Nov 6 15:33 libcblas.so -> libcblas.so.3 lrwxrwxrwx 1 root root 15 Nov 3 14:00 libcblas.so.3 -> libcblas.so.3.0 -rw-r--r-- 1 root root 5208384 May 23 03:40 libcblas.so.3.0 -rw-r--r-- 1 root root 352754 May 23 03:41 libf77blas.a lrwxrwxrwx 1 root root 15 Nov 6 15:33 libf77blas.so -> libf77blas.so.3 lrwxrwxrwx 1 root root 17 Nov 3 14:00 libf77blas.so.3 -> libf77blas.so.3.0 -rw-r--r-- 1 root root 5196064 May 23 03:40 libf77blas.so.3.0 -rw-r--r-- 1 root root 357864 May 23 03:41 liblapack_atlas.a lrwxrwxrwx 1 root root 20 Nov 6 15:33 liblapack_atlas.so -> liblapack_atlas.so.3 lrwxrwxrwx 1 root root 22 Nov 3 14:00 liblapack_atlas.so.3 -> liblapack_atlas.so.3.0 -rw-r--r-- 1 root root 166688 May 23 03:40 liblapack_atlas.so.3.0 This I do not understand. Why the linker cannot find libcblas.so.3.0 library? If I compile and link the program with only gsl libraries, eg. # gcc -Wall -t test.c # gcc test.o -lgsl -lgslcblas -lm everything works well. I get a.out binary and the program runs (presumably) as expected. The gslcblas library is located in /usr/lib/ I have tried to run ldconfig, but it did not change anything. ld still cannot find cblas or atlas. Obviously, I am missing something, but I cannot see what. Is there someone with better eyes? :) [1] debian testing on IBM X40 installed libgsl0-dev 1.8-1 libgsl0 1.8-1 gsl-bin 1.8-1 atlas3-headers 3.6.0-20.2 atlas3-sse2-dev 3.6.0-20.2 atlas3-sse2 3.6.0-20.2 Best regards Michal ----- source test.c ----- #include <stdio.h> #include <gsl/gsl_multifit.h> int main (int argc, char **argv) { int i, n; double xi, yi, chisq; gsl_matrix *X, *cov; gsl_vector *y, *c; if (argc != 2) { fprintf (stderr,"usage: fit n < data\n"); exit (-1); } n = atoi (argv[1]); X = gsl_matrix_alloc (n, 3); y = gsl_vector_alloc (n); c = gsl_vector_alloc (3); cov = gsl_matrix_alloc (3, 3); for (i = 0; i < n; i++) { int count = fscanf (stdin, "%lg %lg", &xi, &yi); if (count != 2) { fprintf (stderr, "error reading file\n"); exit (-1); } printf ("%g %g\n", xi, yi); gsl_matrix_set (X, i, 0, 1.0); gsl_matrix_set (X, i, 1, xi); gsl_matrix_set (X, i, 2, xi*xi); gsl_vector_set (y, i, yi); } { gsl_multifit_linear_workspace * work = gsl_multifit_linear_alloc (n, 3); gsl_multifit_linear (X, y, c, cov, &chisq, work); gsl_multifit_linear_free (work); } #define C(i) (gsl_vector_get(c,(i))) #define COV(i,j) (gsl_matrix_get(cov,(i),(j))) { printf ("# best fit: Y = %g + %g X + %g X^2\n", C(0), C(1), C(2)); printf ("# covariance matrix:\n"); printf ("[ %+.5e, %+.5e, %+.5e \n", COV(0,0), COV(0,1), COV(0,2)); printf (" %+.5e, %+.5e, %+.5e \n", COV(1,0), COV(1,1), COV(1,2)); printf (" %+.5e, %+.5e, %+.5e ]\n", COV(2,0), COV(2,1), COV(2,2)); printf ("# chisq = %g\n", chisq); } return 0; }
- Follow-Ups:
- Re: [tlug] linking gsl with atlas-sse2
- From: Edward Middleton
- [tlug] linking gsl with atlas-sse2
- From: stephen
Home | Main Index | Thread Index
- Prev by Date: [tlug] [Announcement] TLUG Technical Meeting 11-11-2006
- Next by Date: Re: [tlug] CJK Printing from Web Browsers in Debian 3.3.2
- Previous by thread: [tlug] [Announcement] TLUG Technical Meeting 11-11-2006
- Next by thread: Re: [tlug] linking gsl with atlas-sse2
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links