Errors when trying to Build BLAS-LAPACK with MSYS2-MINGW64

Hello there,

I’ve followed literally the instructions in the nice web site from Wotao Yin (WY) (Link to WY) for installing MinGW64 under MSYS2, and then have tried to build Blas-Lapack libraries. I get one error that you can see at the end of the post related to a bug that is still present in the official Lapack-3.9.0 tar.gz file from Netlib.

Luckily such bug is already fixed here in GitHub (https://github.com/Reference-LAPACK/lapack.git), but for building&installing Blas-Lapack, the instructions from WY rely on a PKGBUILD script that you will also find below, and then… another problem arises: as you can see below PKGBUILD script checks the autenticity of the files with “sha256sums”, so that if I create my own tar.gz with the corrected files from GitHub, then it doesn’t passes the autentication with sha256sums :((

Any suggestion to solve it will be greatly appreciated, since I would really like to keep the MSYS2-MINGW64 console environment for programming under Windows 10 and… I need those Lapack libraries!

BTW, I wrote an email to the author of the PKGBUILD script, but received no answer for the moment.


ERROR MESSAGES

C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c: In function ‘LAPACKE_cgesvdq’:
C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c:69:34: warning: passing argument 21 of ‘LAPACKE_cgesvdq_work’ from incompatible pointer type [-Wincompatible-pointer-types]
   69 |                                  &rwork_query, lrwork );
      |                                  ^ ~~~~~~~~~~~
      |                                  |
      |                                  double *
In file included from C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/include/lapacke_utils.h:37,
                 from C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c:34:
C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/include/lapacke.h:5778:40: note: expected ‘float *’ but argument is of type ‘double *’
 5778 |                                 float* rwork, lapack_int lrwork);
      |                                  ~~~^
C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c:74:5: error: aggregate value used where an integer was expected
   74 |     lcwork = (lapack_int)cwork_query;
      |     ^ ~~~~~
C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c:95:64: warning: passing argument 21 of ‘LAPACKE_cgesvdq_work’ from incompatible pointer type [-Wincompatible-pointer-types]
   95 |                                  iwork, liwork, cwork, lcwork, rwork, lrwork );
      |                                                                ^ ~~~~
      |                                                                |
      |                                                                double *
In file included from C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/include/lapacke_utils.h:37,
                 from C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/src/lapacke_cgesvdq.c:34:
C:/msys64/home/Pedro/MINGW-packages/mingw-w64-lapack/src/lapack-3.9.0/LAPACKE/include/lapacke.h:5778:40: note: expected ‘float *’ but argument is of type ‘double *’
 5778 |                                 float* rwork, lapack_int lrwork);
      |                                  ~~~^
make[2]: *** [LAPACKE/CMakeFiles/lapacke.dir/build.make:17144: LAPACKE/CMakeFiles/lapacke.dir/src/lapacke_cgesvdq.c.obj] Error 1


PKGBUILD script

Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=lapack
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.9.0
pkgrel=1
arch=(‘any’)
pkgdesc=“Linear Algebra PACKage (mingw-w64)”
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" “${MINGW_PACKAGE_PREFIX}-gcc-libgfortran”)
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" “${MINGW_PACKAGE_PREFIX}-gcc-fortran”)
options=(‘strip’ ‘staticlibs’)
license=(‘LGPL’)
url=“https://www.netlib.org/lapack
source=(${_realname}-${pkgver}.tar.gz::https://github.com/Reference-LAPACK/lapack/archive/v${pkgver}.tar.gz)
sha256sums=(‘106087f1bb5f46afdfba7f569d0cbe23dacb9a07cd24733765a0e89dbe1ad573’)

build() {
declare -a _btype
if check_option “debug” “y”; then
_btype=Debug
else
_btype=Release
fi

cd “${srcdir}”
mkdir -p build-${CARCH} && cd build-${CARCH}
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_Fortran_COMPILER=${MINGW_PREFIX}/bin/gfortran.exe \
-DCMAKE_BUILD_TYPE=${_btype} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_NEED_RESPONSE=ON \
-DBUILD_TESTING=OFF \
-DLAPACKE_WITH_TMG=ON \
-DCBLAS=ON \
-DBUILD_DEPRECATED=ON \
…/${_realname}-${pkgver}
make

cd “${srcdir}”
mkdir -p build-${CARCH}s && cd build-${CARCH}s
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_Fortran_COMPILER=${MINGW_PREFIX}/bin/gfortran.exe \
-DCMAKE_BUILD_TYPE=${_btype} \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DLAPACKE_WITH_TMG=ON \
-DCBLAS=ON \
-DBUILD_DEPRECATED=ON \
…/${_realname}-${pkgver}
make
}

package() {
cd “${srcdir}/build-${CARCH}s”
make DESTDIR="${pkgdir}" install
cd “${srcdir}/build-${CARCH}”
make DESTDIR="${pkgdir}" install
}

I have EXACTLY the same problem. And I’m not sufficiently well versed to make the fix in #370 all by my self. Please help…