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

node.addon is produced for wrong architecture, ignoring npm_config_arch #700

Open
gmorell opened this issue Jan 7, 2025 · 2 comments
Open
Labels

Comments

@gmorell
Copy link

gmorell commented Jan 7, 2025

Describe the bug A clear and concise description of what the bug is.

node.addon is produced for wrong architecture, ignoring npm_config_arch

Reproducing If possible, provide a list of commands or a code sample that
reproduces the bug that you are observing. Otherwise please describe as much as
possible in which circumstances the bug can be observed.

A yarn workspaces focus of a project with zeromq == "^6.1.2" on arm64/armhf will produce a node.addon for x8664, ignoring npm_config_arch.

Patching package.json to include the additional configuration for arm64/armhf does not change this situation.

Expected behavior A clear and concise description of what you expected to
happen.

The correct addon architecture is produced for the target system.

Tested on

  • OS: Debian
  • ZeroMQ.js version: 6.1.2
@gmorell gmorell added the bug label Jan 7, 2025
@rolljee
Copy link

rolljee commented Jan 14, 2025

I don't know if this is link

kuzzle-1         | Failed to load addon at /var/app/node_modules/zeromq/build/linux/arm64/node/127/addon.node: Error: [libc.musl-aarch64.so](http://libc.musl-aarch64.so/).1: cannot open shared object file: No such file or directory
kuzzle-1         | Error: [libc.musl-aarch64.so](http://libc.musl-aarch64.so/).1: cannot open shared object file: No such file or directory
kuzzle-1         |     at Module._extensions..node (node:internal/modules/cjs/loader:1586:18)
kuzzle-1         |     at Module.load (node:internal/modules/cjs/loader:1288:32)
kuzzle-1         |     at Module._load (node:internal/modules/cjs/loader:1104:12)
kuzzle-1         |     at Module.require (node:internal/modules/cjs/loader:1311:19)
kuzzle-1         |     at require (node:internal/modules/helpers:179:18)
kuzzle-1         |     at findAddon (/var/app/node_modules/zeromq/lib/load-addon.js:29:25)
kuzzle-1         |     at Object.<anonymous> (/var/app/node_modules/zeromq/lib/load-addon.js:50:15)
kuzzle-1         |     at Module._compile (node:internal/modules/cjs/loader:1469:14)
kuzzle-1         |     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
kuzzle-1         |     at Module.load (node:internal/modules/cjs/loader:1288:32)
kuzzle-1         |     at Module._load (node:internal/modules/cjs/loader:1104:12)
kuzzle-1         |     at Module.require (node:internal/modules/cjs/loader:1311:19)
kuzzle-1         |     at require (node:internal/modules/helpers:179:18)
kuzzle-1         |     at Object.<anonymous> (/var/app/node_modules/zeromq/lib/native.js:8:38)
kuzzle-1         |     at Module._compile (node:internal/modules/cjs/loader:1469:14)
kuzzle-1         |     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)

But i get an error about architecture as well.

I run this on a macos arm That build a docker image using node:22-bookworm-slim

I also got an error when building the project in CI -> https://github.com/kuzzleio/kuzzle/actions/runs/12674019449/job/35333641100#step:8:4357

In this case, the build is run on a ubuntu:24.04 (github action) and building against the image node:22-bookworm-slim

#54 853.7 npm error code 1
#54 853.7 npm error path /app/node_modules/zeromq
#54 853.7 npm error command failed
#54 853.7 npm error command sh -c node ./script/install.js
#54 853.7 npm error Building addon node via cmake-ts (requires cmake, ninja, and the vcpkg dependencies)
#54 853.7 npm error --------------------------------------------------
#54 853.7 npm error       WARNING: Building only for the current runtime.
#54 853.7 npm error       WARNING: DO NOT SHIP THE RESULTING PACKAGE
#54 853.7 npm error      --------------------------------------------------
#54 853.7 npm error Error: Failed to load zeromq.js addon.node: Error: ENOENT: no such file or directory, scandir '/app/node_modules/zeromq/build/linux/arm/node'
#54 853.7 npm error Error: ENOENT: no such file or directory, scandir '/app/node_modules/zeromq/build/linux/arm/node'
#54 853.7 npm error     at Object.readdirSync (node:fs:1506:26)
#54 853.7 npm error     at findAddon (/app/node_modules/zeromq/lib/load-addon.js:22:43)
#54 853.7 npm error     at Object.<anonymous> (/app/node_modules/zeromq/lib/load-addon.js:50:15)
#54 853.7 npm error     at Module._compile (node:internal/modules/cjs/loader:1469:14)
#54 853.7 npm error     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
#54 853.7 npm error     at Module.load (node:internal/modules/cjs/loader:1288:32)
#54 853.7 npm error     at Module._load (node:internal/modules/cjs/loader:1104:12)
#54 853.7 npm error     at Module.require (node:internal/modules/cjs/loader:1311:19)
#54 853.7 npm error     at require (node:internal/modules/helpers:179:18)
#54 853.7 npm error     at main (/app/node_modules/zeromq/script/install.js:26:7)
#54 853.7 npm error     at findAddon (/app/node_modules/zeromq/lib/load-addon.js:43:15)
#54 853.7 npm error     at Object.<anonymous> (/app/node_modules/zeromq/lib/load-addon.js:50:15)
#54 853.7 npm error     at Module._compile (node:internal/modules/cjs/loader:1469:14)
#54 853.7 npm error     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
#54 853.7 npm error     at Module.load (node:internal/modules/cjs/loader:1288:32)
#54 853.7 npm error     at Module._load (node:internal/modules/cjs/loader:1104:12)
#54 853.7 npm error     at Module.require (node:internal/modules/cjs/loader:1311:19)
#54 853.7 npm error     at require (node:internal/modules/helpers:179:18)
#54 853.7 npm error     at main (/app/node_modules/zeromq/script/install.js:26:7)
#54 853.7 npm error     at Object.<anonymous> (/app/node_modules/zeromq/script/install.js:34:1)
#54 853.7 npm error 'os' was missing in the 'configurations'. Defaulting to the current operating system linux
#54 853.7 npm error 'arch' was missing in the 'configurations'. Defaulting to the current architecture arm
#54 853.7 npm error `runtime` was missing in the `configurations`. Defaulting to `node`
#54 853.7 npm error 'runtimeVersion' was missing in the 'configurations'. Defaulting to the current runtimeVersion 20.18.1
#54 853.7 npm error cmake binary not found, try to specify 'cmakeToUse'
#54 853.7 npm error node:child_process:930
#54 853.7 npm error     throw err;
#54 853.7 npm error     ^
#54 853.7 npm error
#54 853.7 npm error Error: Command failed: /usr/local/bin/node /app/node_modules/@aminya/cmake-ts/build/main.js nativeonly
#54 853.7 npm error     at genericNodeError (node:internal/errors:984:15)
#54 853.7 npm error     at wrappedFn (node:internal/errors:538:14)
#54 853.7 npm error     at checkExecSyncError (node:child_process:891:11)
#54 853.7 npm error     at Object.execFileSync (node:child_process:927:15)
#54 853.7 npm error     at cmakeTs (/app/node_modules/zeromq/script/install.js:10:6)
#54 853.7 npm error     at main (/app/node_modules/zeromq/script/install.js:29:7)
#54 853.7 npm error     at Object.<anonymous> (/app/node_modules/zeromq/script/install.js:34:1)
#54 853.7 npm error     at Module._compile (node:internal/modules/cjs/loader:1469:14)
#54 853.7 npm error     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
#54 853.7 npm error     at Module.load (node:internal/modules/cjs/loader:1288:32) {
#54 853.7 npm error   status: 1,
#54 853.7 npm error   signal: null,
#54 853.7 npm error   output: [ null, null, null ],
#54 853.7 npm error   pid: 5333,
#54 853.7 npm error   stdout: null,
#54 853.7 npm error   stderr: null
#54 853.7 npm error }
#54 853.7 npm error
#54 853.7 npm error Node.js v20.18.1
#54 853.7 npm notice
#54 853.7 npm notice New major version of npm available! 10.8.2 -> 11.0.0
#54 853.7 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
#54 853.7 npm notice To update run: npm install -g [email protected]
#54 853.7 npm notice
#54 853.7 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-01-08T19_36_26_050Z-debug-0.log
#54 ERROR: process "/bin/sh -c npm ci" did not complete successfully: exit code: 1

@aminya
Copy link
Member

aminya commented Jan 14, 2025

Linux Arm64 is already supported as of 6.3.0. The prebuilds are provided and built inside Qemu/Docker. You won't need to build from the source.
https://github.com/zeromq/zeromq.js/releases/tag/v6.3.0

See the build directory under linux/arm64
https://www.npmjs.com/package/zeromq?activeTab=code

Here's the CI config:

- name: Build Linux Arm64

Regardless, I've added some fixes for cross-compilation in #693 targeted for Windows Arm64. Next, we can try other cross-compilations for other architectures.

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

No branches or pull requests

3 participants