Source: pytorch
Version: 2.5.1+dfsg-1
Severity: important
Tags: ftbfs patch

Dear Maintainer,

pytorch fails to build from source with Make 4.4.1 because of changes
in $(shell) handling. The attached patch fixes this by avoiding the
use of $(shell) when calculating flags.

Make 4.4.1 is currently available in experimental and will hopefully
soon be uploaded to unstable, at which time this bug will become
critical.

The attached patch is also included in a merge request which addresses
other issues in debian/rules too,
https://salsa.debian.org/deeplearning-team/pytorch/-/merge_requests/4

Regards,
diff --git a/debian/rules b/debian/rules
index b6a9f7af..d48e3fbd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,6 +9,11 @@ export PYTORCH_VERSION = $(shell echo 
"$(DEB_VERSION_UPSTREAM)" | sed -e 's/+dfs
 export SOVERSION = 2.5
 export PATCH = 1
 
+include /usr/share/dpkg/buildflags.mk
+ORIG_CFLAGS := $(CFLAGS)
+ORIG_CPPFLAGS := $(CPPFLAGS)
+ORIG_CXXFLAGS := $(CXXFLAGS)
+
 # --[[ maintainer notes ]]--
 # How to dump the flags for the upstream built instance:
 # $ python3 -c 'import torch as th; print(th.__version__, 
th.__config__.show())'
@@ -35,12 +40,12 @@ export LD=ld
 export __LD=
 endif
 endif
-export CFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) \
-                $(shell dpkg-buildflags --get CFLAGS) \
-                -gsplit-dwarf $(_WNOERROR_) $(__LD) -I/usr
-export CXXFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) \
-                  $(shell dpkg-buildflags --get CXXFLAGS) \
-                  -gsplit-dwarf $(_WNOERROR_) $(__LD) -I/usr
+export CFLAGS := $(ORIG_CPPFLAGS) \
+                 $(ORIG_CFLAGS) \
+                 -gsplit-dwarf $(_WNOERROR_) $(__LD) -I/usr
+export CXXFLAGS := $(ORIG_CPPFLAGS) \
+                   $(ORIG_CXXFLAGS) \
+                   -gsplit-dwarf $(_WNOERROR_) $(__LD) -I/usr
 export ONNX_NAMESPACE = onnx
 export REL_WITH_DEB_INFO = ON
 export USE_GFLAGS= OFF
@@ -150,8 +155,8 @@ endif
 # Customization options (You may want to rebuild this package locally)
 NATIVE :=
 ifneq (,$(NATIVE))
-export CFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) $(shell 
dpkg-buildflags --get CFLAGS) -gsplit-dwarf -march=native
-export CXXFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) $(shell 
dpkg-buildflags --get CXXFLAGS) -gsplit-dwarf -march=native
+export CFLAGS := $(ORIG_CPPFLAGS) $(ORIG_CFLAGS) -gsplit-dwarf -march=native
+export CXXFLAGS := $(ORIG_CPPFLAGS) $(ORIG_CXXFLAGS) -gsplit-dwarf 
-march=native
 endif
 
 

Reply via email to