LukeMathWalker / LukeMathWalker/cargo-chef

Glibc version in `--target` with `--zigbuild` confuses `cargo chef cook`'s cleanup phase

Open
#367 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.7k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

I used the following command:

```shell
cargo chef cook --zigbuild --target x86_64-unknown-linux-gnu.2.27 --release -p ...
```

`cargo-chef` successfully built all packages, but then died at the cleanup phase:
```
Error: Failed to cook recipe.

Caused by:
0: Failed to clean up dummy compilation artifacts.
1: IO error for operation on /home/agni/projects/my-project/target/x86_64-unknown-linux-gnu.2.27/release: No such file or directory (os error 2)
2: No such file or directory (os error 2)
```

This is because `cargo-zigbuild` strips the Glibc version used from the resulting target directory, so `target/x86_64-unknown-linux-gnu` exists but not `target/x86_64-unknown-linux-gnu.2.27`. `cargo-chef` could account for this by stripping the Glibc version like `cargo-zigbuild` does when passed `--zigbuild`:

https://github.com/rust-cross/cargo-zigbuild/blob/e799e0fd2c40b2a1cd165b0f50f5440b6593b4fb/src/zig/cargo_env.rs#L74-L77

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing cargo-chef's cleanup phase for `cook --zigbuild --target`, then compare its target-directory handling with cargo-zigbuild's `src/zig/cargo_env.rs` at lines 74-77. Verify the cleanup uses the directory actually produced for a target containing a Glibc version, and run the relevant test suite or reproduction command to confirm the failure is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust, zig
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.