py-torchvision: fix build with Apple Clang 16 (#46462)

This commit is contained in:
Adam J. Stewart 2024-10-08 05:54:39 +02:00 committed by GitHub
parent a9e9b901d1
commit 1a965e9ec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,6 +152,13 @@ class PyTorchvision(PythonPackage):
# Many of the datasets require additional dependencies to use.
# These can be installed after the fact.
def flag_handler(self, name, flags):
# https://github.com/pytorch/vision/issues/8653
if name == "ldflags":
if self.spec.satisfies("%apple-clang@15:"):
flags.append("-Wl,-ld_classic")
return (flags, None, None)
def setup_build_environment(self, env):
# The only documentation on building is what is found in setup.py and:
# https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md#development-installation