On Feb 9, 8:51 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Fri, 09 Feb 2007 09:41:44 -0700, Jaap Spies <[EMAIL PROTECTED]> wrote:
> > William Stein wrote:
>
> >> Your error is related to building linbox, but I've never seen it on any of
> >> them many systems I tested on, so I don't know how to fix it.  (Building
> >> linbox on a range of machines is really difficult.)
>
> >> What happens if you build from scratch?  Does it then work fine, i.e., is
> >> it an upgrade error only?
>
> > This is a build from scratch.
>
> Darn.   The error:
>
> > <type 'exceptions.ImportError'>: 
> > /home/jaap/downloads/sage-2.1/local/lib/python2.5/site-packages/sage/matrix/matrix_modn_dense.so:
> >  undefined symbol: dasum_
>
> means that there is a function missing the BLAS (numerical linear algebra 
> system)
> that SAGE is being built against.  Could you send me the output of
>     ldd 
> /home/jaap/downloads/sage-2.1/local/lib/python2.5/site-packages/sage/matrix/matrix_modn_dense.so
>
> If output points to libgslcblas, I'm clueless.  If the output points to
> a system-wide BLAS, the problem would then be that for some reason the
> BLAS included in FC5 is missing at least one core standard function.  Since
> Linux vendors often do that sort of thing, that might be your problem.
> If it is, a workaround is to instead use the GSL CBLAS for the time
> being.  (Doing this requires modifying the linbox package's build script.)
> Anyways, let me know what ldd tells you.

I had the same problem on my machine (Debian testing Pentium M (32-
bit)).  It took a bit of digging, but I think I understand what's
happening.  The basic problem is that the linbox spkg-install and
devel/sage-main/setup.py disagree about how to link BLAS.

It appears that there are two standard ABIs for BLAS.  The original
ABI is based on Fortran and uses Fortran calling conventions and
routine names.  Recently, CBLAS also exists; this uses C calling
conventions and function names that start "cblas_".  There are
multiple implementations of both ABIs.  (For instance, BLAS defines
dasum_, and CBLAS defines cblas_dasum.)

Linbox can work with either ABI; it wants CBLAS, but comes with its
own CBLAS-ABI wrapper for BLAS (implemented as inline functions in a
header file).  This means that if linbox-config.h defines
__LINBOX_HAVE_CBLAS, then a linbox object file must be linked against
an implementation of CBLAS; otherwise it must be linked against an
implementation of BLAS.

Linbox checks at install time (in its ./configure) whether it can find
an implementation of BLAS or CBLAS.  If you pass in the filename of a
BLAS or CBLAS library, it will be used; otherwise, it will look for
libraries named libblas.a or libcblas.a in the standard directories.

On non-Darwin systems, the linbox spkg-install first lets the linbox
"configure" look for BLAS/CBLAS on its own; if that fails, it passes
in an explicit path to libgslcblas.a.  On my system (and presumably
Jaap's), configure does not find a libcblas.a, but does find a
libblas.a; then linbox-config.h does not define __LINBOX_HAVE_CBLAS,
and linbox object files must be linked against a BLAS implementation.

However, setup.py (after some conditionals that all fail on my
machine) hardcodes a library reference to gslcblas; since this is not
a BLAS implementation (it's a CBLAS implementation instead), the
result does not work.

I have a quick workaround that works for me (at least to the point
that I can start SAGE), but probably won't work in general; I changed
setup.py (at about line 15) to look like this:
elif os.path.exists('/usr/lib/libblas.dll.a') or \
     os.path.exists('/usr/lib/libblas.a'): # untested.
    CBLAS='blas'
else:
(I added the second line.)  This lets the linbox object files link
against a BLAS implementation.

The real fix is to either:
1) figure out what BLAS/CBLAS library the linbox "configure" found,
and link against the same library in setup.py; or
2) hardcode gslcblas always (in the linbox spkg-install and in
setup.py).

Carl Witty


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to