napi-rs / node-rs

Node.js bindings ❤️ Rust crates
https://node-rs.dev
MIT License
1.12k stars 32 forks source link

Any chance of a ARMv6 build of the Bcrypt node? #854

Open hardillb opened 3 months ago

hardillb commented 3 months ago

Running on a Raspberry Pi Zero W with NodeJS v20.0 throws an Illegal Instruction error because the node pulls in the ARMv7 native binary and there is no source code to do a npm rebuild

Would it be possible to add a ARMv6 build?

If not could you update at least update the README to be explicit that the Linux arm gnu (glibc 2.17) is specifically ARMv7.

p.s. the support matrix could probably do with an update as NodeJS v12, v14 are very much EoL and v16 as well.

gdb /usr/bin/node ./core
GNU gdb (Raspbian 13.1-3) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/node...
[New LWP 2265]
[New LWP 2269]
[New LWP 2270]
[New LWP 2271]
[New LWP 2268]
[New LWP 2267]
[New LWP 2266]
--Type <RET> for more, q to quit, c to continue without paging--c
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `node /usr/bin/node-red'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0xb412a764 in ?? ()
   from /usr/lib/node_modules/node-red/node_modules/@node-rs/bcrypt-linux-arm-gnueabihf/bcrypt.linux-arm-gnueabihf.node
[Current thread is 1 (Thread 0xb6f43780 (LWP 2265))]
Brooooooklyn commented 3 months ago

@hardillb does wasm version help? You can use the wasm version by install the wasm dependencies:npm install --cpu=wasm32

hardillb commented 3 months ago

@Brooooooklyn That runs on a ARMv6 machine, but I'm not sure it helps in the long run.

How would I specify that when installing as part of a larger project that has to support multiple cpu architectures. e.g.

{
    "name": "node-red",
    "version": "4.0.2",
    "description": "Low-code programming for event-driven applications",
    "homepage": "https://nodered.org",
    "license": "Apache-2.0",
    "repository": {
        "type": "git",
        "url": "https://github.com/node-red/node-red.git"
    },
    "main": "lib/red.js",
    "scripts": {
        "start": "node red.js"
    },
    "bin": {
        "node-red": "./red.js",
        "node-red-pi": "bin/node-red-pi"
    },
    "contributors": [
        {
            "name": "Nick O'Leary"
        },
        {
            "name": "Dave Conway-Jones"
        }
    ],
    "keywords": [
        "editor",
        "messaging",
        "iot",
        "flow"
    ],
    "dependencies": {
        "@node-red/editor-api": "4.0.2",
        "@node-red/nodes": "4.0.2",
        "@node-red/runtime": "4.0.2",
        "@node-red/util": "4.0.2",
        "basic-auth": "2.0.1",
        "bcryptjs": "2.4.3",
        "cors": "2.8.5",
        "express": "4.19.2",
        "fs-extra": "11.2.0",
        "node-red-admin": "^4.0.0",
        "nopt": "5.0.0",
        "semver": "7.5.4"
    },
    "optionalDependencies": {
        "@node-rs/bcrypt": "^1.10.4"
    },
    "engines": {
        "node": ">=18.5"
    }
}

@node-rs/bcrypt is already optional, but it pulls in the ARMv7 build even on a ARMv6 machine

Brooooooklyn commented 3 months ago

but it pulls in the ARMv7 build even on a ARMv6 machine

I think it's because the Node.js doesn't distinguish between ARMv7 and ARMv6...