Package: lapack
Version: 3.4.2+dfsg-1
Severity: wishlist
The lapack build uses dpkg-buildflags --get LDFLAGS to obtain the LDFLAGS.
This can include -Bsymbolic-functions in some distributions (e.g.
ubuntu, but not debian).
The use of -Bsymbolic-functions to create liblapack.so binds the
xerblas_ implementation to the one provided in lapack itself.
This is very problematic as the lapack xerblas_ aborts the process on
invalid parameters.
User programs must have the option to override this error handler with
their own code.
To fix this to work on all derivatives and in case of a debian default
change please adapt the build do handle it.
There are two options, either strip the variable from dpkg-buildflags
output (DEB_LDFLAGS_STRIP) or keep it in and provide ld with a list of
functions to not bind to the library with --dynamic-list:
$ cat lapack.dym
{
xerblas;
# or LAPACKE_xerblas;
};
§ gcc -shared ... -Bsymoblic-functions --dynamic-list=lapack.dym
To test it use attached c file (linked against liblapacke) which should
print the overrided xerblas. This could be used as an autopkgtest so
derivatives are notified of the issue when they change their dpkg defaults.
#include <stdio.h>
#include <lapacke.h>
void LAPACKE_xerbla( const char *name, lapack_int info )
{
if( info < 0 ) {
printf( "override %d in %s\n", -(int) info, name );
}
}
int main (int argc, const char * argv[])
{
double a[5][3] = {1,1,1,2,3,4,3,5,2,4,2,5,5,4,3};
double b[5][2] = {-10,-3,12,14,14,12,16,16,18,16};
lapack_int info,m,n,lda,ldb,nrhs;
int i,j;
m = 5;
n = 9;
nrhs = 2;
lda = 3;
ldb = 2;
info = LAPACKE_dgels(LAPACK_ROW_MAJOR,'N',m,n,nrhs,*a,lda,*b,ldb);
printf("%d\n", info);
for(i=0;i<n;i++)
{
for(j=0;j<nrhs;j++)
{
printf("%lf ",b[i][j]);
}
printf("\n");
}
return(info);
}