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

Provide a way to supply rustc compiler flags solely for build scripts (build.rs) #3105

Closed
raphaelcohn opened this issue Sep 21, 2016 · 2 comments

Comments

@raphaelcohn
Copy link

Currently, it isn't possible to supply flags to rustc that are used solely for build scripts; there's partial support for crates using links, but nothing for the general case. I'd like a way - environment variables are a shortcut, but .cargo/config is probably better as it doesn't pollute child environments - to pass flags to the rustc that builds build.rs and similar build scripts. In may case, this is because my linker and linker paths are NOT the same as the system linker. Why? Oh, because I'm a running a platform with dual glibc and musl libcs... Nasty, I know, but I have little choice. This sort of combination will also happen for platforms that do cross compilation bootstrapping (eg build a sane build toolchain, then use that to cross compiler, so that there is no pollution from the system linker or headers; an example might be linux from scratch). Nasty, but that's life. Currently I work around this by changing rustc to a wrapper script, sniffing for the name of a build crate in the arguments, and then tweaking things, but it's not particularly sane.

@alexcrichton
Copy link
Member

I think this should be possible through .cargo/config, and transitively through CARGO_* environment variables, right?

@carols10cents
Copy link
Member

I believe this is a duplicate of #4423-- closing this one since #4423 has more information and a pull request. Please reopen if I'm mistaken! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants