LimeChain / matchstick

🔥 Unit testing framework for Subgraph development on The Graph protocol. ⚙️
MIT License
207 stars 17 forks source link

m1 v5 binary incorrect #348

Closed walteh closed 2 years ago

walteh commented 2 years ago

Hi, I was trying to use version 5 on an m1 Mac, but could not get it to install the correct binary.

I downloaded the m1 binary from the release and manually replaced the one inside binary-install-raw/bin/0.5.0/binary-macos-11 - all seems to work now.

This is the error I faced:

Downloading release from https://github.com/LimeChain/matchstick/releases/download/0.5.0/binary-macos-11
binary-macos-11 has been installed!
dyld[81528]: Library not loaded: /usr/local/opt/postgresql/lib/libpq.5.dylib
  Referenced from: /Users/.../node_modules/binary-install-raw/bin/0.5.0/binary-macos-11
  Reason: tried: '/usr/local/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/libpq.5.dylib' (no such file)
dimitrovmaksim commented 2 years ago

Can you run graph test -l and post the result. It seems it's downloading the regular macos-11, and not the m1 version through the graph-cli

dimitrovmaksim commented 2 years ago

Btw are you running your terminal under rosetta?

walteh commented 2 years ago

Sure! This is on non rosetta

I reinstalled node modules earlier, so my manual fix is undone here.

# graph test -l
OS type: Darwin
OS arch: x64
OS release: 21.5.0
OS major version: 21
CPU model: Apple M1 Max
Download link: https://github.com/LimeChain/matchstick/releases/download/0.5.0/binary-macos-11
Skipping download/install step because binary already exists at /Users/.../node_modules/binary-install-raw/bin/0.5.0
dyld[33826]: Library not loaded: /usr/local/opt/postgresql/lib/libpq.5.dylib
  Referenced from: /Users/.../node_modules/binary-install-raw/bin/0.5.0/binary-macos-11
  Reason: tried: '/usr/local/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/libpq.5.dylib' (no such file)
dimitrovmaksim commented 2 years ago

Your OS arch is reported as x64 instead of arm64, what is your node version? Have you set your zsh arch to x86_64? (you can check by typing arch in the terminal)

walteh commented 2 years ago

I was on node v14 😂 - switching to v18 fixed the problem!

arch returned arm64 btw

thanks for the help!

dimitrovmaksim commented 2 years ago

Yeah, I think node has full native M1 support from v16 upwards, before that you had to set the arch to x86_64 when installing it

wtait commented 2 years ago

I also encountered this error while using an m1 with node.js v14 and was able to fix by upgrading to the latest node version.