Bug 15823

Summary: Installing nodejs modules with native extensions fails on first run
Product: buildroot Reporter: Marcus Hoffmann <marcus.hoffmann>
Component: OtherAssignee: Giulio Benetti <giulio.benetti>
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: 2023.08.2   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Marcus Hoffmann 2023-10-25 20:38:54 UTC
I'm building the the raspberrypi4_64_defconfig with the following changes/additions:

```
BR2_CCACHE=y
BR2_PACKAGE_NODEJS=y
BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL="serialport"
BR2_TARGET_ROOTFS_EXT2_SIZE="300M"
```


This fails during the first run with the following errors:
```
ERROR: architecture for "/usr/lib/node_modules/node-red-node-serialport/node_modules/@serialport/bindings-cpp/prebuilds/linux-arm/node.napi.armv6.node" is "ARM", should be "AArch64"
ERROR: architecture for "/usr/lib/node_modules/node-red-node-serialport/node_modules/@serialport/bindings-cpp/prebuilds/android-arm/node.napi.armv7.node" is "ARM", should be "AArch64"
ERROR: architecture for "/usr/lib/node_modules/node-red-node-serialport/node_modules/@serialport/bindings-cpp/prebuilds/linux-arm/node.napi.armv7.node" is "ARM", should be "AArch64"
ERROR: architecture for "/usr/lib/node_modules/node-red-node-serialport/node_modules/@serialport/bindings-cpp/prebuilds/linux-x64/node.napi.glibc.node" is "Advanced Micro Devices X86-64", should be "AArch64"
ERROR: architecture for "/usr/lib/node_modules/node-red-node-serialport/node_modules/@serialport/bindings-cpp/prebuilds/linux-x64/node.napi.musl.node" is "Advanced Micro Devices X86-64", should be "AArch64"
make[1]: *** [package/pkg-generic.mk:406: /home/marcus/repos/buildroot-upstream/output/build/nodejs-16.20.0/.stamp_installed] Error 1
```

On a second invocation of make, it then succeeds to build. I have not yet runtime testing if the serialport library actually works.

As discussed on IRC just now, there was a discussion about this issue on this patch already:

https://patchwork.ozlabs.org/project/buildroot/patch/20190531075800.7064-1-vcrini@gmail.com/
Comment 1 Marcus Hoffmann 2023-10-27 10:43:10 UTC
To clarify: this is happening on the 2023.08.2 release tag, i.e. fe50c054bce7fb9b2e073b9c1bc78dd8a187289a.
Comment 2 Giulio Benetti 2023-10-31 12:09:11 UTC
Hi Marcus,

can you please give a try to this [0] pending patch?

[0]: https://patchwork.ozlabs.org/project/buildroot/patch/20231031120713.678783-1-giulio.benetti@benettiengineering.com/

Thank you
Comment 3 Yann E. MORIN 2023-11-07 21:44:27 UTC
Marcus, All,

Thanks for the report. We believe it has now been fixed with commit:

    cbc5691ab298  package/nodejs/nodejs-src: fix arch check on additional modules

If you stil have issues, please open a new bug.

Regards,
Yann E. MORIN.