Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binaries for better_sqlite.node and crsqlite.dylib on arm64 architecture #25

Open
Sheraff opened this issue Nov 25, 2023 · 4 comments
Open

Comments

@Sheraff
Copy link

Sheraff commented Nov 25, 2023

Trying to start the project in a very naive manner, just pnpm i and pnpm dev did not start sqlite. I got the following error

Error: dlopen(/Users/Flo/GitHub/vulcan-test/node_modules/.pnpm/better-sqlite3@8.6.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node, 0x0001): 
  tried: 
    '[repo]/node_modules/.pnpm/better-sqlite3@8.6.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node' 
      (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), 
    '/System/Volumes/Preboot/Cryptexes/OS/[repo]/node_modules/.pnpm/better-sqlite3@8.6.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node' 
      (no such file), 
    '[repo]/node_modules/.pnpm/better-sqlite3@8.6.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node' 
      (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

I managed to bypass this issue by manually downloading the arm64 binary from https://github.com/WiseLibs/better-sqlite3/releases and replacing it inside [repo]/node_modules/.pnpm/better-sqlite3@8.6.0/node_modules/better-sqlite3/build/Release/better_sqlite.node.

I then had a very similar issue for crsqlite.dylib so I downloaded crsqlite-darwin-aarch64.dylib and replaced it inside [repo]/node_modules/.pnpm/@vlcn.io+crsqlite@0.15.1/node_modules/@vlcn.io/crsqlite/dist/crsqlite.dylib


I'm not used to working with node modules that download binaries (or maybe I am and I just never noticed). Is there a way to make it so that the correct architecture is automatically downloaded?

@tantaman
Copy link
Contributor

It tries to detect and download the correct binary during installation here:

https://github.com/vlcn-io/cr-sqlite/blob/0a38408bf2f8c32c6950120da4dbb70b131d8d9c/core/nodejs-install-helper.js#L44-L51

It must not have correctly detected the host architecture.

What sort of machine and os are you on?

@Sheraff
Copy link
Author

Sheraff commented Nov 27, 2023

I'm on macbook M3, macos sonoma, node 20. I can retry an install, or give you other stats if that helps. I really want to build stuff with crsqlite!

@tantaman
Copy link
Contributor

Can you try scaffolding a new project and share the output?

The script command is useful for this.

> script my-session
> do you stuff...
> Ctrl+d

and it'll create a text file called my-session with the input and output of your terminal session.

@Sheraff
Copy link
Author

Sheraff commented Nov 28, 2023

Hmmm... it worked this time... And as far as I can tell I didn't do anything different (I tried installing from the native terminal, and from vscode's since I know it doesn't open the same user profile). I'll keep you posted if I encounter this again. Issue can probably be closed in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants