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

ARM version not detected for 32-bit arm versions #89

Open
paulober opened this issue Nov 9, 2022 · 3 comments
Open

ARM version not detected for 32-bit arm versions #89

paulober opened this issue Nov 9, 2022 · 3 comments

Comments

@paulober
Copy link

paulober commented Nov 9, 2022

SerialPort Bindings Version

10.7.0

Node Version

16.15.0

Electron Version

19.0.12

Platform

Linux raspberrypi 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux

Architecture

ARM

Hardware or chipset of serialport

Etc

What steps will reproduce the bug?

Run a VSCode extension with serialport on a raspberry pi with the 32-bit Raspberry Pi OS.

What happens?

At runtime node-gyp-build gets "default" as the value for "armv". But actually the armv on a 32-bit Raspberry Pi 4b is 7. So the result is that it compares 6 and 7 (the two prebuild arm version) agains "default" which will of course fail! The reason for that is following line https://github.com/prebuild/node-gyp-build/blob/0078d7884dfeb0e708477b3e20bfc4f520c1e2f8/index.js#L16

var vars = (process.config && process.config.variables) || {}
.
.
.
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || ''

What should have happened?

That the arm version is correctly detected so it can detect which prebuild is the right.

Additional information

You either have to set process.env.ARM_VERSION or ensure that process.config.variables.arm_version get overwritten to "default".

@paulober
Copy link
Author

paulober commented Nov 9, 2022

I think that serialport or one of its dependency does somewhere overwrite the process.config.variables.arm_version with "default" as the normal nodejs install on this system shows "7" for process.config.variables which is correct. Or maybe VSCode or electron does overwrite it.

@paulober
Copy link
Author

paulober commented Nov 9, 2022

My current patch is to replace the var armv line in node-gyp-build with following:

// ARMv7 detection patched to avoid arm_version === "default" on other arm systems than arm64 ones
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : (arch === 'arm' ? (vars.arm_version === 'default' ? '7' : vars.arm_version) : '')) || ''

This defaults to armv7 for arm systems where the arm_version has been overwritten to "default".

Note that's not a node-gyp-build bug as it functions perfectly well if the global process.config.variables.arm_version variable would not be overwritten with "default".

@reconbot
Copy link
Member

It's not something serialport does directly.

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

No branches or pull requests

2 participants