Lightprotocol / light-protocol

The ZK Compression Protocol For Solana
https://www.zkcompression.com
GNU General Public License v3.0
157 stars 27 forks source link

chore: fix cargo metadata error on first use of build.sh #1155

Closed sergeytimoshin closed 3 weeks ago

sergeytimoshin commented 3 weeks ago

If we try to run: git clean -dfx && ./scripts/install.sh && . ./scripts.devenv.sh && ./scripts/build.sh we'll get an error (see below), and then the second call ./scripts/build.sh will run without any errors. This PR fixes this first cargo metadata error on the first build attempt.

./scripts/build.sh 
+ pnpm install
Scope: all 12 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
cli postinstall$ [ -d ./bin ] && find ./bin -type f -exec chmod +x {} + || echo 'No bin directory found, skipping chmod'
│ No bin directory found, skipping chmod
└─ Done in 11ms
Done in 1s
+ '[' '!' -f target/deploy/spl_noop.so ']'
+ mkdir -p target/deploy
+ cp third-party/solana-program-library/spl_noop.so target/deploy
+ npx nx run-many --target=build --all

 NX   Running target build for 8 projects

   ✖  nx run @lightprotocol/hasher.rs:build
      > @lightprotocol/hasher.rs@0.2.0 build /Users/tsv/Developer/light-protocol/hasher.rs
      > rm -rf dist/ && pnpm build:wasm && pnpm build:wasm-simd && pnpm build:bundle

      > @lightprotocol/hasher.rs@0.2.0 build:wasm /Users/tsv/Developer/light-protocol/hasher.rs
      > wasm-pack build -t web --out-dir ../main/wasm src/wasm

      Error: cargo metadata exited with an error: info: syncing channel updates for '1.79-aarch64-apple-darwin'
      info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
      info: downloading component 'cargo'
      info: downloading component 'clippy'
      info: downloading component 'rust-docs'
      error: component download failed for rust-docs-aarch64-apple-darwin: could not rename downloaded file from '/Users/tsv/.rustup/downloads/1c03a379902552e60242dc4a2ae422c1d08de704e2c7d1b3cde3788ff97d8359.partial' to '/Users/tsv/.rustup/downloads/1c03a379902552e60242dc4a2ae422c1d08de704e2c7d1b3cde3788ff97d8359'

      Caused by: cargo metadata exited with an error: info: syncing channel updates for '1.79-aarch64-apple-darwin'
      info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
      info: downloading component 'cargo'
      info: downloading component 'clippy'
      info: downloading component 'rust-docs'
      error: component download failed for rust-docs-aarch64-apple-darwin: could not rename downloaded file from '/Users/tsv/.rustup/downloads/1c03a379902552e60242dc4a2ae422c1d08de704e2c7d1b3cde3788ff97d8359.partial' to '/Users/tsv/.rustup/downloads/1c03a379902552e60242dc4a2ae422c1d08de704e2c7d1b3cde3788ff97d8359'

       ELIFECYCLE  Command failed with exit code 1.
       ELIFECYCLE  Command failed with exit code 1.