summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-03-13 17:03:10 +0100
committerHarmen Stoppels <harmenstoppels@gmail.com>2024-04-22 15:18:06 +0200
commit209a3bf3026f9d75262dd1e92c04008876b4fbae (patch)
treee6e2671f772a0cfc6fff927ba9e125eab0c634e3 /var
parente8c41cdbcb1313eff006e737165ca36611da850c (diff)
downloadspack-209a3bf3026f9d75262dd1e92c04008876b4fbae.tar.gz
spack-209a3bf3026f9d75262dd1e92c04008876b4fbae.tar.bz2
spack-209a3bf3026f9d75262dd1e92c04008876b4fbae.tar.xz
spack-209a3bf3026f9d75262dd1e92c04008876b4fbae.zip
Compiler.default_libc
Some logic to detect what libc the c / cxx compilers use by default, based on `-dynamic-linker`. The function `compiler.default_libc()` returns a `Spec` of the form `glibc@x.y` or `musl@x.y` with the `external_path` property set. The idea is this can be injected as a dependency. If we can't run the dynamic linker directly, fall back to `ldd` relative to the prefix computed from `ld.so.`
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py8
-rw-r--r--var/spack/repos/builtin/packages/glibc/package.py3
-rw-r--r--var/spack/repos/builtin/packages/musl/package.py3
3 files changed, 14 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index f9ff5b9fbe..91f5358b0c 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -1185,5 +1185,13 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
description=f"Add a dependency on '{gfortran_str}' for nodes compiled with "
f"{str(spec)} and using the 'fortran' language",
)
+
+ libc = compiler.default_libc()
+
+ if libc:
+ pkg("*").depends_on(
+ str(libc), when=f"%{str(compiler.spec)}", type="link", description="Add libc"
+ )
+
# The version of gcc-runtime is the same as the %gcc used to "compile" it
pkg("gcc-runtime").requires(f"@={str(spec.version)}", when=f"%{str(spec)}")
diff --git a/var/spack/repos/builtin/packages/glibc/package.py b/var/spack/repos/builtin/packages/glibc/package.py
index c5a1709efa..d878244f87 100644
--- a/var/spack/repos/builtin/packages/glibc/package.py
+++ b/var/spack/repos/builtin/packages/glibc/package.py
@@ -20,9 +20,12 @@ class Glibc(AutotoolsPackage, GNUMirrorPackage):
maintainers("haampie")
build_directory = "build"
+ tags = ["runtime"]
license("LGPL-2.1-or-later")
+ provides("libc")
+
version("master", branch="master")
version("2.39", sha256="97f84f3b7588cd54093a6f6389b0c1a81e70d99708d74963a2e3eab7c7dc942d")
version("2.38", sha256="16e51e0455e288f03380b436e41d5927c60945abd86d0c9852b84be57dd6ed5e")
diff --git a/var/spack/repos/builtin/packages/musl/package.py b/var/spack/repos/builtin/packages/musl/package.py
index 13ce939b41..4b503feb64 100644
--- a/var/spack/repos/builtin/packages/musl/package.py
+++ b/var/spack/repos/builtin/packages/musl/package.py
@@ -25,9 +25,12 @@ class Musl(MakefilePackage):
homepage = "https://www.musl-libc.org"
url = "https://www.musl-libc.org/releases/musl-1.1.23.tar.gz"
+ tags = ["runtime"]
license("MIT")
+ provides("libc")
+
version("1.2.4", sha256="7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039")
version("1.2.3", sha256="7d5b0b6062521e4627e099e4c9dc8248d32a30285e959b7eecaa780cf8cfd4a4")
version("1.2.2", sha256="9b969322012d796dc23dda27a35866034fa67d8fb67e0e2c45c913c3d43219dd")