Bug 280715 - math/py-numpy: remove clang error condition in distutils check
Summary: math/py-numpy: remove clang error condition in distutils check
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-08-09 17:02 UTC by Dimitry Andric
Modified: 2024-08-15 12:08 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (python)


Attachments
math/py-numpy: remove clang error condition in distutils check (3.05 KB, patch)
2024-08-09 17:03 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2024-08-09 17:02:19 UTC
numpy has a C source file in their distutils checks, which is supposed
to check for AVX512FP16, but for apparently historical reasons, it has:

    /* clang has a bug regarding our spr coode, see gh-23730. */
    #if __clang__
    #error
    #endif

Since clang 19 now supports the -mavx512fp16 flag, other ports such as
science/py-scipy (which depend on numpy) then bomb out in their
configure scripts with:

    WARN: CCompilerOpt.dist_test[637] : CCompilerOpt._dist_test_spawn[771] : Command (cc -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -c /usr/local/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.c -o /tmp/tmp_dkw8pp0/usr/local/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.o -MMD -MF /tmp/tmp_dkw8pp0/usr/local/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.o.d -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f -mno-mmx -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512vnni -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq -mavx512fp16 -Werror) failed with exit status 1 output ->
    /usr/local/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.c:20:2: error:
       20 | #error
          |  ^
    1 error generated.

I have tried clang 15 through 19 on cpu_avx512_spr.c with the #error
removed, and none of them crashed or otherwise got an error. So I think
we should simply remove the whole #if / #endif part.

Also bump the portrevision, to force dependencies to configure against
the new cpu_avx512_spr.c file.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-08-09 17:03:42 UTC
Created attachment 252632 [details]
math/py-numpy: remove clang error condition in distutils check
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-08-15 11:56:53 UTC
A commit in branch main references this bug:

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

commit ba856133e5f1a18de13106955e417f998be213e5
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-15 09:47:25 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-08-15 11:53:55 +0000

    math/py-numpy: Remove clang error condition in distutils check

    - Bump PORTREVISION for package change

    PR:             280715
    Tested by:      dim (with Clang 15 to 19)

 math/py-numpy/Makefile                |  2 +-
 math/py-numpy/files/patch-clang (new) | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-08-15 12:08:46 UTC
Committed. Thanks!