OpenMathLib/OpenBLAS

Cross build fails for mingw haswell

Closed this issue · 3 comments

aont commented

Issue

I wanted to build a binary for Windows Haswell.

As a cross build host, I used Ubuntu 24.04 LTS with gcc-mingw-w64-x86-64-posix and gcc-mingw-w64-x86-64-posix installed .

The build command I used is make CC=x86_64-w64-mingw32-gcc-posix HOSTCC=gcc TARGET=HASWELL FC=x86_64-w64-mingw32-gfortran-posix CROSS=1 libs netlib

One of the error messages is

/usr/lib/gcc/x86_64-w64-mingw32/13-posix/include/avxintrin.h: In function ‘v_sum_f32’:
/usr/lib/gcc/x86_64-w64-mingw32/13-posix/include/avxintrin.h:524:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_extractf128_ps’: target specific option mismatch
  524 | _mm256_extractf128_ps (__m256 __X, const int __N)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from ../kernel/x86_64/../arm/../simd/intrin.h:63,
                 from ../kernel/x86_64/../arm/sum.c:33:
../kernel/x86_64/../arm/../simd/intrin_avx.h:46:17: note: called from here
   46 |     __m128 hi = _mm256_extractf128_ps(sum_halves, 1);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The entire build log is attached.
openblas_make_log.txt

Same issue occurs with gcc-mingw-w64-x86-64-win32.

If TARGET=SANDYBRIDGE or TARGET=SKYLAKEX is specified, binary is build without error and I found dgemm.goto runs without error.

Environment

build machine's CPU: INTEL(R) XEON(R) PLATINUM 8562Y+

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
$ x86_64-w64-mingw32-gcc-posix -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc-posix
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/13-posix/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --with-headers --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto --enable-threads=posix --program-suffix=-posix --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic --enable-libstdcxx-filesystem-ts=yes --enable-dependency-tracking SED=/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13-posix (GCC)
$ x86_64-w64-mingw32-gfortran-posix -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gfortran-posix
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/13-posix/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --with-headers --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto --enable-threads=posix --program-suffix=-posix --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic --enable-libstdcxx-filesystem-ts=yes --enable-dependency-tracking SED=/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13-posix (GCC)

From the NO_AVX2=1 in your build log, it looks as if the c_check script has somehow decided that your (cross-)compiler is too old to support AVX2. (That version check is supposed to trigger for gcc versions earlier than 4.6). Can you please post the output of x86_64-w64-mingw32-gcc-posix -dumpversion ? (You should get it to build by changing lines 363,364 of c_check from no_avx2=1, oldgcc=1 to no_avx2=0 and oldgcc=0)

aont commented

@martin-frbg
Thanks for the quick reply.

$ x86_64-w64-mingw32-gcc-posix -dumpversion
13-posix

$ x86_64-w64-mingw32-gcc-win32 -dumpversion
13-win32

I forgot to write OpenBLAS version. I used v0.3.27.
By changing lines of c_check (though the line number is different), binary is built and dgemm.goto runs without error!

I also confirmed with 886acfc .

Thanks, somewhat unfair that whoever packaged that mingw-gcc would use this non-numeric format (and somewhat naive of my script to expect it to be either a single number or a dotted "major.minor version).