lisk-core icon indicating copy to clipboard operation
lisk-core copied to clipboard

Installing lisk-core 3.0.0-beta.5 via npm on Macbook w/ M1 chip not successful

Open Hupka opened this issue 3 years ago • 13 comments

Expected behavior

Executing command npm install --global --production lisk-core on MacOS (with Node 12) installs the lisk-core software on Macbook with M1 chip.

Actual behavior

The installation procedure fails;

[email protected] install /opt/homebrew/lib/node_modules/lisk-core/node_modules/rocksdb
> node-gyp-build

  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-rocksdb/db/auto_roll_logger.o
clang: error: the clang compiler does not support '-march=native'

Steps to reproduce

  • Have Macbook with Apple's new M1 chip
  • Following installation instructions at https://lisk.io/documentation/lisk-core/v3/setup/npm.html
  • Include non-documented step brew install autoconf automake libtool which is included in beta1 instructions lisk-core

Which version(s) does this affect? (Environment, OS, etc...)

lisk-core 3.0.0-beta.5, potentially earlier versions as well due to the nature of the error.

Potential root cause

The error message indicates a compilation error. This might be caused by the new chipset, as this stackoverflow thread indicated.

Hupka avatar Apr 03 '21 16:04 Hupka

Refer: https://github.com/Level/rocksdb/issues/169

ManuGowda avatar Jun 04 '21 12:06 ManuGowda

https://dev.lisk.com/t/installing-the-lisk-sdk-on-m1-macs/

Lemii avatar Jun 07 '21 11:06 Lemii

https://dev.lisk.com/t/installing-the-lisk-sdk-on-m1-macs/

Hmmm. I wonder if that's the x86_64 version and it's running under emulation :thinking:

I did manage to get a build working on the M1, I will post the full details here shortly.......

Nazgolze avatar Jun 09 '21 07:06 Nazgolze

So when you go down the rabbit hole, you run into a couple issues. There's the node.js rocksdb binding issue that @ManuGowda linked too. I worked around it by forking and removing the march=native line. It also tries to test against electron, but there is no electron build for Mac ARM, so this fails. I deleted all references to electron in the fork (fork of an older version of the binding to match what we're using, in newer versions, I don't think electron is an issue)

You eventually run into https://github.com/chrisa/node-dtrace-provider/issues/118. This is an optional dependency of bunyan, but it always gets pulled in. So the dtrace-provider directory needs to get deleted from node_modules after npm install or yarn (you can try to install with no optional dependencies, but sodium-native probably wouldn't get pulled in then either).

to bring it all together, I ended up using verdaccio and publishing locally. No amount of yarn link and npm link for the rocksdb binding worked at the lisk-core step.

I can't recommend this to everybody :sweat_smile:, but I think we can use this info so that future releases do build smoothly. Stay tuned.....

Nazgolze avatar Jun 09 '21 08:06 Nazgolze

@Nazgolze your fix is released with v5.1.0, maybe try to test with 5.1.0 and see if it works on M1? then we can include it in our next release to support M1.

Also found that it had some issue with macOS 11.5.1, but updating to latest version for RocksDB seem to solve the problem.

ManuGowda avatar Sep 01 '21 09:09 ManuGowda

@Hupka as a workaround you can try arch -x86_64 bash and verify node -p process.arch to make sure its x64.

Then try npm install --global --production lisk-core, you will be able install [email protected].

Please let us know if the workaround helped your.

ManuGowda avatar Jan 24 '22 12:01 ManuGowda

MacBook Air (M1, 2020) Node Version: v16.14.0 lisk-sdk: 5.2.1

found same error:

npm install [email protected]


......
> [email protected] install /private/tmp/lsk-demo/node_modules/rocksdb
> node-gyp-build

(node:58956) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
  CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-rocksdb/db/auto_roll_logger.o
clang: error: the clang compiler does not support '-march=native'
......

@ManuGowda Please help.

EvanXzj avatar Feb 18 '22 09:02 EvanXzj

the issue comes from the [email protected] it should be updated to 5.2.0

przemerr avatar Feb 18 '22 09:02 przemerr

@przemerr
[email protected] was @liskhq/lisk-db's dependency, how can i update it to 5.2.0?

EvanXzj avatar Feb 18 '22 09:02 EvanXzj

i guess it should be updated by HQ, you can try this workaround https://dev.lisk.com/t/installing-the-lisk-sdk-on-m1-macs/462 by installing node.js differently

przemerr avatar Feb 18 '22 10:02 przemerr

@EvanXzj please follow the recommendation from @przemerr.

ManuGowda avatar Feb 18 '22 11:02 ManuGowda

@ManuGowda @przemerr I have tried it, and I can install the [email protected] package on M1 Mac with Node v12.21.0, but it still doesn't solve my problem😅.

I am writting a desktop application using Electron 12 and lisk-sdk on a M1 computer. Electron only supports M1 computers after v11+, and the minimum Node version of Electron 12 required is v14+, it's embarrassing. So can you guys help solve this problem and reissue a verson lisk-sdk pkg

EvanXzj avatar Feb 21 '22 03:02 EvanXzj

the SDK v5 is only compatible with node.js v12, regardless of M1 chip or OS. SDK v6 will be compatible with a higher version of node.js. So for now you probably need to run it in a VM environment with a lower electron version.

przemerr avatar Feb 21 '22 11:02 przemerr

Closing the issue. Following the instructions mentioned here, I was able to install the lisk-core CLI on a new M1 MacBook.

sameersubudhi avatar May 15 '23 09:05 sameersubudhi