Opened 3 years ago

Closed 3 years ago

#29361 closed defect (fixed)

openblas spkg-configure.m4: Fix the check for lapack/cblas functions

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.1
Component: build: configure Keywords:
Cc: Dima Pasechnik Merged in:
Authors: Matthias Koeppe Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: 71ac6a5 (Commits, GitHub, GitLab) Commit: 71ac6a5e18ad2e08383a122ef305df593a34aa3a
Dependencies: Stopgaps:

Status badges

Description

This line (introduced in #29071):

        AC_FC_FREEFORM([AC_FC_FUNC([dgeqrf])])

is not executed at all because AC_FC_FREEFORM is AC_DEFUN_ONCE and is called already in gfortran/spkg-configure.m4

As a result:

Checking whether SageMath should install SPKG openblas...
checking BLAS library... openblas
checking whether any of gfortran is installed or will be installed as SPKG... no
checking for openblas >= 0.2.20... yes
checking for cblas_dgemm... yes
checking for ... no
checking for lapack... no
configure: no suitable system package found for SPKG openblas

In this ticket, we fix the check by avoiding AC_FC_FUNC altogether, which is not suitable to be used in a configure that must work if no Fortran compiler is available.

(Factored out from #29104.)

Change History (14)

comment:1 Changed 3 years ago by Matthias Köppe

Branch: u/mkoeppe/openblas_spkg_configure_m4__fix_the_check_for_lapack_cblas_functions

comment:2 Changed 3 years ago by Matthias Köppe

Authors: Matthias Koeppe
Commit: 71ac6a5e18ad2e08383a122ef305df593a34aa3a
Status: newneeds_review

New commits:

bb89447build/pkgs/openblas/spkg-configure.m4: Use OPENBLAS_{LIBS,CFLAGS} while checking for cblas/lapack functions
71ac6a5build/pkgs/openblas/spkg-configure.m4: Do not use AC_FC_FUNC.

comment:3 Changed 3 years ago by Dima Pasechnik

Reviewers: Dima Pasechnik
Status: needs_reviewpositive_review

good, it works.

comment:4 Changed 3 years ago by Matthias Köppe

Thanks.

comment:5 Changed 3 years ago by Dima Pasechnik

Again, with Fedora there is a subsequent problem installing cblas.pc, but it is fixed by #29082

comment:6 Changed 3 years ago by Markus Wageringel

This does not seem to work for me with Homebrew. I still get

Checking whether SageMath should install SPKG openblas...
checking BLAS library... openblas
checking whether any of gfortran is installed or will be installed as SPKG... no
checking for OPENBLAS... yes
checking for library containing cblas_dgemm... -lopenblas
checking for library containing ... no
checking for LAPACK... no
configure: no suitable system package found for SPKG openblas

after a distclean and running

./configure \
     LDFLAGS="-L/usr/local/opt/readline/lib -L/usr/local/opt/openblas/lib" \
     CPPFLAGS="-I/usr/local/opt/readline/include -I/usr/local/opt/openblas/include" \
     PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/openblas/lib/pkgconfig"

comment:7 Changed 3 years ago by Matthias Köppe

Did you run bootstrap?

comment:8 Changed 3 years ago by Markus Wageringel

Ok, running bootstrap solves this. My bad.

I do get an error running bootstrap though, but probably not from this ticket.

build/pkgs/iconv/spkg-configure.m4:2: warning: macro 'AM_ICONV' not found in library
...
configure:18231: error: possibly undefined macro: AM_ICONV
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

comment:9 Changed 3 years ago by Matthias Köppe

Need to add to ACLOCAL_PATH. See .homebrew-build-env in #29104

comment:10 Changed 3 years ago by Markus Wageringel

I thought I had done that, but must have messed it up. All good now. Thank you.

comment:11 Changed 3 years ago by Matthias Köppe

I still see problems with finding openblas on fedora-32-standard at https://github.com/mkoeppe/sage/runs/524868616 (which has #29082): Does not find openblas, installs its own openblas, then openblas-dependent packages such as iml, gsl fail to compile. This is in contrast to fedora-32-minimal (which has no system openblas) - where iml builds successfully

comment:12 Changed 3 years ago by Dima Pasechnik

it cannot find openblas, as Fedora does not install openblas.pc

it is out of scope of this ticket.

It is possible to get around this by either shipping or generating one, though.

comment:13 in reply to:  12 Changed 3 years ago by Matthias Köppe

OK I have created #29393 for the Fedora issue.

comment:14 Changed 3 years ago by Volker Braun

Branch: u/mkoeppe/openblas_spkg_configure_m4__fix_the_check_for_lapack_cblas_functions71ac6a5e18ad2e08383a122ef305df593a34aa3a
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.