Skip to content

Install of 5.0.9 fails to run on Alpine ("_ZSt28__throw_bad_array_new_lengthv: symbol not found") #1625

New issue

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

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

Already on GitHub? # to your account

Closed
tianon opened this issue Jul 20, 2022 · 6 comments · Fixed by #1626
Assignees

Comments

@tianon
Copy link

tianon commented Jul 20, 2022

Issue Summary

When installing on Alpine, the module installs correctly but then fails at runtime.

Relevant logs or output

$ docker run -it --rm --pull=always node:16-alpine3.15 sh
16-alpine3.15: Pulling from library/node
Digest: sha256:3cc4a16286bc01e141dcfec735f3ebfaf8bdb6ab7ff216f9a7073bd08cee1fa7
Status: Image is up to date for node:16-alpine3.15
/ # node --version
v16.16.0
/ # npm --version
8.11.0
/ # npm install -g sqlite3
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

added 104 packages, and audited 105 packages in 10s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 8.11.0 -> 8.14.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.14.0
npm notice Run npm install -g npm@8.14.0 to update!
npm notice 
/ # npm info sqlite3

sqlite3@5.0.9 | BSD-3-Clause | deps: 4 | versions: 92
Asynchronous, non-blocking SQLite3 bindings
https://github.com/TryGhost/node-sqlite3

keywords: sql, sqlite, sqlite3, database

dist
.tarball: https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.9.tgz
.shasum: 421b9c065480f1c589f89cabd6d0ea9575a69855
.integrity: sha512-e2lEKevUF65UJu4IIuuFytgW7yNMkmCkfyn66jXWeb7OcdHvRo7nXhF+IQ25iW6x2grB0DyKdGCpx8Rd8EkA2Q==
.unpackedSize: 3.2 MB

dependencies:
@mapbox/node-pre-gyp: ^1.0.0 node-addon-api: ^4.2.0       node-gyp: 8.x                tar: ^6.1.11                 

maintainers:
- springmeyer <dane.springmeyer@gmail.com>
- kkaefer <mail@kkaefer.com>
- tmcw <tom@macwright.com>
- erisds <github.erisds@gmail.com>
- yhahn <young@mapbox.com>
- mapsam <sam@mapbox.com>
- zmully <mully@mapbox.com>
- kewde_ <kewde@particl.io>
- daniellockyer <hi@daniellockyer.com>

dist-tags:
alpha: 3.1.10-alpha  latest: 5.0.9        

published 6 days ago by daniellockyer <hi@daniellockyer.com>
/var/lib/ghost # node -p 'require("sqlite3")'
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Error relocating /var/lib/ghost/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/var/lib/ghost/node_modules/sqlite3/lib/sqlite3-binding.js:4:17)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Version

5.0.9

Node.js Version

16.16.0

How did you install the library?

npm install sqlite3, yarn add sqlite3; Linux, x86_64, Alpine 3.15 (specifically, failing to update https://github.com/docker-library/ghost to Ghost 5.4.1; docker-library/ghost#320)

@tianon
Copy link
Author

tianon commented Jul 20, 2022

Interestingly, this appears to work successfully on Alpine 3.16, so I suppose this is perhaps a problem of Node's pre-built modules support not being specific enough about musl version or something like that?

@tianon
Copy link
Author

tianon commented Jul 20, 2022

Can confirm -- updating to Alpine 3.16 fixed the issue for my specific need, so I'm 100% OK with this being closed, but I'll let maintainers here make the determination of whether this is still useful to chase further for use cases outside mine. 😄 ❤️

@daniellockyer
Copy link
Member

daniellockyer commented Jul 22, 2022

I wonder if it would resolve if I targeted a specific Alpine version in our binary building script 🤔 I'll give it a go next week and if it works, I'll release a new version to restore compatibility.

@daniellockyer daniellockyer self-assigned this Jul 22, 2022
daniellockyer added a commit that referenced this issue Jul 24, 2022
fixes #1625

- Alpine 3.16 was released in May 2022 and 5.0.9 was the first release
  since it became the default for `node16-alpine`
- compiling on Alpine 3.16 broke compatiblity for Alpine 3.15
- given we should be able to just build with 3.15 and the binaries end
  up forward-compatible, this commit reverts back to that
daniellockyer added a commit that referenced this issue Jul 24, 2022
fixes #1625

- Alpine 3.16 was released in May 2022 and 5.0.9 was the first release
  since it became the default for `node16-alpine`
- compiling on Alpine 3.16 broke compatiblity for Alpine 3.15
- given we should be able to just build with 3.15 and the binaries end
  up forward-compatible, this commit reverts back to that
@daniellockyer
Copy link
Member

The issue should be fixed in master - I'll do a release this week 🙂

@daniellockyer
Copy link
Member

Released in v5.0.11 🙂

@tianon
Copy link
Author

tianon commented Aug 1, 2022

Confirmed working in both Alpine 3.15 and 3.16! Thanks! 😄

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

Successfully merging a pull request may close this issue.

2 participants