I rebuild an Electron app with arch armv7l for Raspberry Pi. The build is executed on a Linux amd64 system, what used to work well. For newer Electron versions (30 at them moment) it fails due to enabled v8_enable_pointer_compression, which only is allowed for 64bit systems.
This leads to multiple errors like these:
error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures
error: right operand of shift expression ‘(1 << 32)’ is greater than or equal to the precision 32 of the left operand
The NodeJS header files contain a logic that sets this flag according to the given target architecture.
It seems that Electron-Packager and Electron-Rebuild have other architecture names ("armv7l") than NodeJS ("arm"). I call Electron-Packager with arch: ['armv7l']. Arch name arm ist not allowed here. For prebuild this seems to be converted:
So I think the issue can be solved if the same logic is applied for node-gyp. If someone confirms that this makes sense, I could create a PR.
Here are some workarounds but I don't know if they could cause problems when building other node modules, if that relies on arch to be named armv7l. They work for me:
Workaround 1
set env var npm_config_target_arch=arm
Workaround 2
Change architecture for the prebuild call if you are using Electron-Packager:
I rebuild an Electron app with arch armv7l for Raspberry Pi. The build is executed on a Linux amd64 system, what used to work well. For newer Electron versions (30 at them moment) it fails due to enabled
v8_enable_pointer_compression
, which only is allowed for 64bit systems.This leads to multiple errors like these:
The NodeJS header files contain a logic that sets this flag according to the given target architecture.
~/.electron-gyp/30.1.0/include/node/common.gypi:
It seems that Electron-Packager and Electron-Rebuild have other architecture names ("armv7l") than NodeJS ("arm"). I call Electron-Packager with
arch: ['armv7l']
. Arch namearm
ist not allowed here. For prebuild this seems to be converted:https://github.com/electron/rebuild/blob/a93581c57d7bf9f1408693fc40614ccc10f51488/src/module-type/prebuildify.ts#L10-L13
So I think the issue can be solved if the same logic is applied for node-gyp. If someone confirms that this makes sense, I could create a PR.
Here are some workarounds but I don't know if they could cause problems when building other node modules, if that relies on arch to be named
armv7l
. They work for me:Workaround 1
set env var
npm_config_target_arch=arm
Workaround 2
Change architecture for the prebuild call if you are using Electron-Packager: