-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
The compiler options are specified as three settings
numpy/numpy/distutils/ccompiler_opt.py
Lines 193 to 197 in 261a769
| clang = dict( | |
| native = '-march=native', | |
| opt = "-O3", | |
| werror = '-Werror' | |
| ), |
Those string values are then parsed
numpy/numpy/distutils/ccompiler_opt.py
Lines 985 to 998 in 261a769
| compiler_flags = self.conf_cc_flags.get(self.cc_name) | |
| if compiler_flags is None: | |
| self.dist_fatal( | |
| "undefined flag for compiler '%s', " | |
| "leave an empty dict instead" % self.cc_name | |
| ) | |
| for name, flags in compiler_flags.items(): | |
| self.cc_flags[name] = nflags = [] | |
| if flags: | |
| assert(isinstance(flags, str)) | |
| flags = flags.split() | |
| for f in flags: | |
| if self.cc_test_flags([f]): | |
| nflags.append(f) |
with the sneaky self.cc_test_flags check that removes flags that compiler doesn't accept.
In our particular case Nix/Nixpkgs we have large user base that are concerned with security and thus a -fno-strict-overflow flag is being added in a compiler wrapper. For reasons unknown (NixOS/nixpkgs#39687), this makes the check for -Werror flag support to wrongfully fail:
clang-7: error: argument unused during compilation: '-fno-strict-overflow' [-Werror,-Wunused-command-line-argument]
This results in -Werror flag being completely excluded in toolchain checks. In our recent update NixOS/nixpkgs#132754 we've noticed that it fails to correctly detect availability of certain AVX512 intrinsics:
/private/tmp/nix-build-python3.9-numpy-1.21.1.drv-1/numpy-1.21.1/numpy/distutils/checks/extra_avx512bw_mask.c:12:11: error: implicit declaration of function '_kor_mask64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
m64 = _kor_mask64(m64, m64);
^
Reproducing code example:
TBD. Let me know if the description above is insufficient.
Error message:
Original error was: dlopen(/nix/store/qhx0vgkjswsgp6gwn773mk0figasackk-python3.9-numpy-1.21.1/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so, 2): Symbol not found: __cvtmask32_u32
Referenced from: /nix/store/qhx0vgkjswsgp6gwn773mk0figasackk-python3.9-numpy-1.21.1/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so
Expected in: flat namespace
in /nix/store/qhx0vgkjswsgp6gwn773mk0figasackk-python3.9-numpy-1.21.1/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so
NumPy/Python version information:
numpy 1.21.1