m4heshd / better-sqlite3-multiple-ciphers

better-sqlite3 with multiple-cipher encryption support 🔒
MIT License
140 stars 27 forks source link

Apple Silicon #6

Closed Christilut closed 2 years ago

Christilut commented 2 years ago

Hi again!

Just tried the package on a production build for an Apple M1 processor but I get the following error:

Error: dlopen(/Users/chris/workspace/app/out/App-darwin-arm64/App.app/Contents/Resources/node_modules/better-sqlite3-multiple-ciphers/build/Release/better_sqlite3.node, 0x0001): 
tried: '/Users/chris/workspace/app/out/App-darwin-arm64/App.app/Contents/Resources/node_modules/better-sqlite3-multiple-ciphers/build/Release/better_sqlite3.node' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/better_sqlite3.node' (no such file)

Is the arm64 binary missing? Or did I miss a rebuild step? Maybe I can help if you don't have an appropriate build machine?

m4heshd commented 2 years ago

Did you also package it on an M1? Or have you packaged it on a different device and tried it on the M1?

Christilut commented 2 years ago

I packaged it on an M1. The resulting App.app/Contents/MacOS/App is arm64

The only thing I can think of is that my node/npm is running under Rosetta2 and the result of the rebuild is x64.

If you're saying this package works with M1 then I suspect it is most likely the above, and I'll do more digging there.

m4heshd commented 2 years ago

my node/npm is running under Rosetta2

That's the issue right there. node-gyp then assumes that your native arch to be x86_64.

If you're saying this package works with M1

Prebuilds aren't available for arm64e since no CI provides M1 based containers but there shouldn't be a problem building from the source if you have all necessary tools and libraries ready.

Christilut commented 2 years ago

Alright, thanks for the confirmation! :)