#Debugging soroban-tools make rebuilds

15 messages · Page 1 of 1 (latest)

forest herald
#

@inner drift Do you have a workflow I can copy?

#

When I run make build-test-wasms multiple times only the first time rebuilds.

inner drift
#

Run make build-test-wasms then make build-snapshot

forest herald
#

Even when I run build-snapshot, build-test-wasms still builds without rebuilding on my system.

#

However build-snapshot definitely seems to rebuild for some reason for me.

#

Could you paste your terminal log?

inner drift
#

yes, that's also what I see. build-snapshot almost always kicks off a recompile of all dependencies

#

I'll send a terminal log when I get back to this!

forest herald
#

Got it. So the issue is build-snapshot is rebuilding when we expect it not to.

forest herald
#
$ make build-test-wasms
cargo build --package 'test_*' --profile test-wasms --target wasm32-unknown-unknown
    Finished test-wasms [optimized] target(s) in 0.11s
$ make build-snapshot
cargo build --package 'test_*' --profile test-wasms --target wasm32-unknown-unknown
    Finished test-wasms [optimized] target(s) in 0.12s
cargo run -- contract bindings typescript \
                                        --wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm \
                                        --contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK \
                                        --network futurenet \
                                        --output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types \
                                        --overwrite
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm --contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK --network futurenet --output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types --overwrite`

added 26 packages, and audited 27 packages in 824ms

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> test_custom_types@0.0.0 build
> node ./scripts/build.mjs

$ make build-test-wasms
cargo build --package 'test_*' --profile test-wasms --target wasm32-unknown-unknown
    Finished test-wasms [optimized] target(s) in 0.13s
$ make build-snapshot
cargo build --package 'test_*' --profile test-wasms --target wasm32-unknown-unknown
    Finished test-wasms [optimized] target(s) in 0.13s
cargo run -- contract bindings typescript \
                                        --wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm \
                                        --contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK \
                                        --network futurenet \
                                        --output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types \
                                        --overwrite
    Finished dev [unoptimized + debuginfo] target(s) in 0.21s
     Running `target/debug/soroban contract bindings typescript --wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm --contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK --network futurenet --output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types --overwrite`

added 26 packages, and audited 27 packages in 790ms

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> test_custom_types@0.0.0 build
> node ./scripts/build.mjs
#

Both targets seem to build fine without rebuilds.

#

@inner drift It could be that your IDE, if it is running rust-analyzer, is invalidating something in your target cache. I've seen this happen if when I've had rust-analyzer configured to build with different settings to the Makefile, and heard it happen to someone who was running an old version of rust-analyzer.

#

I also highly recommend installing ccache (you can do that with brew install ccache) and then setting the env var RUSTC_WRAPPER=/opt/homebrew/bin/sccache. It'll cache your builds across all your repos independently. Even if cargo decides to rebuild, if the artifact has been rebuilt before it'll still live in the sccache central cache.