sp1 icon indicating copy to clipboard operation
sp1 copied to clipboard

Respect CARGO_TARGET_DIR

Open thomasgassmann opened this issue 6 months ago • 1 comments

Component

Other (please describe), sp1-sdk

Describe the feature you would like

Currently building any project referencing sp1-recursion-core with a value of CARGO_TARGET_DIR not ending in target will fail.

E.g. the following fails:

cargo init
cargo add sp1-recursion-core
CARGO_TARGET_DIR=/tmp/test cargo build

The panic occurs here.

Additional context

error: failed to run custom build command for `sp1-recursion-core v5.0.5`

Caused by:
  process didn't exit successfully: `/tmp/test/debug/build/sp1-recursion-core-b0fe302f15c06e9f/build-script-build` (exit status: 101)
  --- stderr

  thread 'main' panicked at /home/thomas/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sp1-recursion-core-5.0.5/build.rs:52:21:
  OUT_DIR does not have parent called "target": "/tmp/test/debug/build/sp1-recursion-core-a8dc4a17f5d960ce/out"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

thomasgassmann avatar Jun 18 '25 15:06 thomasgassmann

Hi, just wanted to note that this issue is addressed in PR #2393. We’ve updated the logic so that CARGO_TARGET_DIR is only set if not already defined in the environment, resolving the problem described here.

quietBlockchain avatar Jul 26 '25 01:07 quietBlockchain