From 08cad7d0ee37041694ebcbadf095d8d4d23630f0 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Tue, 15 Feb 2022 00:50:22 -0500 Subject: darwin: make sure MACOSX_DEPLOYMENT_TARGET has a minor component (#28926) --- lib/spack/spack/platforms/darwin.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/platforms/darwin.py b/lib/spack/spack/platforms/darwin.py index b4b542cb98..23aa10d81b 100644 --- a/lib/spack/spack/platforms/darwin.py +++ b/lib/spack/spack/platforms/darwin.py @@ -60,4 +60,13 @@ class Darwin(Platform): """ os = self.operating_sys[pkg.spec.os] - env.set('MACOSX_DEPLOYMENT_TARGET', str(os.version)) + version = os.version + if len(version) == 1: + # Version has only one component: add a minor version to prevent + # potential errors with `ld`, + # which fails with `-macosx_version_min 11` + # but succeeds with `-macosx_version_min 11.0`. + # Most compilers seem to perform this translation automatically, + # but older GCC does not. + version = str(version) + '.0' + env.set('MACOSX_DEPLOYMENT_TARGET', str(version)) -- cgit v1.2.3-70-g09d2