cargo-semver-checks: Better diagnostic message for compilation failures while building rustdoc

Steps to reproduce the bug with the above code

git clone https://github.com/archlinux/alpm.rs.git
cd alpm.rs
cargo semver-checks

Note you will need system libraries for libalpm installed to use this. libalpm is the library for the package mananger on Arch Linux. So it may be easiest to recreate in an arch linux docker/podman container for you (docker.io/library/archlinux). If so you will likely need to install build tooling:

$ podman run -ti --rm docker.io/library/archlinux /bin/bash
$ # In container:
$ pacman -Syu --noconfirm base-devel rustup pkgconf git cmake
$ rustup install stable
$ cargo install cargo-semver-checks
$ # Same steps as above

Actual Behaviour

$ cargo semver-checks
     Parsing alpm v2.2.3 (current)
     Parsing alpm-sys v2.1.3 (current)
     Parsing alpm-utils v2.0.1 (current)
Error: running cargo-doc failed on /home/user/src/alpm/target/semver-checks/local-alpm-2_2_3/Cargo.toml:
   Compiling regex-syntax v0.8.2
   Compiling bindgen v0.66.1
   Compiling peeking_take_while v0.1.2
    Checking bitflags v1.3.2
   Compiling regex-automata v0.4.5
   Compiling regex v1.10.3
   Compiling alpm-sys v2.1.3 (/home/user/src/alpm/alpm-sys)
error: couldn't read /home/user/src/alpm/target/semver-checks/local-alpm-2_2_3/target/semver-checks/target/debug/build/alpm-sys-f51410450d14fd87/out/ffi_generated.rs: No such file or directory (os error 2)
 --> /home/user/src/alpm/alpm-sys/src/ffi_generated.rs:1:1
  |
1 | include!(concat!(env!("OUT_DIR"), "/ffi_generated.rs"));
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `alpm-sys` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `alpm-sys` (lib) due to 1 previous error

Expected Behaviour

Since the workspace passes cargo build and cargo doc I expect it to also work with semver-checks

Generated System Information

Software version

cargo-semver-checks 0.28.0

Operating system

Linux 6.7.4-arch1-1

Command-line

/home/arvid/.cargo/bin/cargo-semver-checks semver-checks --bugreport 

cargo version

> cargo -V 
cargo 1.76.0 (c84b36747 2024-01-18)

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Build Configuration

$ cat ~/.cargo/config.toml              
[net]
git-fetch-with-cli = true

[build]
rustc-wrapper = "/usr/bin/sccache"

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-C", "link-arg=--ld-path=/usr/bin/mold"]

Additional Context

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Prefixing the output from the error with an information that cargo-sermver-checks encountered an external error might also be useful for debugging.

Nice, thanks! I’m going to throw an extra newline between the “reproduce the error” command and the next line, just to make it a bit easier to read when output continues.

so sorry about not knowing how to use it

I think cargo-semver-checks could do a better job with saying what went wrong 😃

@obi1kenobi it might be not obvious that cargo-semver-checks runs the crates on more features than just the default ones. I wonder, when it checks a crate, could it also print the features it is testing? Usually the list of features is small, probably we can print them all in a single line. I currently don’t have time to implement a prototype, unfortunately.

Closing as it seems to be a alpm.rs bug not a semver check bug

Oh, thanks. this is the first time I used cargo semver-checks, so sorry about not knowing how to use it. I wanted to tell if my PR would be a breaking change or not.