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

grpcio-sys recompiling every build on non-linux platforms #449

Closed
kylefleming opened this issue Mar 25, 2020 · 14 comments
Closed

grpcio-sys recompiling every build on non-linux platforms #449

kylefleming opened this issue Mar 25, 2020 · 14 comments

Comments

@kylefleming
Copy link

Description

When compiling (using cargo) for targets that aren't either x86_64-unknown-linux-gnu or aarch64-unknown-linux-gnu, cargo determines that grpcio-sys needs to be recompiled regardless of whether anything has changed.

This is happening because of this line in grpcio-sys/build.rs:

println!("cargo:rerun-if-changed=bindings/{}-bindings.rs", &target);

which was introduced in this commit. There is only a -bindings.rs file for the 2 targets mentioned above. Cargo will always rerun when it encounters a missing file specified by a cargo:rerun-if-changed directive. See this comment for reference.

To Reproduce

This can be reproduced by compiling any package that depends on grpcio-sys (I'm using 0.5.0). For detailed log information, set the CARGO_LOG environment variable to cargo::core::compiler::fingerprint=info:

CARGO_LOG=cargo::core::compiler::fingerprint=info cargo build

The output will be something similar to:

[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint] stale: missing "/Users/kyle/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.0/bindings/x86_64-apple-darwin-bindings.rs"
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint] fingerprint error for grpcio v0.5.0/Build/Target { ..: lib_target("grpcio", ["lib"], "/Users/kyle/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-0.5.0/src/lib.rs", Edition2018) }
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint]     err: current filesystem status shows we're outdated
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint] fingerprint error for grpcio-sys v0.5.0/Build/Target { ..: lib_target("grpcio-sys", ["lib"], "/Users/kyle/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.0/src/lib.rs", Edition2018) }
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint]     err: current filesystem status shows we're outdated
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint] fingerprint error for grpcio-sys v0.5.0/RunCustomBuild/Target { ..: custom_build_target("build-script-build", "/Users/kyle/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.0/build.rs", Edition2018) }
[2020-03-25T02:33:41Z INFO  cargo::core::compiler::fingerprint]     err: current filesystem status shows we're outdated
   Compiling grpcio-sys v0.5.0
   Compiling grpcio v0.5.0

System information

  • CPU architecture: x86_64
  • Distribution and kernel version: Darwin 19.3.0
  • SELinux on?: No
@BusyJay
Copy link
Member

BusyJay commented Mar 25, 2020

Thanks for the investigation. Can you send a PR to fix it? Only print it when files are generated should be enough.

eranrund added a commit to eranrund/grpc-rs that referenced this issue Mar 25, 2020
eranrund added a commit to eranrund/grpc-rs that referenced this issue Mar 25, 2020
…it is being used (fix tikv#449)

Signed-off-by: Eran Rundstein <eran@rundste.in>
@eranrund
Copy link
Contributor

PR submitted!

eranrund added a commit to eranrund/grpc-rs that referenced this issue Mar 26, 2020
…it is being used (fix tikv#449)

Signed-off-by: Eran Rundstein <eran@rundste.in>
@eranrund
Copy link
Contributor

Thanks for merging the fix! Any idea when a new version that includes the fix would get released?

@BusyJay
Copy link
Member

BusyJay commented Mar 26, 2020

Should be these days. Probably next Monday.

@eranrund
Copy link
Contributor

Sweet, thank you!

@KapJI
Copy link

KapJI commented Mar 30, 2020

@BusyJay grpcio 0.5.1 still depends on grpcio-sys 0.5.0 so this is not completely fixed yet as upgrading grpcio won't upgrade grpcio-sys.

@BusyJay
Copy link
Member

BusyJay commented Mar 30, 2020

Good point! Can you use command cargo update -p grpcio-sys to get around the problem?

@KapJI
Copy link

KapJI commented Mar 30, 2020

To get around I removed grpcio-sys from target folder completely and on the next run cargo downloaded 0.5.1.

@eranrund
Copy link
Contributor

Good point! Can you use command cargo update -p grpcio-sys to get around the problem?

This doesn't result in grpcio-sys being updated in my lock file for some reason.

@BusyJay
Copy link
Member

BusyJay commented Mar 31, 2020

@eranrund Can you share your Cargo.toml? I suspect that's because 0.5.1 updates bindgen, which may be conflict with your existing dependency and prevents cargo to use an updated version. It's probably related to rust-lang/cargo#5237.

@eranrund
Copy link
Contributor

Unfortunately it's an enormous project with many crates. We're with bindgen 0.51.1.

@BusyJay
Copy link
Member

BusyJay commented Mar 31, 2020

OK, I will downgrade bindgen for 0.5.x due to compatibility issue discussed above..

@BusyJay
Copy link
Member

BusyJay commented Mar 31, 2020

Now, cargo update -p should update grpcio-sys to 0.5.2.

@eranrund
Copy link
Contributor

It did. Thanks again!

BusyJay added a commit to BusyJay/tikv that referenced this issue Apr 5, 2020
grpcio-sys fixes a bug that trigger recompilation on many platform. See
tikv/grpc-rs#449.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
sre-bot pushed a commit to sre-bot/tikv that referenced this issue Apr 6, 2020
grpcio-sys fixes a bug that trigger recompilation on many platform. See
tikv/grpc-rs#449.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
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

4 participants