Skip to content

Commit

Permalink
Trac #29071: verify if cblas.pc and lapack.pc should be replaced by l…
Browse files Browse the repository at this point in the history
…inks to openblas.pc

currently openblas's spkg-configure.pc unconditionally makes cblas.pc
and lapack.pc copies of openblas.pc, which in some cases if incorrect,
e.g. Arch Linux has libcblas linked to libopenblas
and containing stuff missing in libopenblas, resulting in errors.

this has been reported on sage-devel
https://groups.google.com/d/msg/sage-devel/pIOnFyFJMtM/_FbzM2OxCQAJ

So we should make these installations conditional.

URL: https://trac.sagemath.org/29071
Reported by: dimpase
Ticket author(s): Dima Pasechnik
Reviewer(s): Isuru Fernando, Matthias Koeppe
  • Loading branch information
Release Manager committed Jan 31, 2020
2 parents ef9af32 + 3a4524e commit 2c207ea
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions build/pkgs/openblas/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
SAGE_SPKG_CONFIGURE([openblas], [
SAGE_SPKG_DEPCHECK([gfortran], [
PKG_CHECK_MODULES([OPENBLAS], [openblas >= 0.2.20], [
PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [
AC_CONFIG_LINKS([
$SAGE_SRC/lib/pkgconfig/blas.pc:$OPENBLASPCDIR/openblas.pc
$SAGE_SRC/lib/pkgconfig/cblas.pc:$OPENBLASPCDIR/openblas.pc
$SAGE_SRC/lib/pkgconfig/lapack.pc:$OPENBLASPCDIR/openblas.pc])
sage_install_blas_pc=yes
AC_SEARCH_LIBS([cblas_dgemm], [openblas], [dnl openblas works as cblas
sage_install_cblas_pc=yes
], [
dnl openblas does not work as cblas; try to use system's cblas as is
PKG_CHECK_MODULES([CBLAS], [cblas], [], [sage_spkg_install_openblas=yes])
])
AC_FC_FREEFORM([AC_FC_FUNC([dgeqrf])])
AC_SEARCH_LIBS([$dgeqrf], [openblas], [dnl openblas works as lapack
sage_install_lapack_pc=yes
], [
dnl openblas does not work as lapack; try to use system's lapack as is
PKG_CHECK_MODULES([LAPACK], [lapack], [], [sage_spkg_install_openblas=yes])
])
], [
AC_MSG_WARN([Unable to locate the directory of openblas.pc. This should not happen!])
sage_spkg_install_openblas=yes
])
], [sage_spkg_install_openblas=yes])
], [
AS_IF([test x$sage_spkg_install_openblas != xyes], [
m4_foreach([blaslibnam], [blas, cblas, lapack], [
AS_IF([test x$sage_install_]blaslibnam[_pc = xyes], [
AC_CONFIG_LINKS([$SAGE_SRC/lib/pkgconfig/]blaslibnam[.pc:$OPENBLASPCDIR/openblas.pc])])
])
])
])
], [
AS_IF([test "x$with_blas" = xopenblas], [
sage_require_openblas=yes
sage_require_atlas=no])
Expand Down

0 comments on commit 2c207ea

Please sign in to comment.