Skip to content

Commit 3fd20a9

Browse files
committed
python312Packages.pytorch: just disable -Werror; fix darwin x64 build
pytorch and many of the vendored libs build with -Werror and the derivation meticulously then disables any warning that results in a build failure. Just disable -Werror and fix the x64 darwin build.
1 parent e1b8fba commit 3fd20a9

File tree

1 file changed

+3
-51
lines changed

1 file changed

+3
-51
lines changed

pkgs/development/python-modules/torch/default.nix

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -454,59 +454,11 @@ buildPythonPackage rec {
454454

455455
env =
456456
{
457-
# Suppress a weird warning in mkl-dnn, part of ideep in pytorch
458-
# (upstream seems to have fixed this in the wrong place?)
459-
# https://github.com/intel/mkl-dnn/commit/8134d346cdb7fe1695a2aa55771071d455fae0bc
460-
# https://github.com/pytorch/pytorch/issues/22346
461-
#
457+
# disable warnings as errors as they break the build on every compiler
458+
# bump, among other things.
462459
# Also of interest: pytorch ignores CXXFLAGS uses CFLAGS for both C and C++:
463460
# https://github.com/pytorch/pytorch/blob/v1.11.0/setup.py#L17
464-
NIX_CFLAGS_COMPILE = toString (
465-
(
466-
lib.optionals (blas.implementation == "mkl") [ "-Wno-error=array-bounds" ]
467-
# Suppress gcc regression: avx512 math function raises uninitialized variable warning
468-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
469-
# See also: Fails to compile with GCC 12.1.0 https://github.com/pytorch/pytorch/issues/77939
470-
++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12.0.0") [
471-
"-Wno-error=maybe-uninitialized"
472-
"-Wno-error=uninitialized"
473-
]
474-
# Since pytorch 2.0:
475-
# gcc-12.2.0/include/c++/12.2.0/bits/new_allocator.h:158:33: error: ‘void operator delete(void*, std::size_t)’
476-
# ... called on pointer ‘<unknown>’ with nonzero offset [1, 9223372036854775800] [-Werror=free-nonheap-object]
477-
++ lib.optionals (stdenv.cc.isGNU && lib.versions.major stdenv.cc.version == "12") [
478-
"-Wno-error=free-nonheap-object"
479-
]
480-
# .../source/torch/csrc/autograd/generated/python_functions_0.cpp:85:3:
481-
# error: cast from ... to ... converts to incompatible function type [-Werror,-Wcast-function-type-strict]
482-
++ lib.optionals (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "16") [
483-
"-Wno-error=cast-function-type-strict"
484-
# Suppresses the most spammy warnings.
485-
# This is mainly to fix https://github.com/NixOS/nixpkgs/issues/266895.
486-
]
487-
++ lib.optionals rocmSupport [
488-
"-Wno-#warnings"
489-
"-Wno-cpp"
490-
"-Wno-unknown-warning-option"
491-
"-Wno-ignored-attributes"
492-
"-Wno-deprecated-declarations"
493-
"-Wno-defaulted-function-deleted"
494-
"-Wno-pass-failed"
495-
]
496-
++ [
497-
"-Wno-unused-command-line-argument"
498-
"-Wno-uninitialized"
499-
"-Wno-array-bounds"
500-
"-Wno-free-nonheap-object"
501-
"-Wno-unused-result"
502-
]
503-
++ lib.optionals stdenv.cc.isGNU [
504-
"-Wno-maybe-uninitialized"
505-
"-Wno-stringop-overflow"
506-
]
507-
)
508-
);
509-
461+
NIX_CFLAGS_COMPILE = "-Wno-error";
510462
USE_VULKAN = setBool vulkanSupport;
511463
}
512464
// lib.optionalAttrs vulkanSupport {

0 commit comments

Comments
 (0)