paritytech / cachepot

cachepot is `sccache` with extra sec, which in turn is `ccache` with cloud storage
https://cachepot.cc
Apache License 2.0
171 stars 13 forks source link

error: failed to run custom build command for `libp2p-core v0.34.0` #167

Closed jamcarbon closed 2 years ago

jamcarbon commented 2 years ago

Weird issue, where "cargo test" failed to run custom build command for libp2p-core v0.34.0

Caused by: process didn't exit successfully: /...../target/release/build/libp2p-core-574ed7c49c431a25/build-script-build (exit status: 101) --- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: Custom { kind: NotFound, error: "failed to invoke protoc (hint: https://docs.rs/prost-build/#sourcing-protoc): No such file or directory (os error 2)" }', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libp2p-core-0.34.0/build.rs:30:6 warning: build failed, waiting for other jobs to finish... make: *** [Makefile:158: test-e2e] Error 101

We are running github actions. This particular test works fine when not using cachepot. If we enable cachepot, and run this test (meaning the cache is empty) the test will complete successfully, but on the next run (when it already cached something) it doesn't work, fails giving this same error above every time. Tried caching locally and in Redis server, both same outcome. Tried installing that library manually (after failed job), and re-running the test. but the same error.

We have successfully run many other tests using cachepot, both locally and with redis server, but it only fails when this library is present.

I'm going to run it 1 more time using 'RUST_BACKTRACE=1' and will post the backtrace (if required) Please let me know if more information is required. Thanks guys!

drahnr commented 2 years ago

I assume you're using the distributed compilation? In this case, protoc is not part of the binary being compiled.

There were a few solution attempts, the right solution would be to have println!("cargo:rerun-if-changed={}", which::which("protoc")); and this will add the file as a dependency which will subsequently be picked up properly by sccache/cachepot. Note that this was never tried with paths outside of the current cargo crate.

jamcarbon commented 2 years ago

Thanks for that, however, after multiple testing of different things to solve it, was just impossible.

I solved it just by using pre-compiled version: cachepot-0.1.0-rc.2-x86_64-unknown-linux-musl.tar.gz

Thanks.

drahnr commented 2 years ago

U can't really follow. The fix would be needed upstream in libp2p and possibly in cachepot - I don't think the solution is contained in a precompiled cachepot artifact.