PeculiarVentures / pkcs11js

A Node.js implementation of the PKCS#11 2.40 interface
MIT License
111 stars 33 forks source link

Can't support mac m1 arm64 cpu #89

Closed Jinwei1987 closed 2 years ago

Jinwei1987 commented 2 years ago

when loading softhsm lib on arm64 mac, there is an error: dlopen(/opt/homebrew/Cellar/softhsm/2.6.1/lib/softhsm/libsofthsm2.so, 0x0006): tried: '/opt/homebrew/Cellar/softhsm/2.6.1/lib/softhsm/libsofthsm2.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/libsofthsm2.so' (no such file), '/usr/lib/libsofthsm2.so' (no such file)

microshine commented 2 years ago

@Jinwei1987 Does SoftHSM works fine on your computer? What is your NodeJS architecture?

As I can see the problem is in architecture difference for pkcs11js lib and softhsm lib. Maybe you need to install SoftHSM with the same architecture that NodeJS use or reinstall NodeJS and rebuild native modules

Jinwei1987 commented 2 years ago

@microshine I install SoftHSM via brew, and from the error SoftHSM looks correct, which is arm64 architecture. In terms of node, I use 14.18.3, from the official website I don't see it distinguish x86 from arm64 for package installation.

Jinwei1987 commented 2 years ago

@microshine I have got the problem solved with node 16.13.2. Looks like it is some compatible issue with old version of nodejs.