-
Notifications
You must be signed in to change notification settings - Fork 11
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
Always pass --lib to cargo with link-args #40
Conversation
Cargo will throw an error when the target of the compilation is ambiguous. This leads to an error when there's an additional main.rs, e.g. for easy testing during development. Specifying `--lib` makes it clear that we only want to build the library. Before ``` ~/.cargo/bin/cargo rustc --release -- -C link-args=-Wl,-undefined,dynamic_lookup error: extra arguments to `rustc` can only be passed to one target, consider filtering ``` After ``` ~/.cargo/bin/cargo rustc --release --lib -- -C link-args=-Wl,-undefined,dynamic_lookup ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I'll look into it a bit more later, but for now I just have one question.
@@ -114,6 +114,7 @@ def cargo_rustc_args | |||
args = [] | |||
unless config.dynamic_linker_flags == '' || config.target_os == 'mingw32' | |||
args.push( | |||
'--lib', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this outside of the conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo will only complain about this issue when handing additional flags to rustc
. So it works just fine when no linker flags are passed.
I think this sort of bugfix needs a(n integration) regression test, but this project isn't particularly set up for that yet. I'll take suggestions on how to do it, though. |
Yes, I agree. One way would be to ship a minimal gem under |
Sorry for the extremely long delay! I appreciate the contribution. |
Cargo will throw an error when the target of the compilation is
ambiguous. This leads to an error when there's an additional main.rs,
e.g. for easy testing during development. Specifying
--lib
makes itclear that we only want to build the library.
Before
After
Versions: