hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
307 stars 141 forks source link

Generate a build of stacks-devnet-js for arm64 architecture / Apple M1 #210

Closed playerx closed 2 years ago

playerx commented 2 years ago

Here is the error message:

install response status 404 Not Found on https://github.com/hirosystems/clarinet/releases/download/v0.23.0/stacks-devnet-js-darwin-arm64.tar.gz

full log:

> npm i -D @hirosystems/stacks-devnet-js              14s
npm ERR! code 1
npm ERR! path /Users/ez/Test/stackProj/node_modules/@hirosystems/stacks-devnet-js
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build=false || npm run build-release
npm ERR! response status 404 Not Found on https://github.com/hirosystems/clarinet/releases/download/v0.23.0/stacks-devnet-js-darwin-arm64.tar.gz
npm ERR! 
npm ERR! > @hirosystems/stacks-devnet-js@0.23.0 build-release
npm ERR! > npm run build -- --release
npm ERR! 
npm ERR! 
npm ERR! > @hirosystems/stacks-devnet-js@0.23.0 build
npm ERR! > tsc --build && cargo-cp-artifact -nc native/index.node -- cargo build --message-format=json-render-diagnostics "--release"
npm ERR! 
npm ERR! error TS5083: Cannot read file '/Users/ez/Test/stackProj/node_modules/@hirosystems/stacks-devnet-js/tsconfig.json'.
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.8
npm ERR! node-pre-gyp info using node@16.13.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/ez/Test/stackProj/node_modules/@hirosystems/stacks-devnet-js/native/index.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/hirosystems/clarinet/releases/download/v0.23.0/stacks-devnet-js-darwin-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/hirosystems/clarinet/releases/download/v0.23.0/stacks-devnet-js-darwin-arm64.tar.gz 
npm ERR! node-pre-gyp ERR! install error 
npm ERR! node-pre-gyp ERR! stack Error: response status 404 Not Found on https://github.com/hirosystems/clarinet/releases/download/v0.23.0/stacks-devnet-js-darwin-arm64.tar.gz
npm ERR! node-pre-gyp ERR! stack     at /Users/ez/Test/stackProj/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
npm ERR! node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.2.0
npm ERR! node-pre-gyp ERR! command "/opt/homebrew/Cellar/node@16/16.13.0/libexec/node" "/Users/ez/Test/stackProj/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
npm ERR! node-pre-gyp ERR! cwd /Users/ez/Test/stackProj/node_modules/@hirosystems/stacks-devnet-js
npm ERR! node-pre-gyp ERR! node -v v16.13.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.8
npm ERR! node-pre-gyp ERR! not ok
csgui commented 2 years ago

Hello @playerx !

Seems that there is no binary for M1 chips. For that case, @hirosystems/stacks-devnet-js should be compiled from source.

Have you tried to clone clarinet repo and installing @hirosystems/stacks-devnet-js from there? That might be a workaround.

$ git clone git@github.com:hirosystems/clarinet.git --recurse-submodules
$ cd clarinet/node-bindings && npm install

@lgalabru what you think in adding a step before the install to check the system architecture? And from there proceed with the binary download or the installation from the source.

lgalabru commented 2 years ago

Good catch, thanks @playerx @csgui. As of today, generating a M1 build via a Github action requires a bunch of hacks. We should definitely start a manual build if a M1 arch is detected + adequate rust toolchain is available on the machine. A good temporary workaround is too build a lib on a M1 machine and upload it manually (step that I just completed). Will update this issue once we have a process in place.