Opened 12 years ago

Closed 12 years ago

#511 closed defect (fixed)

linking statically against atlas fails on Fedora

Reported by: Peter Owned by: Jari Häkkinen
Priority: major Milestone: yat 0.6
Component: build Version: 0.5.2
Keywords: Cc:

Description (last modified by Jari Häkkinen)

related to #349 and #527

The problem below is due to the fact that libraries are linked in the wrong order. The issue ii) reported in #527 pin-points the location in configure.ac that causes the problem.

On my Fedora machine I have atlas available in /usr/lib/atlas, so I configure with ./configure LDFLAGS=-L/usr/lib/atlas, which results in

...
configure: checking for libraries
checking for cos in -lm... yes
checking for library containing cblas_sdsdot... -lcblas
checking for gsl-config... /usr/bin/gsl-config
checking for GSL - version >= 1.8... yes
checking for boostlib >= 1.33... yes
...

This looks fine; everything is found, and it works perfect. Until I wanted to link statically, and for that reason added

AM_LDFLAGS += -all-static

in test/Makefile.am, after which make check results in

...
/bin/sh ../libtool --tag=CXX   --mode=link g++ -Wall -pedantic -g -O   -all-static -L/usr/lib/atlas -o alignment_test alignment_test.o ../yat/libyat.la libyattest.la -lgsl -lcblas -lm 
libtool: link: g++ -Wall -pedantic -g -O -static -o alignment_test alignment_test.o  -L/usr/lib/atlas ../yat/.libs/libyat.a /usr/lib/libgslcblas.a ./.libs/libyattest.a /usr/lib/libgsl.a -lcblas -lm
/usr/lib/atlas/libcblas.a(cblas_caxpy.o): In function `cblas_caxpy':
(.text+0x81): undefined reference to `ATL_caxpy'
/usr/lib/atlas/libcblas.a(cblas_ccopy.o): In function `cblas_ccopy':
(.text+0x6d): undefined reference to `ATL_ccopy'
/usr/lib/atlas/libcblas.a(cblas_cdotc.o): In function `cblas_cdotc_sub':
(.text+0x7d): undefined reference to `ATL_cdotc_sub'
/usr/lib/atlas/libcblas.a(cblas_cdotu.o): In function `cblas_cdotu_sub':
(.text+0x7d): undefined reference to `ATL_cdotu_sub'
...

This is clearly a problem with atlas, which is also confirmed when I issue 'make check LIBS=-latlas' which works.

This is not only a problem in yat build, but the same thing happened when I tried it on a binary outside since the problem propagates via libyat.la.

Change History (9)

comment:1 Changed 12 years ago by Jari Häkkinen

Description: modified (diff)

comment:2 Changed 12 years ago by Jari Häkkinen

(In [1903]) Fixes #527 and addresses #511.

comment:3 Changed 12 years ago by Jari Häkkinen

Peter, can you test the fix on the troublesome machine?

comment:4 Changed 12 years ago by Peter

That did not fix the problem.

comment:5 in reply to:  4 ; Changed 12 years ago by Jari Häkkinen

Replying to peter:

That did not fix the problem.

What is the output from configure and the compilation?

comment:6 in reply to:  5 Changed 12 years ago by Peter

Milestone: yat 0.5.3yat 0.x+

Replying to jari:

Replying to peter:

That did not fix the problem.

What is the output from configure and the compilation?

Same as in description.

The problem is that I link against a libcblas that needs libatlas. When linking dynamically this works fine as libcblas.so provides the information that latlas is needed. That is not the case when linking statically. As of the new semantics in yat 0.6 regarding cblas (ticket:518), we do not code that information into libyat. Only place one can find information about which cblas was found during configure of yat is in yat-config. It would be nice to have a static flag or something in yat-config but I'm not sure how the information should be retrieved during configure.

This is clearly beyond the scope of the stable branch, so I change the milestone.

comment:7 Changed 12 years ago by Jari Häkkinen

Maybe it is possible to force the check to use static flag or the linker to ignore library references (the refs shown using ldd).

comment:8 Changed 12 years ago by Peter

Milestone: yat 0.x+yat 0.6

The issue vanished after ticket:349 was implemented.

comment:9 Changed 12 years ago by Peter

Resolution: fixed
Status: newclosed

(In [1931]) adding a test for static linking with libyat. closes #511

Note: See TracTickets for help on using tickets.