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

Re: lib/libgsl.so: undefined reference to `cblas_ztrsv' (on Ubuntus)



On Tue, 03 Sep 2013, Andrey Rahmatullin wrote:
> > ~/afni-0.20130830~dfsg.1/build-x86_64-linux-gnu/avovk# gcc  --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wformat-security -g -O2 -fstack-protector
> > --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wno-unused  -fopenmp -DUSE_OMP  -Wl,-z,now -Wl,-z,relro -Wl,--no-undefined
> > CMakeFiles/3dkmeans.dir/3dkmeans.c.o CMakeFiles/3dkmeans.dir/cluster_floatNOMASK.c.o CMakeFiles/3dkmeans.dir/thd_segtools_fNM.c.o  -o 3dkmeans
> > ../libmri.so ../libmrix.so ../coxplot/libcoxplot.so libsegtools.so -lSM -lICE -lX11 -lXext -lXm -lXmHTML ../libmri.so -lvolpack -lnetcdf -lXt -lf2c
> > -lgiftiio -lnifticdf -lniftiio -lz -lnifticdf -lniftiio -lz -lgsl  -lgslcblas -lm
> > -Wl,-rpath,"/tmp/buildd/afni-0.20130830~dfsg.1/build-x86_64-linux-gnu:/tmp/buildd/afni-0.20130830~dfsg.1/build-x86_64-linux-gnu/coxplot:/tmp/buildd/a
> > fni-0.20130830~dfsg.1/build-x86_64-linux-gnu/avovk:" -DNDEBUG
> > /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libgsl.so: undefined reference to `cblas_ztrsv'
> > /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libgsl.so: undefined reference to `cblas_scasum'
> If you ship a public library with undefined symbols it is not just simply
> wrong, it's also a violation of a Policy "must" (10.2) and hence an RC
> bug. In any case, please don't. It's 2013 already.

Well -- I am not shipping any public library here... so I guess I am
reading your comment as pertinent to libgsl which should have been
linked against libgslcblas?

btw - even on Debian systems it is not:
$> ldd /usr/lib/libgsl.so                         
    linux-vdso.so.1 (0x00007fff5fddb000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f558ccc9000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f558c91d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f558d483000)

but I am not sure here if that is not intentional to allow "flexibility" to
decide to link against a specific blas implementation (gsl's or
system-wide)...

> > and here you can see that ld finds the definition but then reports that it is
> > undefined in libgsl.so (which is factually true but I thought it would use the
> > one from libgslcblas by then).
> You can't link in shared libs with undefined symbols when using
> --as-needed which is default on Ubuntu (well, sometimes you probably can
> but not in this case).

ha -- I thought I have checked for that but I guess I have not removed all
--as-needed from that call.  If I remove all of them from  ld call -- links
fine! Adding -Wl,--no-as-needed to gcc call seems to resolve this issue --
thanks!

So I guess -Wl,--no-as-needed is needed for any linking against gsl, gslcblas
libraries ATM on Ubuntus.

Cheers,
-- 
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Senior Research Associate,     Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


Reply to: