Change:
Describe the bug As of rust nightly 2020-06-22, Rust nightly cannot find This issue is not present in Rust nightly 2020-06-21. To Reproduce Steps to reproduce the behavior: Expected behavior rustc works Additional context This also happens with rust nightly from Notify maintainers Metadata system: host os: multi-user?: sandbox: version: channels(root): channels(jade): nixpkgs: Maintainer information:
We are currently using in internally to set the elf interpreter. Looks like we need to extend this to also extend the RPATH to add zlib. If someone makes a PR, I will review it! Not sure when I would get to implement that myself.
Here is where we add :
I'm working on a patch for this. This is definitely the issue, just need to find the right way to extend the RPATH. I have something replacing it with a path containing zlib, but that overwrites the existing , which breaks it. I would like to verify what is setting there but hardcoding it should provide an early fix
Extending the RPATH seems not to have worked
I'm investigating patching the files in lib This issue may have been introduced by rust-lang/rust so it's likely the new zlib dependency shows up in the LLVM libraries

Discussion:
diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs <del> index 4b432785..fa45e87e 100644 </del> <ins> index 3beddf54..0f859b8d 100644 </ins> --- a/src/dist/component/package.rs +++ b/src/dist/component/package.rs <del> @@ -109,10 +109,11 @@ impl Package for DirectoryPackage { match &*part.0 { "file" => { if self.copy { -                        builder.copy_file(path.clone(), &src_path)? +                        builder.copy_file(path.clone(), &src_path)?; </del> <ins> @@ -113,6 +113,7 @@ impl Package for DirectoryPackage { </ins> } else { <del> -                        builder.move_file(path.clone(), &src_path)? +                        builder.move_file(path.clone(), &src_path)?; </del> <ins> builder.move_file(path.clone(), &src_path)? </ins> } +                    nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path) } "dir" => { if self.copy { <del> @@ -135,6 +136,22 @@ impl Package for DirectoryPackage { </del> <ins> @@ -135,6 +136,29 @@ impl Package for DirectoryPackage { </ins> } } +fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) { <del> +    let is_bin = if let Some(p) = src_path.parent() { +        p.ends_with("bin") </del> <ins> +    let (is_bin, is_lib) = if let Some(p) = src_path.parent() { +        (p.ends_with("bin"), p.ends_with("lib")) </ins> +    } else { <del> +        false </del> <ins> +        (false, false) </ins> +    }; + +    if is_bin {

+            .arg(dest_path) +            .output(); +    } <ins> +    else if is_lib { +        let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") +            .arg("--set-rpath") +            .arg("@libPath@") +            .arg(dest_path) +            .output(); +    } </ins> +} + #[derive(Debug)]

{ stdenv, lib, runCommand, patchelf , fetchFromGitHub, rustPlatform <del> , pkgconfig, curl, Security, CoreServices }: </del> <ins> , pkgconfig, curl, zlib, Security, CoreServices }: </ins> rustPlatform.buildRustPackage rec { pname = "rustup";

nativeBuildInputs = [ pkgconfig ]; buildInputs = [ <del> curl </del> <ins> curl zlib </ins> ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ]; cargoBuildFlags = [ "--features no-self-update" ]; patches = lib.optionals stdenv.isLinux [ <del> (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } '' </del> <ins> (let libPath = lib.makeLibraryPath [ zlib # libz.so.1 ]; in (runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } '' </ins> export dynamicLinker=$(cat $CC/nix-support/dynamic-linker) substitute ${./0001-dynamically-patchelf-binaries.patch} $out  --subst-var patchelf  <del> --subst-var dynamicLinker </del> <ins> --subst-var dynamicLinker  --subst-var libPath </ins> '') <ins> ) </ins> ]; doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;