Bug 284425 - math/openblas: 0.3.29 fails to build at phase: stage
Summary: math/openblas: 0.3.29 fails to build at phase: stage
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Vladimir Druzenko
URL:
Keywords:
: 284479 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-01-28 19:33 UTC by lysfjord.daniel
Modified: 2025-02-22 00:48 UTC (History)
19 users (show)

See Also:
vvd: maintainer-feedback+
antoine: exp-run+


Attachments
poudriere build log for 0.3.29,2 (255.34 KB, application/gzip)
2025-01-28 22:04 UTC, lysfjord.daniel
no flags Details
poudriere buildlog crashing on build (before stage), compressed (227.93 KB, application/x-xz-compressed-tar)
2025-01-29 15:51 UTC, Tomoaki AOKI
no flags Details
Fix install when DYNAMIC_ARCH is deselected (1.03 KB, patch)
2025-01-29 17:55 UTC, Thierry Thomas
phd_kimberlite: maintainer-approval-
Details | Diff
Real update to 0.3.29 + fix install when DYNAMIC_ARCH is deselected (2.84 KB, patch)
2025-01-30 14:38 UTC, Vladimir Druzenko
vvd: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lysfjord.daniel 2025-01-28 19:33:24 UTC
After update from 0.3.27 to 0.3.29, openblas fails to stage with the following error:

=======================<phase: stage          >============================
===== env: NO_DEPENDS=yes USER=root UID=0 GID=0
===>  Staging for openblas-0.3.29,2
===>   Generating temporary packing list
In file included from getarch.c:1799:
./cpuid_x86.c:2233:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2233 |           else
      |           ^
./cpuid_x86.c:2248:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2248 |           else
      |           ^
./cpuid_x86.c:2265:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2265 |           else
      |           ^
3 warnings generated.
/usr/local/bin/gmake -f Makefile.install install
gmake[1]: Entering directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
Generating openblas_config.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating f77blas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating cblas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying LAPACKE header files to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying the static library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
Copying the shared library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
PKGFILE="/wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig/openblas.pc"
Generating openblas.pc in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig
Generating OpenBLASConfig.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Install OK!
gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
/usr/bin/strip /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so
strip: open /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so failed: No such file or directory
*** Error code 1

Replacing the newly added lib/libopenblas_*p-${PORTVERSION:C/9/7} during post-install-DYNAMIC-ARCH-off with lib/libopenblas_* makes the whole thing build just fine. It's probably not the best idea?
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2025-01-28 20:27:55 UTC
This is strange, an exp-run ran successfully with this update.

Could you please provide more details ? (arch, option, FreeBSD release, etc.)
Comment 2 lysfjord.daniel 2025-01-28 22:04:32 UTC
Created attachment 257079 [details]
poudriere build log for 0.3.29,2

gzipped, original log was 7MB
Comment 3 lysfjord.daniel 2025-01-28 22:06:38 UTC
(In reply to Thierry Thomas from comment #1)

arch: amd64
options: (last changed 2024-08-08)
cat /usr/local/etc/poudriere.d/default-options/math_openblas/options 
# This file is auto-generated by 'make config'.
# Options for openblas-0.3.27,2
_OPTIONS_READ=openblas-0.3.27,2
_FILE_COMPLETE_OPTIONS_LIST=AVX AVX2 AVX512 DYNAMIC_ARCH INTERFACE64 OPENMP
OPTIONS_FILE_UNSET+=AVX
OPTIONS_FILE_UNSET+=AVX2
OPTIONS_FILE_UNSET+=AVX512
OPTIONS_FILE_UNSET+=DYNAMIC_ARCH
OPTIONS_FILE_UNSET+=INTERFACE64
OPTIONS_FILE_SET+=OPENMP

FreeBSD release: 14.2-RELEASE
Comment 4 lysfjord.daniel 2025-01-28 22:18:24 UTC
(In reply to Thierry Thomas from comment #1)

I did a rebuild in an interactive poudriere jail:


 OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE)

  OS               ... FreeBSD             
  Architecture     ... x86_64               
  BINARY           ... 64bit                 
  C compiler       ... CLANG  (cmd & version : FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67))
  Fortran compiler ... GFORTRAN  (cmd & version : GNU Fortran (FreeBSD Ports Collection) 13.3.0)
  Library Name     ... libopenblas_nehalemp-r0.3.27.a (Multi-threading; Max num-threads is 64)

 Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags, 
 you should use OMP_NUM_THREADS environment variable to control the number of threads.


To install the library, you can run "make PREFIX=/path/to/your/installation install".

Note that any flags passed to make during build should also be passed to make install
to circumvent any install errors.

===>  Staging for openblas-0.3.29,2
===>   openblas-0.3.29,2 depends on executable: gfortran13 - found
===>   Generating temporary packing list
In file included from getarch.c:1799:
./cpuid_x86.c:2233:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2233 |           else
      |           ^
./cpuid_x86.c:2248:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2248 |           else
      |           ^
./cpuid_x86.c:2265:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
 2265 |           else
      |           ^
3 warnings generated.
/usr/local/bin/gmake -f Makefile.install install
gmake[1]: Entering directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
Generating openblas_config.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating f77blas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating cblas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying LAPACKE header files to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying the static library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
Copying the shared library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
PKGFILE="/wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig/openblas.pc"
Generating openblas.pc in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig
Generating OpenBLASConfig.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Install OK!
gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
/usr/bin/strip /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so
strip: open /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so failed: No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/ports/math/openblas
root@default-default:/usr/ports/math/openblas # ls -alh /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/
total 44013
drwxr-xr-x   5 root wheel  512B Jan 28 22:17 .
drwxr-xr-x  12 root wheel  640B Jan 28 22:17 ..
drwxr-xr-x   3 root wheel   64B Jan 28 22:17 X11
drwxr-xr-x   3 root wheel   64B Jan 28 22:17 cmake
drwxr-xr-x   2 root wheel    0B Jan 28 22:17 debug
lrwxr-xr-x   1 root wheel   30B Jan 28 22:17 libopenblas.a -> libopenblas_nehalemp-r0.3.27.a
lrwxr-xr-x   1 root wheel   31B Jan 28 22:17 libopenblas.so -> libopenblas_nehalemp-r0.3.27.so
lrwxr-xr-x   1 root wheel   31B Jan 28 22:17 libopenblas.so.0 -> libopenblas_nehalemp-r0.3.27.so
-rw-r--r--   1 root wheel   29M Jan 28 22:17 libopenblas_nehalemp-r0.3.27.a
-rwxr-xr-x   1 root wheel   14M Jan 28 22:17 libopenblas_nehalemp-r0.3.27.so
Comment 5 lysfjord.daniel 2025-01-28 22:21:49 UTC
I'm afraid the line in the Makefile:

post-install:
        ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libopenblasp-r${PORTVERSION:C/9/7/}.so


does not match any of the files in that directory.

libopenblas_*p-r${PORTVERSION:C/9/7} might, on the other hand..
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-28 23:48:38 UTC
Almost same here:
/usr/bin/strip /tmp/work/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so
strip: open /tmp/work/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so failed: No such file or directory
*** Error code 1

$ ls -l /tmp/work/usr/ports/math/openblas/work/stage/usr/local/lib/
total 44332
drwxr-xr-x  3 root wheel      512 Jan 29 02:26 X11
drwxr-xr-x  3 root wheel      512 Jan 29 02:26 cmake
drwxr-xr-x  2 root wheel      512 Jan 29 02:26 debug
lrwxr-xr-x  1 root wheel       28 Jan 29 02:26 libopenblas.a -> libopenblas_core2p-r0.3.27.a
lrwxr-xr-x  1 root wheel       29 Jan 29 02:26 libopenblas.so -> libopenblas_core2p-r0.3.27.so
lrwxr-xr-x  1 root wheel       29 Jan 29 02:26 libopenblas.so.0 -> libopenblas_core2p-r0.3.27.so
-rw-r--r--  1 root wheel 30579228 Jan 29 02:26 libopenblas_core2p-r0.3.27.a
-rwxr-xr-x  1 root wheel 14707584 Jan 29 02:26 libopenblas_core2p-r0.3.27.so

$ grep ^CPUTYPE /etc/make.conf
CPUTYPE?=core2
Comment 7 robbak 2025-01-29 12:56:27 UTC
The fault happens when DYNAMIC_ARCH is enabled, which is disabled by default in a ports build. The name of the CPU family is added to the library file name, so the strip command can't find the file.

Adding the DYNAMIC_ARCH build option, as would probably have been done in an exp-run, allows the port to stage and install.
Comment 8 david 2025-01-29 13:36:00 UTC
I confirm that setting:

DYNAMIC_ARCH=on

allows the port to build & install.

This was on a couple of systems running stable/14-n270249-2239ae77990d (amd64), with the ports tree at main-n693521-cf583eb49fea.
Comment 9 Frank Reisert 2025-01-29 13:53:43 UTC
(In reply to robbak from comment #7)

Here strip fails with DYNAMIC_ARCH disabled.  At least for me the failure hast nothing to do with that option.

OPTIONS_FILE_UNSET+=DYNAMIC_ARCH

but build via poudriere fails:

===========================================================================
=======================<phase: run-depends    >============================
===== env: USE_PACKAGE_DEPENDS_ONLY=1 USER=root UID=0 GID=0
===>   openblas-0.3.29,2 depends on executable: gfortran13 - found
===========================================================================
=======================<phase: stage          >============================
===== env: NO_DEPENDS=yes USER=root UID=0 GID=0
===>  Staging for openblas-0.3.29,2
===>   Generating temporary packing list
/usr/local/bin/gmake -f Makefile.install install
gmake[1]: Entering directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
Generating openblas_config.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating f77blas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Generating cblas.h in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying LAPACKE header files to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/include
Copying the static library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
Copying the shared library to /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib
PKGFILE="/wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig/openblas.pc"
Generating openblas.pc in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig
Generating OpenBLASConfig.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Install OK!
gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
/usr/bin/strip /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so
strip: open /wrkdirs/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so failed: No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/ports/math/openblas
=>> Cleaning up wrkdir
===>  Cleaning for openblas-0.3.29,2
build of math/openblas | openblas-0.3.29,2 ended at Wed Jan 29 14:38:48 CET 2025
build time: 00:10:29
!!! build failure encountered !!!
Comment 10 Frank Reisert 2025-01-29 15:44:14 UTC
My apologies.  I've got a bit confused.

I found:

OPTIONS_FILE_UNSET+=DYNAMIC_ARCH (as I understand DYNAMIC_ARCH off/disabled) build fails

OPTIONS_FILE_SET+=DYNAMIC_ARCH (DYNAMIC_ARCH on/enabled) build succeeds
Comment 11 Tomoaki AOKI 2025-01-29 15:51:07 UTC
Created attachment 257089 [details]
poudriere buildlog crashing on build (before stage), compressed

For me, fails on build (crash) before reaching stage as in attached build log.
Would be gfortran (gcc13) problem, but not sure.
Comment 12 Thierry Thomas freebsd_committer freebsd_triage 2025-01-29 17:55:23 UTC
Created attachment 257095 [details]
Fix install when DYNAMIC_ARCH is deselected

The attached patch fixes install when DYNAMIC_ARCH is deselected.
Comment 13 Thierry Thomas freebsd_committer freebsd_triage 2025-01-29 17:57:30 UTC
(In reply to Tomoaki AOKI from comment #11)
Indeed this looks like a problem with GCC, but I Haven't be able to reproduce it.

Can you build other ports using Fortran, like e.g. math/lapack ?
Comment 14 Ivan Rozhuk 2025-01-29 18:36:42 UTC
+1


/usr/local/bin/gmake -f Makefile.install install
gmake[1]: Entering directory '/tmp/ports/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
Generating openblas_config.h in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/include
Generating f77blas.h in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/include
Generating cblas.h in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/include
Copying LAPACKE header files to /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/include
Copying the static library to /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib
Copying the shared library to /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib
SUFFIX64=64
PKGFILE="/tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig/openblas64.pc"
Generating openblas64.pc in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/pkgconfig
Generating OpenBLASConfig.cmake in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/cmake/openblas
Install OK!
gmake[1]: Leaving directory '/tmp/ports/usr/ports/math/openblas/work/OpenBLAS-ce3f668'
/usr/bin/strip /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so
strip: open /tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.27.so failed: No such file or directory
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/math/openblas
*** Error code 1

...

    
# find /tmp/ports/usr/ports/ -name 'libopenblasp*.so*'
# find /tmp/ports/usr/ports/ -name 'libopenblasp*.*'
# find /tmp/ports/usr/ports/ -name '*.so*'
/tmp/ports/usr/ports/math/openblas/work/OpenBLAS-ce3f668/libopenblas.so.0
/tmp/ports/usr/ports/math/openblas/work/OpenBLAS-ce3f668/libopenblas_zenp-r0.3.27.so
/tmp/ports/usr/ports/math/openblas/work/OpenBLAS-ce3f668/libopenblas.so
/tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.so.0
/tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas_zenp-r0.3.27.so
/tmp/ports/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.so



libopenblasp-r0.3.27.so != libopenblas_zenp-r0.3.27.so
and != libopenblas_nehalemp-r0.3.27.so (from this topic)

zen, nehalem - is CPU SUB ARCH.
My system run on AMD Ryzen.
Comment 15 lysfjord.daniel 2025-01-29 19:16:52 UTC
Would it not be easier to utilize the symlinks created during the build (resolve them and look at the file it's pointing to, if so be?), instead of all this pattern matching depending on options?
Comment 16 Thierry Thomas freebsd_committer freebsd_triage 2025-01-29 19:18:07 UTC
(In reply to Ivan Rozhuk from comment #14)
With or without the proposed patch?
Comment 17 Ivan Rozhuk 2025-01-29 21:25:52 UTC
(In reply to Thierry Thomas from comment #16)

Fail without patch.
Ok with patch.
Thanks!
Comment 18 Tomoaki AOKI 2025-01-29 21:52:01 UTC
(In reply to Thierry Thomas from comment #13)
Tried building math/lapack with `make` there (bare-metal, not with poudriere).
Succeeded. Last part of the build messages are:

-- Set non-toolchain portion of runtime path of "/usr/ports/math/lapack/work/stage/usr/local/lib/libtmglib.so.3.12.0" to "/usr/local/lib"
-- Installing: /usr/ports/math/lapack/work/stage/usr/local/lib/libtmglib.so
install  -m 0644 /usr/ports/math/lapack/work/.build/SRC/liblapack.a /usr/ports/math/lapack/work/stage/usr/local/lib
install  -m 0644 /usr/ports/math/lapack/work/.build/TESTING/MATGEN/libtmglib.a /usr/ports/math/lapack/work/stage/usr/local/lib
====> Compressing man pages (compress-man)
Comment 19 Tomoaki AOKI 2025-01-29 21:55:45 UTC
(In reply to Thierry Thomas from comment #13)
And the bare-metal `make` for math/openblas failed as below:

gfortran13 -O -Wl,-rpath=/usr/local/lib/gcc13 -O2 -m128bit-long-double -Wall -frecursive -fno-optimize-sibling-calls -m64 -fopenmp  -O2 -m128bit-long-double -Wall -frecursive -fno-optimize-sibling-calls -m64 -fopenmp  -fno-tree-vectorize  -Wl,-rpath=/usr/local/lib/gcc13  -L/usr/local/lib/gcc13 -fstack-protector-strong  -o zblat3_3m zblat3_3m.o ../libopenblasp-r0.3.27.a -lpthread -lgfortran -lpthread -lgfortran -L/usr/lib -L/usr/lib  -lc  -lomp
rm -f ?BLAT2.SUMM
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat2 < ./sblat2.dat
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./dblat2 < ./dblat2.dat
rm -f ?BLAT3.SUMM
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat3 < ./sblat3.dat
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./cblat2 < ./cblat2.dat
Note: The following floating-point exceptions are signalling: IEEE_DIVIDE_BY_ZERO
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./dblat3 < ./dblat3.dat
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./cblat3 < ./cblat3.dat
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./zblat2 < ./zblat2.dat
OMP_NUM_THREADS=1 OMP_NUM_THREADS=1 ./zblat3 < ./zblat3.dat
rm -f ?BLAT3.SUMM
rm -f ?BLAT2.SUMM
OMP_NUM_THREADS=2 ./sblat3 < ./sblat3.dat
OMP_NUM_THREADS=2 ./sblat2 < ./sblat2.dat
Note: The following floating-point exceptions are signalling: IEEE_DIVIDE_BY_ZERO
OMP_NUM_THREADS=2 ./dblat3 < ./dblat3.dat
OMP_NUM_THREADS=2 ./cblat3 < ./cblat3.dat

Program received signal SIGBUS: Access to an undefined portion of a memory object.

Backtrace for this error:
#0  0x826c20299 in ???
#1  0x826c1f3c5 in ???
#2  0x822c470e5 in ???
#3  0x822c465e9 in ???
#4  0x8221362d2 in ???
#5  0x829aac1c6 in _Unwind_ForcedUnwind
	at /wrkdirs/usr/ports/lang/gcc13/work/gcc-13.3.0/libgcc/unwind.inc:215
#6  0x822c3e011 in ???
#7  0x822c3df81 in ???
#8  0x822c3de2a in ???
#9  0x822c3d915 in ???
#10  0xffffffffffffffff in ???
gmake[1]: *** [Makefile:117: level2] Bus error (core dumped)
gmake[1]: *** Waiting for unfinished jobs....

Program received signal SIGBUS: Access to an undefined portion of a memory object.

Backtrace for this error:
#0  0x826420299 in ???
#1  0x82641f3c5 in ???
#2  0x8233520e5 in ???
#3  0x8233515e9 in ???
#4  0x822f0f2d2 in ???
#5  0x82fbd61c6 in _Unwind_ForcedUnwind
	at /wrkdirs/usr/ports/lang/gcc13/work/gcc-13.3.0/libgcc/unwind.inc:215
#6  0x823349011 in ???
#7  0x823348f81 in ???
#8  0x823348e2a in ???
#9  0x823348915 in ???
#10  0xffffffffffffffff in ???
gmake[1]: *** [Makefile:207: level3] Bus error (core dumped)
gmake[1]: Leaving directory '/usr/ports/math/openblas/work/OpenBLAS-ce3f668/test'
gmake: *** [Makefile:167: tests] Error 2
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/math/openblas
*** Error code 1

Stop.
make: stopped in /usr/ports/math/openblas
Comment 20 Eijiro Shibusawa 2025-01-30 11:09:15 UTC
Comment on attachment 257095 [details]
Fix install when DYNAMIC_ARCH is deselected

The patched port passed poudriere test in the case of DYNAMIC_ARCH=off and TARGET_CPU_ARCH=HASWELL.
Comment 21 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-30 14:38:27 UTC
Created attachment 257123 [details]
Real update to 0.3.29 + fix install when DYNAMIC_ARCH is deselected

Reported by arrowd via email.
Comment 22 Thierry Thomas freebsd_committer freebsd_triage 2025-01-30 17:36:01 UTC
(In reply to Vladimir Druzenko from comment #21)
Thanks, ans sorry for this mistake!
Comment 23 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-30 17:53:36 UTC
Do we need exp-run and bump PORTREVISION of consumers again?
Comment 24 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-31 14:37:10 UTC
*** Bug 284479 has been marked as a duplicate of this bug. ***
Comment 25 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-31 14:41:57 UTC
Due to real update to 0.3.29 asking for an exp-run please.
Patch: https://bugs.freebsd.org/bugzilla/attachment.cgi?id=257123
Comment 26 Antoine Brodin freebsd_committer freebsd_triage 2025-01-31 14:55:36 UTC
There was an exp-run already in bug #284314

Why do you want a new one?  do you expect new failures??
Comment 27 Vladimir Druzenko freebsd_committer freebsd_triage 2025-01-31 15:18:52 UTC
(In reply to Antoine Brodin from comment #26)
It was not real 0.3.29 - it was 0.3.27.
Check comments here (https://bugs.freebsd.org/284425#c21) and https://bugs.freebsd.org/284314#c6
Comment 28 Eijiro Shibusawa 2025-02-01 03:10:51 UTC
Comment on attachment 257123 [details]
Real update to 0.3.29 + fix install when DYNAMIC_ARCH is deselected

The patched port passed poudriere.
I verified that extracted Changelog.txt is indeed version 0.3.29.
Comment 29 Xavier Humbert 2025-02-01 12:31:37 UTC
Confrimed here. Checking the config box DYNAMIC_ARCH fixes the problem
Xavier
Comment 30 Antoine Brodin freebsd_committer freebsd_triage 2025-02-03 13:50:18 UTC
Exp-run looks fine
Comment 31 Vladimir Druzenko freebsd_committer freebsd_triage 2025-02-03 18:44:25 UTC
(In reply to Antoine Brodin from comment #30)
Thanks!
Comment 32 commit-hook freebsd_committer freebsd_triage 2025-02-03 18:44:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2808d8f48ce30875954ec98a4cf2d450bdbbc371

commit 2808d8f48ce30875954ec98a4cf2d450bdbbc371
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-02-03 18:37:52 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-02-03 18:43:45 +0000

    math/openblas: Real update 0.3.27 → 0.3.29, fix stage with DYNAMIC_ARCH off

    Changelogs:
    https://github.com/OpenMathLib/OpenBLAS/releases/tag/v0.3.28
    https://github.com/OpenMathLib/OpenBLAS/releases/tag/v0.3.29

    PR:             284425 284314
    Approved by:    Eijiro Shibusawa <phd_kimberlite@yahoo.co.jp> (maintainer)
    Fixes:          89303ca180e0 (upgrade to v0.3.29)

 math/openblas/Makefile                   | 11 ++++++-----
 math/openblas/distinfo                   |  6 +++---
 math/openblas/files/patch-param.h (gone) | 11 -----------
 3 files changed, 9 insertions(+), 19 deletions(-)
Comment 33 Vladimir Druzenko freebsd_committer freebsd_triage 2025-02-03 18:46:28 UTC
Do we really need a bump of all consumers?
Comment 34 Tomoaki AOKI 2025-02-07 14:55:59 UTC
It turned out that my build failure doesn't happen if I set USE_GCC= 12 in /etc/make.conf as below. Both on bare-metal make and poudriere.
So the problem is specific with gcc13/gfortran13.
The built package runs sanely with its consumers or not is the next step.
But poudriere build including this is just ongoing (openblas is just finished sanely), so need a fair amount of time to finish.

.if ${.CURDIR:M/usr/ports/math/openblas}
  USE_GCC=	12
.endif
Comment 35 Oleg Sidorkin 2025-02-07 19:17:37 UTC
(In reply to Tomoaki AOKI from comment #34)

gcc14 triggers the problem also
Comment 36 Tomoaki AOKI 2025-02-08 04:33:51 UTC
(In reply to Tomoaki AOKI from comment #34)
Determined actual leaf ports (non meta port) depending on using ports-mgmt/pkg_tree, try starting up gimp, kdenlive went fine. At least didn't crash on startup.

xsane crashed but in epsonscan2 part which does not depend on openblas.
Starting up epsonscan2 (not depending on openblas) directly caused crash with SiGILL, so maybe openblas built with gcc12/gfortran12 seems to be fine.
Comment 37 Tomoaki AOKI 2025-02-08 04:35:15 UTC
(In reply to Oleg Sidorkin from comment #35)
So something changed on updates from gcc12 to gcc13 and carried over to gcc14 has problem?
Comment 38 Thierry Thomas freebsd_committer freebsd_triage 2025-02-08 09:15:34 UTC
GCC 13 has been the default in FreeBSD ports for some time, and I don't think that gcc13 and gfortran13 are the unique culprit of these errors: openblas builds fine on the packages cluster, and so does it in my poudriere and many others.

I guess that the cause might be GCC 13 (because you don't see the error with 12), but associated with an other yet unknown cause.
Comment 39 Oleg Sidorkin 2025-02-08 09:25:51 UTC
(In reply to Thierry Thomas from comment #38)

I've tried different buildflags combinations with the same result (GCC12 works, GCC13+ doesn't). I'm using AMD 7800 CPU
Comment 40 Tomoaki AOKI 2025-02-09 08:45:50 UTC
(In reply to Tomoaki AOKI from comment #36)
Upgrading graphics/epsonscan2 and graphics/epsonscan2-non-free-plugin with latest 2 patches at Bug284127 resolved graphics/xsane crash.
Currently math/openblas built with gcc12/gfortran12 seems to be fine.

Build options for math/openblas (currently):
# This file is auto-generated by 'make config'.
# Options for openblas-0.3.29_1,2
_OPTIONS_READ=openblas-0.3.29_1,2
_FILE_COMPLETE_OPTIONS_LIST=AVX AVX2 AVX512 DYNAMIC_ARCH INTERFACE64 OPENMP
OPTIONS_FILE_UNSET+=AVX
OPTIONS_FILE_UNSET+=AVX2
OPTIONS_FILE_UNSET+=AVX512
OPTIONS_FILE_SET+=DYNAMIC_ARCH
OPTIONS_FILE_UNSET+=INTERFACE64
OPTIONS_FILE_SET+=OPENMP

Options tested with gcc13/gfortran13 (all without luck)
  *AVX512 is always off
    (my CPU Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz does not support it)
  *AVX and AVX2 are always set the same (both on or both off).
  *With above restriction, all combinations are tested,

Knowing it's nonsense, all AVX, AVX2 and DYNAMIC_ARCH on and off are tested.
Comment 41 Oleg Sidorkin 2025-02-09 12:23:13 UTC
1) I setup a RELENG-14.2 VM on Intel (Ice Lake) machine, and tried to build there (all AVX, openMP, no dynamic arch). It works

2) I brought cblat3 binary that failed on AMD machine and run it on Intel VM. It also worked.
Comment 42 Oleg Sidorkin 2025-02-11 22:09:33 UTC
Looks like unaligned memory access:

Core was generated by `./sblat2'.
Program terminated with signal SIGBUS, Bus error.
Sent by thr_kill() from pid 61194 and user 0.
#0  0x000000082dda6585 in _Unwind_ForcedUnwind (exc=0x6e1ecc45a48, stop=0x821866410 <thread_unwind_stop>, stop_argument=0x0) at ./libgcc/unwind.inc:215
....
(gdb) p *exc
$1 = {exception_class = 0, exception_cleanup = 0x8218663f0 <thread_unwind_cleanup>, private_1 = 0, private_2 = 0}
(gdb) p &exc->private_1
$2 = (_Unwind_Word *) 0x6e1ecc45a58
(gdb) disassemble /m _Unwind_ForcedUnwind
Dump of assembler code for function _Unwind_ForcedUnwind:
207     in ./libgcc/unwind.inc
....

212     in ./libgcc/unwind.inc
   0x000000082dda6532 <+18>:    lea    -0x220(%rbp),%r13
   0x000000082dda6546 <+38>:    mov    0x8(%rbp),%rdx
   0x000000082dda654a <+42>:    lea    0x10(%rbp),%rsi
   0x000000082dda654e <+46>:    mov    %r13,%rdi
   0x000000082dda6558 <+56>:    call   0x82dda5d10 <uw_init_context_1>

213     in ./libgcc/unwind.inc
--Type <RET> for more, q to quit, c to continue without paging--
   0x000000082dda6551 <+49>:    lea    -0x130(%rbp),%r14
   0x000000082dda655d <+61>:    mov    $0xf0,%edx
   0x000000082dda6562 <+66>:    mov    %r13,%rsi
   0x000000082dda6565 <+69>:    mov    %r14,%rdi
   0x000000082dda6568 <+72>:    call   0x82dd929a0 <memcpy@plt>

214     in ./libgcc/unwind.inc
215     in ./libgcc/unwind.inc
   0x000000082dda656d <+77>:    vmovq  %rbx,%xmm1
   0x000000082dda657c <+92>:    vpinsrq $0x1,%r15,%xmm1,%xmm0
=> 0x000000082dda6585 <+101>:   vmovdqa %xmm0,0x10(%r12)

216     in ./libgcc/unwind.inc
.....
Comment 43 Oleg Sidorkin 2025-02-12 22:11:31 UTC
With the following patch to libgcc/unwind.inc of gcc14:

-  exc->private_1 = (_Unwind_Ptr) stop;
-  exc->private_2 = (_Unwind_Ptr) stop_argument;
+  __builtin_memcpy(&exc->private_1, &stop, sizeof(_Unwind_Ptr));
+  __builtin_memcpy(&exc->private_2, &stop_argument, sizeof(_Unwind_Ptr));

and rebuilding gcc14 tests do work.

Maybe it's time to file as a separate bug report for lang/gcc14.
Comment 44 Tomoaki AOKI 2025-02-12 23:17:48 UTC
(In reply to Oleg Sidorkin from comment #43)
Thanks!

It is applicable to lang/gcc13 with

===== Quote =====
--- libgcc/unwind.inc.orig
+++ libgcc/unwind.inc
@@ -212,8 +212,8 @@
   uw_init_context (&this_context);
   cur_context = this_context;
 
-  exc->private_1 = (_Unwind_Ptr) stop;
-  exc->private_2 = (_Unwind_Ptr) stop_argument;
+  __builtin_memcpy(&exc->private_1, &stop, sizeof(_Unwind_Ptr));
+  __builtin_memcpy(&exc->private_2, &stop_argument, sizeof(_Unwind_Ptr));
 
   code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context, &frames);
   if (code != _URC_INSTALL_CONTEXT)
===== End quote =====

as lang/gcc13/files/patch-libgcc-unwind.inc.

Now rebuilding lang/gcc13 with it and once finished, I'll try building math/openblas and report back.
Comment 45 Tomoaki AOKI 2025-02-13 08:58:11 UTC
(In reply to Tomoaki AOKI from comment #44)
The issue is fixed using lang/gcc13 with the patch applied.
As the patch is not only for lang/gcc14, if you file a dedicated PR for it, it should be "for lang/gcc13 and later".

Thanks again, Oleg!