-
Notifications
You must be signed in to change notification settings - Fork 13k
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
expose --link-args to rustc #1294
Conversation
Can you add --link-args to the man page as well? |
I'm curious if this needs to exist as a flag, or can migrate up into an attribute. The rule of thumb I'm aiming for is "anything a crate actually needs, to compile-link-run, should be expressible in the source code via an attribute or something, not a mandatory command-line flag". IOW, I'd like "rustc foo.rc" to compile a crate in a default-sane mode as best it can, and reserve options merely for variations-on-a-build (optimization, debugging, profiling, libraries in an unusual spot, etc.) that a user may or may not want to influence. |
I updated the pull request with the man page change. |
erickt, could your use case be satisfied by a combination of 1) adding a crate-level #[link_args] attribute, 2) adding a mechanism to select attributes base on configuration, e.g. #[cfg_attr(target_os = "macos", link_args = "-framework opengl")], and 3) using the existing --cfg flag? Regardless of whether we want a --link-args flag, we should merge the other three commits. |
I wanted to use this to link a .o file into the rust library. It could be replaced with a static library though. I'll withdraw this request for now and resubmit it with the other three commits. |
This is useful for writing configure scripts for extension libraries. It also includes a typo fix, some code cleanup, and a test for getopts.