Skip to content

Build scripts fail to run with new build dir layout when __CARGO_DEFAULT_LIB_METADATA is set #16854

@RalfJung

Description

@RalfJung

Problem

Build scripts fail to run with new build dir layout when __CARGO_DEFAULT_LIB_METADATA is set

This is a recent regression, probably introduced by #16812.

Steps

  1. Set up a project with a libc dependency (or anything else that needs a build script)
  2. Run CARGO_UNSTABLE_BUILD_DIR_NEW_LAYOUT=true __CARGO_DEFAULT_LIB_METADATA=foo cargo build

Expected behavior: A successful build.

Actual behavior:

error: failed to run custom build command for `getrandom v0.4.2`

Caused by:
  could not execute process `/home/r/src/rust/lib-crates/rustc-build-sysroot/target/debug/build/getrandom/0b53632d37620753/out/build_script_build` (never executed)

Caused by:
  No such file or directory (os error 2)

I'm aware that __CARGO_DEFAULT_LIB_METADATA is internal and unstable, but it is used for the sysroot build, so this causes cargo-based sysroot builds to break. Rustc bootstrap doesn't use the new build dir layout yet so it is not affected at this time, but Miri (which uses https://github.com/RalfJung/rustc-build-sysroot/) is affected when CARGO_UNSTABLE_BUILD_DIR_NEW_LAYOUT is set.

Possible Solution(s)

No response

Notes

No response

Version


Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions