From fd087107ea52b402e6d385b430a320fc3d3d6734 Mon Sep 17 00:00:00 2001 From: Andrew W Elble Date: Wed, 25 Sep 2024 09:19:58 -0400 Subject: py-tensorflow: fix linking with ubuntu's gcc (#45437) gcc on ubuntu has fix-cortex-a53-843419 set by default - this causes linking issues (symbol relocation errors) for tf, even when compiling for different cpus. --- .../repos/builtin/packages/py-tensorflow/package.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py index c94a2082d5..e6e7dce487 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py @@ -452,6 +452,22 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): ) phases = ["configure", "build", "install"] + def flag_handler(self, name, flags): + spec = self.spec + # ubuntu gcc has this workaround turned on by default in aarch64 + # and it causes issues with symbol relocation during link + # note, archspec doesn't currently ever report cortex_a53! + if ( + name == "ldflags" + and spec.target.family == "aarch64" + and "ubuntu" in spec.os + and spec.compiler.name == "gcc" + and "cortex_a53" not in spec.target.name + ): + flags.append("-mno-fix-cortex-a53-843419") + + return (flags, None, None) + # https://www.tensorflow.org/install/source def setup_build_environment(self, env): spec = self.spec -- cgit v1.2.3-70-g09d2