py-tensorflow: patch for v2.15 build errors (#49001)

* py-tensorflow: patch for v2.15 build errors with new compilers

* py-tensorflow: patch for v2.15 build errors with new compilers

* py-tensorflow: fix clang build and add clang version constraints

* py-tensorflow: use compiler wrapper

* py-tensorflow: relax clang conflict
This commit is contained in:
Buldram 2025-02-20 07:13:04 -05:00 committed by GitHub
parent cacdaaf3a9
commit ec836d740f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -473,6 +473,10 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension):
conflicts("%gcc@:11", when="@2.17:") conflicts("%gcc@:11", when="@2.17:")
conflicts("%gcc@:9.3.0", when="@2.9:") conflicts("%gcc@:9.3.0", when="@2.9:")
conflicts("%gcc@:7.3.0") conflicts("%gcc@:7.3.0")
# https://github.com/tensorflow/tensorflow/issues/76908
conflicts("%clang@:15", when="@2.18:")
# https://github.com/tensorflow/tensorflow/issues/62416
conflicts("%clang@17:", when="@:2.14")
# zlib is vendored and downloaded directly from zlib.org (or mirrors), but # zlib is vendored and downloaded directly from zlib.org (or mirrors), but
# old downloads are removed from that site immediately after a new release. # old downloads are removed from that site immediately after a new release.
@ -509,6 +513,14 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension):
# protobuf definitions. # protobuf definitions.
patch("0008-Fix-protobuf-errors-when-using-system-protobuf.patch", when="@2.5:2.6") patch("0008-Fix-protobuf-errors-when-using-system-protobuf.patch", when="@2.5:2.6")
# remove unnecessary symbol ignores that cause errors with new compilers
# https://github.com/tensorflow/tensorflow/issues/62416
patch(
"https://raw.githubusercontent.com/getsolus/packages/dfc56ba57a8af8233a635e309b499ff5d27992f4/packages/t/tensorflow/files/fix-clang-18.diff",
sha256="10d730b59284843d6c9ba92668b068582e51d5cdfc7ccfe8e26791ad0f41d4ac",
when="@2.15",
)
# see https://github.com/tensorflow/tensorflow/issues/62490 # see https://github.com/tensorflow/tensorflow/issues/62490
# and https://github.com/abseil/abseil-cpp/issues/1665 # and https://github.com/abseil/abseil-cpp/issues/1665
patch("absl_neon.patch", when="@2.16.1:2.17 target=aarch64:") patch("absl_neon.patch", when="@2.16.1:2.17 target=aarch64:")
@ -744,6 +756,7 @@ def setup_build_environment(self, env):
# Do you want to use Clang to build TensorFlow? # Do you want to use Clang to build TensorFlow?
if "%clang" in spec: if "%clang" in spec:
env.set("TF_NEED_CLANG", "1") env.set("TF_NEED_CLANG", "1")
env.set("CLANG_COMPILER_PATH", spack_cc)
else: else:
env.set("TF_NEED_CLANG", "0") env.set("TF_NEED_CLANG", "0")