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.rs scripts are locked to host crate debug/release settings #3903

Closed
jamesmunns opened this issue Apr 6, 2017 · 3 comments
Closed

build.rs scripts are locked to host crate debug/release settings #3903

jamesmunns opened this issue Apr 6, 2017 · 3 comments

Comments

@jamesmunns
Copy link
Member

Hello,

I am working on a project that uses bindgen to generate a pretty significant amount of bindings (produces ~35k lines of rust). I noticed that this process was very slow in debug mode (5 minutes), and very fast in release mode (10 seconds). Here is an example of what I mean (both release and debug have been built before, so only the build.rs actions are re-triggered):

root@c34a43368c3b:/host/smooth_blue# touch build.rs 
root@c34a43368c3b:/host/smooth_blue# xargo build --release --target thumbv7em-none-eabihf
   Compiling smooth_blue v0.1.0 (file:///host/smooth_blue)
    Finished release [optimized] target(s) in 10.47 secs


root@c34a43368c3b:/host/smooth_blue# touch build.rs 
root@c34a43368c3b:/host/smooth_blue# xargo build --target thumbv7em-none-eabihf
   Compiling smooth_blue v0.1.0 (file:///host/smooth_blue)
    Finished dev [unoptimized + debuginfo] target(s) in 311.79 secs

For reference, you can see the setup in this repo: https://github.com/jamesmunns/nrf52dk-sys (let me know if you need help reproducing, this repo is still a WIP).

In my opinion, it would make sense to default to using release mode for build.rs scripts, perhaps that could be overriden in the cargo.toml. In either way, it would be nice to have a way to set release mode for build.rs independently from the host crate.

@jamesmunns
Copy link
Member Author

Tagging @SimonSapin since he suggested I open an issue.

@SimonSapin
Copy link
Contributor

This could tie maybe into Firefox’s request to have different settings that are currently in "profiles" (specifically enabling debug assertions and checked arithmetic) for different crates.

@alexcrichton
Copy link
Member

Thanks for the report! I believe though that this is a dupe of #2424, so closing in favor of that.

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