Skip to content

failure in conjunction with cargo_metadata and embed-licensing #198

@benaryorg

Description

@benaryorg

Versions

thing version
OS NixOS 24.11
cargo-auditable 0.6.5
Rust 1.82.0
thing version
OS Debian Testing
cargo-auditable 0.6.6
Rust 1.85.0

I'm seeing this on NixOS and a Debian Live ISO (stable can't install cargo-auditable due to rustc version) so it looks like a distro agnostic thing, and the minimal reproducer should yield the same elsewhere.

Description

It seems that some interaction that works with plain cargo fails with cargo-auditable, specifically when using embed-licensing (crates.io) which uses cargo_metadata under the hood.

full error message
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/nix/store/djyg0h4xszycx7z2hlr7b1gkqcnldgjf-cargo-auditable-0.6.5/bin/cargo-auditable rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 101)
  --- stderr
  thread 'main' panicked at cargo-auditable/src/rustc_wrapper.rs:91:36:
  called `Result::unwrap()` on an `Err` value: MissingOption(Keys(["--out-dir", ""]))
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here's the -vv output for both regular cargo and cargo-auditable:

cargo build -vv

cargo-auditable:

% cargo build -vv
       Fresh unicode-ident v1.0.18
       Fresh proc-macro2 v1.0.95
       Fresh memchr v2.7.4
       Fresh quote v1.0.40
       Fresh ryu v1.0.20
       Fresh syn v2.0.100
       Fresh itoa v1.0.15
       Fresh smallvec v1.15.0
       Fresh serde_derive v1.0.219
       Fresh thiserror-impl v1.0.69
       Fresh current_platform v0.2.0
       Fresh spdx v0.10.8
       Fresh serde v1.0.219
       Fresh thiserror v1.0.69
       Fresh camino v1.1.9
       Fresh serde_json v1.0.140
       Fresh cargo-platform v0.1.9
       Fresh semver v1.0.26
       Fresh cargo_metadata v0.18.1
       Fresh embed-licensing-core v0.3.1
       Fresh embed-licensing-macros v0.3.1
       Fresh embed-licensing v0.3.1
   Compiling mrp v0.1.0 (/tmp/tmp.FtcMN5HT8L/mrp)
     Running `CARGO=/nix/store/4iz0m1fyp6i1wcbf116jdif4x6k3dv0m-cargo-1.82.0/bin/.cargo-wrapped CARGO_BIN_NAME=mrp CARGO_CRATE_NAME=mrp CARGO_MANIFEST_DIR=/tmp/tmp.FtcMN5HT8L/mrp CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='https://gist.github.com/benaryorg/f365840cdf35216fe6cf18be0e501712' CARGO_PKG_LICENSE=Unlicense CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=mrp CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 CARGO_RUSTC_CURRENT_DIR=/tmp/tmp.FtcMN5HT8L/mrp LD_LIBRARY_PATH='/home/benaryorg/backup_exclude/rust_target/shared/debug/deps:/nix/store/qc45mh0cr5zf8181kzhqazh87hsvdwlc-pipewire-1.2.7-jack/lib' /nix/store/djyg0h4xszycx7z2hlr7b1gkqcnldgjf-cargo-auditable-0.6.5/bin/cargo-auditable rustc --crate-name mrp --edition=2021 main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=159 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=7aa1a8469c1b0f0e -C extra-filename=-7aa1a8469c1b0f0e --out-dir /home/benaryorg/backup_exclude/rust_target/shared/debug/deps -C incremental=/home/benaryorg/backup_exclude/rust_target/shared/debug/incremental -L dependency=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps --extern embed_licensing=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps/libembed_licensing-1df75a179ce64d15.rlib`
error: proc macro panicked
 --> main.rs:3:34
  |
3 |     println!("license info: {:#?}", embed_licensing::collect!());
  |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: metadata collection failed: CargoMetadata(CargoMetadata { stderr: "error: failed to run `rustc` to learn about target-specific information\n\nCaused by:\n  process didn't exit successfully: `/nix/store/djyg0h4xszycx7z2hlr7b1gkqcnldgjf-cargo-auditable-0.6.5/bin/cargo-auditable rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 101)\n  --- stderr\n  thread 'main' panicked at cargo-auditable/src/rustc_wrapper.rs:91:36:\n  called `Result::unwrap()` on an `Err` value: MissingOption(Keys([\"--out-dir\", \"\"]))\n  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" })

error: could not compile `mrp` (bin "mrp") due to 1 previous error

Caused by:
  process didn't exit successfully: `CARGO=/nix/store/4iz0m1fyp6i1wcbf116jdif4x6k3dv0m-cargo-1.82.0/bin/.cargo-wrapped CARGO_BIN_NAME=mrp CARGO_CRATE_NAME=mrp CARGO_MANIFEST_DIR=/tmp/tmp.FtcMN5HT8L/mrp CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='https://gist.github.com/benaryorg/f365840cdf35216fe6cf18be0e501712' CARGO_PKG_LICENSE=Unlicense CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=mrp CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 CARGO_RUSTC_CURRENT_DIR=/tmp/tmp.FtcMN5HT8L/mrp LD_LIBRARY_PATH='/home/benaryorg/backup_exclude/rust_target/shared/debug/deps:/nix/store/qc45mh0cr5zf8181kzhqazh87hsvdwlc-pipewire-1.2.7-jack/lib' /nix/store/djyg0h4xszycx7z2hlr7b1gkqcnldgjf-cargo-auditable-0.6.5/bin/cargo-auditable rustc --crate-name mrp --edition=2021 main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=159 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=7aa1a8469c1b0f0e -C extra-filename=-7aa1a8469c1b0f0e --out-dir /home/benaryorg/backup_exclude/rust_target/shared/debug/deps -C incremental=/home/benaryorg/backup_exclude/rust_target/shared/debug/incremental -L dependency=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps --extern embed_licensing=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps/libembed_licensing-1df75a179ce64d15.rlib` (exit status: 1)

regular cargo:

% /nix/store/4iz0m1fyp6i1wcbf116jdif4x6k3dv0m-cargo-1.82.0/bin/cargo build -vv
       Fresh unicode-ident v1.0.18
       Fresh proc-macro2 v1.0.95
       Fresh quote v1.0.40
       Fresh ryu v1.0.20
       Fresh itoa v1.0.15
       Fresh syn v2.0.100
       Fresh memchr v2.7.4
       Fresh smallvec v1.15.0
       Fresh serde_derive v1.0.219
       Fresh thiserror-impl v1.0.69
       Fresh spdx v0.10.8
       Fresh serde v1.0.219
       Fresh thiserror v1.0.69
       Fresh current_platform v0.2.0
       Fresh camino v1.1.9
       Fresh serde_json v1.0.140
       Fresh semver v1.0.26
       Fresh cargo-platform v0.1.9
   Compiling mrp v0.1.0 (/tmp/tmp.FtcMN5HT8L/mrp)
     Running `CARGO=/nix/store/4iz0m1fyp6i1wcbf116jdif4x6k3dv0m-cargo-1.82.0/bin/.cargo-wrapped CARGO_BIN_NAME=mrp CARGO_CRATE_NAME=mrp CARGO_MANIFEST_DIR=/tmp/tmp.FtcMN5HT8L/mrp CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='https://gist.github.com/benaryorg/f365840cdf35216fe6cf18be0e501712' CARGO_PKG_LICENSE=Unlicense CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=mrp CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 CARGO_RUSTC_CURRENT_DIR=/tmp/tmp.FtcMN5HT8L/mrp LD_LIBRARY_PATH='/home/benaryorg/backup_exclude/rust_target/shared/debug/deps:/nix/store/qc45mh0cr5zf8181kzhqazh87hsvdwlc-pipewire-1.2.7-jack/lib' rustc --crate-name mrp --edition=2021 main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=159 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=040f5dde8460afd3 -C extra-filename=-040f5dde8460afd3 --out-dir /home/benaryorg/backup_exclude/rust_target/shared/debug/deps -C incremental=/home/benaryorg/backup_exclude/rust_target/shared/debug/incremental -L dependency=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps --extern embed_licensing=/home/benaryorg/backup_exclude/rust_target/shared/debug/deps/libembed_licensing-1df75a179ce64d15.rlib`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.55s

If I'm hitting some edge-case that intentionally does not work that's meh, but okay.
As someone who has never had any contact with cargo-auditable before I just kind of assumed that it wanted to be 100% compatible with cargo when it comes to invocations.

Minimal Reproducer

The minimal reproducer was already linked above, but here for brevity: https://gist.github.com/benaryorg/f365840cdf35216fe6cf18be0e501712
Running cargo auditable build should suffice to get the error.
Excuse the non-standard main.rs path, but gists having no directories and all that *sigh*

direct invocation for Nix users

If you have Nix (with flakes) sitting around this one will reproduce it off the bat:

nix build --no-link --print-out-paths --print-build-logs git+https://gist.github.com/benaryorg/f365840cdf35216fe6cf18be0e501712

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions