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

Can't install in node on linux/arm64 on Apple Silicon ARM64 M1 - because of missing binary #1413

Closed
gpetrov opened this issue Dec 18, 2020 · 22 comments

Comments

@gpetrov
Copy link

gpetrov commented Dec 18, 2020

Trying to install node-sqlite4 on linux/arm64 fails because of the missing precompiled binary.

#12 16.06 > [email protected] install /opt/node_app/node_modules/sqlite3
#12 16.06 > node-pre-gyp install --fallback-to-build
#12 16.06 
#12 16.21 node-pre-gyp WARN Using request for node-pre-gyp https download 
#12 16.66 node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-arm64.tar.gz 
#12 16.66 node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 
#12 16.83 gyp ERR! find Python 
#12 16.83 gyp ERR! find Python Python is not set from command line or npm configuration
#12 16.83 gyp ERR! find Python Python is not set from environment variable PYTHON
@flying-sausages
Copy link

yup.

I'm running Ubuntu 20.04 for ARM in parallels and I get this when installing apps referring to sqlite3

[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "react@^16.8.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@^16.8.0".
warning " > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > [email protected]" has incorrect peer dependency "semantic-release@>=11.0.0 <16.0.0".
[4/4] Building fresh packages...
[-/7] ⠐ waiting...
[2/7] ⠐ sharp
[3/7] ⠐ sqlite3
[-/7] ⠐ waiting...
error /opt/overseerr/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /opt/overseerr/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | arm64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/opt/overseerr/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-arm64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-arm64.tar.gz
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-arm64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-linux-arm64.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2"
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/opt/overseerr/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/overseerr/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/overseerr/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/12.20.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/12.20.0',
gyp info spawn args   '-Dnode_gyp_dir=/opt/overseerr/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/12.20.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/opt/overseerr/node_modules/sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/opt/overseerr/node_modules/sqlite3/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
/bin/sh: 1: python: not found
make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c] Error 127
make: Leaving directory '/opt/overseerr/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/overseerr/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-58-generic
gyp ERR! command "/usr/bin/node" "/opt/overseerr/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/opt/overseerr/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/opt/overseerr/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /opt/overseerr/node_modules/sqlite3
gyp ERR! node -v v12.20.0
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /opt/overseerr/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/opt/overseerr/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/opt/overseerr/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/overseerr/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.0-58-generic
node-pre-gyp ERR! command "/usr/bin/node" "/opt/overseerr/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /opt/overseerr/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.20.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok

@flying-sausages
Copy link

flying-sausages commented Jan 1, 2021

Looks like if you set the python variable before, you're able to build it from source just right. e.g.:

npm config set python "$(which python3)" # or whichever version you use

@BobbyWibowo
Copy link

This went back to needing python 2.x since the v5.0.1 update (relevant issue: #1415), but previously it indeed could be built with python 3.x, and in fact refused to build in python 2.x.
Or at least I've confirmed I couldn't build with python 3.6.x since the update, due to a python2-only syntax in the build script, being regarded as invalid in python3.

@gpetrov
Copy link
Author

gpetrov commented Mar 29, 2021

Can we please have a precompiled arm64 version of:

https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm64.tar.gz

just like the x64:

https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-x64.tar.gz

@TheDanielMoli
Copy link

Same issue here, a precompiled version would be useful!

@kirillgroshkov
Copy link

Meanwhile I've switched to this fork, which has it working: https://github.com/microsoft/vscode-node-sqlite3

@daniellockyer
Copy link
Member

This should now be fixed in sqlite3 v5.0.3 🙂

@gpetrov
Copy link
Author

gpetrov commented Apr 13, 2022

@daniellockyer I don't see any Arm64 binaries in the github release binaries of 5.0.3 .. Are those coming?
It will be great if there are binaries for linux arm7/8 and Mac (darwin) arm64

@daniellockyer
Copy link
Member

daniellockyer commented Apr 13, 2022

@gpetrov I'm working on updating #1362 so we can get Linux ARM builds, and I'm might have a solution to get Mac ones too 🙂 Watch this space ✨

@gpetrov
Copy link
Author

gpetrov commented Apr 13, 2022

Awesome @daniellockyer ! Maybe also separate Electron builds? Or should the current ones already work?

Very glad you picked up the project - was going on a dead end otherwise!

@TiE23
Copy link

TiE23 commented Apr 27, 2022

I just want to share that I solved my issue by doubly making sure XCode was fully installed on my new-ish M1 MBP and letting the installation script build the binary as its back-up.

(So, if anyone is still running into this issue please be sure XCode is installed and you've opened it at least once to be sure things are in a good initial state for your ARM Macbook).

But before that happened I suffered from a surprising 404 error. When I visited the release page and downloaded the file directly it worked fine. But if I plugged the URL for the tarball into my browser it would throw an error back at you. It appears that GitHub is blocking hot linking like we're back in the days of ImageShack or something.

If I attempted the naive fix of just placing my manually downloaded node_sqlite3.node file into node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/ directory the install process would still fail and (as an extra slap) delete the binary file.

See the "ERR!" line below:

[...]
error /Users/kyleg/git/flashtract-full-stack-code-challenge/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /Users/kyleg/git/flashtract-full-stack-code-challenge/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | arm64
node-pre-gyp info check checked for "/Users/kyleg/git/flashtract-full-stack-code-challenge/node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.5/napi-v6-darwin-unknown-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.5/napi-v6-darwin-unknown-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/TryGhost/node-sqlite3/releases/download/v5.0.5/napi-v6-darwin-unknown-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
[...]

@daniellockyer
Copy link
Member

@TiE23 We don't currently provide arm64 darwin binaries though 🤔

@TiE23
Copy link

TiE23 commented Apr 27, 2022

@TiE23 We don't currently provide arm64 darwin binaries though 🤔

Uhhhgggggg, yep. That says x64, not arm64. Gotta get my eyes checked.

My life as an ARM MacOS user continues to be a journey of embarrassments. Last month it was dealing with Docker fruitlessly trying to find arm64 images until I forced it to find x64 and run them through Rosetta.

Sorry about that.

@daniellockyer
Copy link
Member

No worries 😁 I'm working on prebuilt binaries for arm64 darwin but it needs some CI machines 🙂

@gpetrov
Copy link
Author

gpetrov commented Apr 27, 2022

@daniellockyer - you should really compile also arm64 images for Darwin (Mac). It is possible to compile those on intel easy with cross compilation.

Check some of the other projects that does that already, like: https://github.com/lovell/sharp-libvips/blob/main/.github/workflows/build-release.yml

How it is done: lovell/sharp-libvips#74

@daniellockyer
Copy link
Member

Very interesting 👀

@Peipi98
Copy link

Peipi98 commented May 6, 2022

Very interesting 👀

I have solved, and I could cry.
My problem was due to the name of one of the directories, which it contains a space.

For instance, my directory was named "Software Engineering", but renaming as "Software_Engineering" I can install sqlite3 perfectly. Jeez.

@gpetrov
Copy link
Author

gpetrov commented May 7, 2022

Yes I also noticed the space in the path problem and the failure due to not escaping. I think it is in one of the more global components node-gyp or the pre-build, can't recall

@gjsjohnmurray
Copy link

I think the cause of the build failure when the directory path contains spaces is nodejs/node-gyp#65 (over 10 years old!).

@daniellockyer
Copy link
Member

FYI v5.1.1 now comes with prebuilt Darwin ARM64 binaries 🙂 https://github.com/TryGhost/node-sqlite3/releases/tag/v5.1.1

@vinaciotm
Copy link

Looks like if you set the python variable before, you're able to build it from source just right. e.g.:

npm config set python "$(which python3)" # or whichever version you use

works for me

@ghacosta
Copy link

Looks like if you set the python variable before, you're able to build it from source just right. e.g.:

npm config set python "$(which python3)" # or whichever version you use

worked for me, even using node v18.12.1

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

No branches or pull requests