-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$CARGO_MANIFEST_DIR "leakage" (used at runtime) due to target-specs vendoring. #22
Comments
From what I can tell, this is hooking into the nightly-only feature of target specification explained in this RFC. Here is the relevant part:
My guess is that I think a possible fix here would be to |
Thanks for the report! This does indeed look like a regression. |
No, we just pass the full path. The assumption is that
Sort of. The fundamental issue here is that One compromise could be a
I did look into whether it would be possible to ensure the source code doesn't get copied (but instead remains in Poking around locally (using
Sadly, the use of a build-local copy
Turns out the workaround you'd need is really simple: eddyb/abel465-rust-gpu-nixos-example@184b4d7 dontCargoSetupPostUnpack = true;
postUnpack = ''
mkdir -p .cargo
cat "$cargoDeps"/.cargo/config | sed "s|cargo-vendor-dir|$cargoDeps|" >> .cargo/config
# HACK(eddyb) bypass cargoSetupPostPatchHook.
export cargoDepsCopy="$cargoDeps"
''; (thankfully the hooks rely on $ nix run github:eddyb/abel465-rust-gpu-nixos-example/184b4d793431801ad5c73ed5edc3fe11976384bd
cargo:rerun-if-env-changed=RUSTGPU_CODEGEN_ARGS
cargo:rerun-if-env-changed=RUSTGPU_RUSTFLAGS
Finished `release` profile [optimized] target(s) in 0.13s
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/release/deps/libspirv_std_macros-ce236cb9475b6c8d.so
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libbitflags-07d9e88686e85d9d.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libbitflags-07d9e88686e85d9d.rmeta
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libcompiler_builtins-804091cc4f3bf482.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libcore-5f5d87e3b5f8ccd2.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libglam-c250e8d47b2492d3.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libglam-c250e8d47b2492d3.rmeta
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/liblibm-671ea443fbdaf40b.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/liblibm-671ea443fbdaf40b.rmeta
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libnum_traits-b27e0d8a0540a5ab.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libnum_traits-b27e0d8a0540a5ab.rmeta
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/librustc_std_workspace_core-e58b1b854099b25e.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/librustc_std_workspace_core-e58b1b854099b25e.rmeta
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libspirv_std-48e55c5a5f9f0421.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libspirv_std_types-62cd0220e3ac1702.rlib
cargo:rerun-if-changed=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/libspirv_std_types-62cd0220e3ac1702.rmeta
cargo:rerun-if-changed=/nix/store/0xjid4ksaqp5psp5rwxvv1wqvsdlyydd-rust-gpu-nixos-example-0.0.0/lib/librustc_codegen_spirv.so
cargo:rerun-if-changed=/nix/store/0xjid4ksaqp5psp5rwxvv1wqvsdlyydd-rust-gpu-nixos-example-0.0.0/repo/shaders/shader/src/lib.rs
cargo:rustc-env=shader.spv=/home/eddy/.cache/rust-gpu-shaders/spirv-unknown-vulkan1.1/release/deps/shader.spv |
I've updated the title to reflect the exact technical problem here. We can keep the issue open in the general sense of the build system kerfuffle (even if @abel465 is satisfied with the above workaround), though I should note that long-term this would be overshadowed by much more drastic changes, e.g.: |
eddyb thanks for the solution! |
I cant keep rust-gpu updated for my projects since this commit
Example & Steps To Reproduce
I have made a minimal example to demonstrate
The shader builds just fine for the above command. it uses this version of rust-gpu
The above command is the same except it uses the next commit of rust-gpu which seems to hard code CARGO_MANIFEST_DIR into the binary. This is problematic because the build environment is no longer available during runtime with nix
System Info
The text was updated successfully, but these errors were encountered: