top | item 39367669

(no title)

flgstnd | 2 years ago

I used x86_64 GNU/Linux, NixOS, cargo 1.78.0-nightly (ccc84ccec 2024-02-07). When deleting the target directory and running `cargo build`, all the dependency crates build pretty fast. But then the build script takes ages. And somehow runs twice. In the target/debug/build dir are 2 different build-script-build executables, that produce the same outputs (compressed_syntaxes/theme). I thought it might be related to the `cargo:rerun-if-changed` stuff in the build.rs but it's the same with those lines commented out.

discuss

order

sidju|2 years ago

I can confirm that it created two binaries of basically every dependency and I don't know why (tried to look into it but couldn't find anything), but at least in my case both don't run. (I looked at the running process ID and command line while reproducing. It was the same binary running in the same process the whole time for me.)

There is a bit of a gotcha that if you build a debug build the build script will be less optimized. This makes a debug build take nearly 4 minutes total on my computer due to how much processing is done in the build script. A release build only takes roughly 2 minutes total due to the optimized build script.

(The "cargo:rerun-if-changed" tells cargo under which circumstances it is necessary to rerun the build script. It doesn't change its behavior on a fresh build.)

Please check if it really does run twice, and thus changes process ID and command line. (I run `top`, press shift+v for process tree, c for command line and go look at the cargo process to find the build-script run.)