[Buildroot] [PATCH] package/nodejs/nodejs-src: remove .node files with different architecture

Giulio Benetti giulio.benetti at benettiengineering.com
Thu Nov 2 23:43:55 UTC 2023


On 03/11/23 00:16, Giulio Benetti wrote:

[ SNIP ]

>> There's also binding.gyp that looks like it lists what to build under
>> which condition.
> 
> yes, .gyp file is another build system, same Mozilla adopted for 
> NSS(maybe something else):
> https://gyp.gsrc.io/index.md
> 
> But NodeJS seems to deal with it without the need to add a gyp infra.

yes it does have node-gyp that deals with that fortunately,

>> In which case, how does npm decide that it can use one such prebuild, or
>> whether it should compile from the source files? Can we force it to
>> never use prebuilds and always compile?
> 
> I'm working on this after your review,
> 
>> I'm afraid the proposed patch just covers up a bigger issue by sweeping
>> the dust under the rug... It will indeed make check-bin-arch happy
>> because no binary will indeed match another arch, indeed, but that does
>> not mean the module will be actually correctly installed...
> 
> exactly,
> 
>> So yes, npm is such a mess that maybe sweeping the dust under the rug is
>> the only solution we can implement, but it is disappointing...
> 
> I think it's not the way to go because of libc, that changes everything,
> 
>> Maybe we can just also exclude the node modules from check-bin-arch
>> altogether and be done with it:
>>
>>      NODEJS_SRC_BIN_ARCH_EXCLUDE = /usr/lib/node_modules/
> 
> This ^^^ doesn't fix the libc problem. If you nm:
> target/usr/lib/node_modules/serialport/bindings-cpp/build/Release/bindings.node
> 
> you will see that NodeJS assume native code to be built with glibc, so
> I really need to go with building from scratch. And this works using:
> npm rebuild ...

Still not, I'm using:
npm pack ....
to download the tarball that only contains the module but not its
dependencies, so I need to extract and retrieve all the dependencies
including "@serialport/bindings-cpp" that must be natively built and
it contains the prebuilt binaries, so I will have to deal with
installation of the single os-arch directory.

Not an easy task, but I'll take care.

Best regards
-- 
Giulio Benetti
CEO&CTO at Benetti Engineering sas



More information about the buildroot mailing list