Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build scripts being able to provide extra context on errors #12071

Closed
ShadowJonathan opened this issue Jan 25, 2022 · 1 comment
Closed

Build scripts being able to provide extra context on errors #12071

ShadowJonathan opened this issue Jan 25, 2022 · 1 comment
Labels
A-build-scripts Area: build.rs scripts A-diagnostics Area: Error and warning messages generated by Cargo itself.

Comments

@ShadowJonathan
Copy link

Take the following build error;

error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `libc` due to previous error

For a new user, this might be a bit of a "show stopper", or otherwise a kink/bump in the road for them to get started. Rust already has a bunch of helpful errors, I think it could help if the build script (or any script) is able to "catch" this error, observe it, and possibly provide additional information useful for the user at hand. (f.e. "TIP: You are on a debian OS, installing build-essential will provide the relevant files for this build").

This would allow library developers to provide "here, do this to proceed building" instructions for common cases, and/or even try to diagnose tricky cases, or provide extra debug/context information on output of such a build.

@jyn514 jyn514 added the T-cargo Team: Cargo label May 1, 2023
@weihanglo weihanglo transferred this issue from rust-lang/rust May 1, 2023
@weihanglo
Copy link
Member

Thanks for the report. However, the error message is subject to how a build script is written. Cargo cannot know in advance what a build script needs to compile. #11593 is a proposal for displaying message to instruct library users. I think that's a route to resolve this issue. Close in favor of that and other relevant issues listed in #11593 (comment).

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2023
@weihanglo weihanglo added A-diagnostics Area: Error and warning messages generated by Cargo itself. A-build-scripts Area: build.rs scripts and removed T-cargo Team: Cargo labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts A-diagnostics Area: Error and warning messages generated by Cargo itself.
Projects
None yet
Development

No branches or pull requests

3 participants