Skip to content

Commit 16fd77f

Browse files
authored
rust-bootstrap: fix zlib dependency (spack#47894)
x
1 parent f82554a commit 16fd77f

File tree

1 file changed

+15
-0
lines changed
  • var/spack/repos/builtin/packages/rust-bootstrap

1 file changed

+15
-0
lines changed

var/spack/repos/builtin/packages/rust-bootstrap/package.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ class RustBootstrap(Package):
133133
if os in rust_releases[release] and target in rust_releases[release][os]:
134134
version(release, sha256=rust_releases[release][os][target])
135135

136+
# rust-ldd and libLLVM both depend on zlib, which is not vendored.
137+
depends_on("zlib-api")
138+
depends_on("zlib-ng +shared", when="^[virtuals=zlib-api] zlib-ng")
139+
depends_on("zlib +shared", when="^[virtuals=zlib-api] zlib")
140+
depends_on("[email protected]:", when="platform=linux", type="build")
141+
136142
def url_for_version(self, version):
137143
if self.os not in ("linux", "darwin"):
138144
return None
@@ -151,6 +157,15 @@ def url_for_version(self, version):
151157
url = "https://static.rust-lang.org/dist/rust-{0}-{1}-{2}.tar.gz"
152158
return url.format(version, target, os)
153159

160+
@run_before("install", when="platform=linux")
161+
def fixup_rpaths(self):
162+
# set rpaths of libLLVM.so and rust-ldd to zlib's lib directory
163+
rpaths = self.spec["zlib-api"].libs.directories
164+
165+
for binary in find(self.stage.source_path, ["libLLVM.so.*", "rust-lld"]):
166+
patchelf = Executable("patchelf")
167+
patchelf("--add-rpath", ":".join(rpaths), binary)
168+
154169
def install(self, spec, prefix):
155170
install_script = Executable("./install.sh")
156171
install_args = [f"--prefix={prefix}", "--without=rust-docs"]

0 commit comments

Comments
 (0)