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

Add suggestion to the "missing native library" error #103000

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

wesleywiser
Copy link
Member

If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like foo.lib or libfoo.a when we expect them to simply provide foo.

In this situation, we now detect that case and suggest the user only provide the library name itself.

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 13, 2022
@rust-highfive
Copy link
Collaborator

r? @eholk

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented Oct 13, 2022

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2022
@@ -0,0 +1,6 @@
error: could not find native static library `libfoo.a`, perhaps an -L flag is missing?
|
= help: only provide the library name `foo`, not the full filename
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a shame we don't have span information here to point out the link attr or ideally the "libfoo.a".

@@ -164,6 +164,7 @@ metadata_failed_write_error =

metadata_missing_native_library =
could not find native static library `{$libname}`, perhaps an -L flag is missing?
.help = only provide the library name `{$suggestedname}`, not the full filename
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.help = only provide the library name `{$suggestedname}`, not the full filename
.help = only provide the library name `{$suggestedname}`, without the extension

Is this better or worse?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that it's more explicit about what is wrong, but unix platforms also have a "lib" prefix applied to the filename that the user also needs to remove and saying "without the prefix and extension" seems pretty wordy to me.

If we fail to locate a native library that we are linking with, it could
be the case the user entered a complete file name like `foo.lib` or
`libfoo.a` when we expect them to simply provide `foo`.

In this situation, we now detect that case and suggest the user only
provide the library name itself.
@compiler-errors
Copy link
Member

Wonderful, thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 13, 2022

📌 Commit 097b6d3 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 13, 2022
…piler-errors

Add suggestion to the "missing native library" error

If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like `foo.lib` or `libfoo.a` when we expect them to simply provide `foo`.

In this situation, we now detect that case and suggest the user only provide the library name itself.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 14, 2022
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#103000 (Add suggestion to the "missing native library" error)
 - rust-lang#103006 (rustdoc: don't ICE on `TyKind::Typeof`)
 - rust-lang#103008 (replace ReErased with fresh region vars in opaque types)
 - rust-lang#103011 (Improve rustdoc `unsafe-fn` GUI test)
 - rust-lang#103013 (Add new bootstrap entrypoints to triagebot)
 - rust-lang#103016 (Ensure enum cast moves)
 - rust-lang#103021 (Add links to relevant pages to find constraint information)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c7f048e into rust-lang:master Oct 14, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants