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

error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures #45

Open
qistoph opened this issue Jan 20, 2022 · 3 comments

Comments

@qistoph
Copy link

qistoph commented Jan 20, 2022

Building with [email protected] fails with:
error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures

Any suggestions on how to fix this?

Below is the full log.

⠋ Building module: epoll, Completed: 0In file included from /home/pi/.electron-gyp/16.0.5/include/node/v8-local-handle.h:12,
                 from /home/pi/.electron-gyp/16.0.5/include/node/v8-array-buffer.h:12,
                 from /home/pi/.electron-gyp/16.0.5/include/node/v8.h:25,
                 from ../src/epoll.cc:11:
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:113:27: error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures
     kApiSystemPointerSize == kApiInt64Size,
     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:471:71: warning: left shift count >= width of type [-Wshift-count-overflow]
   static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;
                                                                       ^~
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:471:68: error: right operand of shift expression ‘(1 << 32)’ is >= than the precision of the left operand [-fpermissive]
   static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;
                                                          ~~~~~~~~~~^~~~~
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:472:69: warning: left shift count >= width of type [-Wshift-count-overflow]
   static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
                                                                     ^~
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:472:66: error: right operand of shift expression ‘(1 << 32)’ is >= than the precision of the left operand [-fpermissive]
   static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
                                                        ~~~~~~~~~~^~~~~
⠧ Building module: epoll, Completed: 0make: *** [epoll.target.mk:125: Release/obj.target/epoll/src/epoll.o] Error 1
make: Leaving directory '/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build'
✖ Rebuild Failed
@qistoph qistoph changed the title rror: static assertion failed: Pointer compression can be enabled only for 64-bit architectures error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures Jan 20, 2022
@qistoph
Copy link
Author

qistoph commented Jan 20, 2022

Running npm install in the epoll dir works correctly:

~/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll $ npm install
~/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll $ grep -r compression
build/config.gypi:    "v8_enable_pointer_compression": 0,

However it seems that using electron-rebuild breaks the pointer compression:

~/MagicMirror/modules/MMM-PIR-Sensor $ node_modules/.bin/electron-rebuild -e ../../node_modules/electron
[...]
/home/pi/.electron-gyp/16.0.5/include/node/v8-internal.h:113:27: error: static assertion failed: Pointer compression can be enabled only for 64-bit architectures
     kApiSystemPointerSize == kApiInt64Size,
[...]
~/MagicMirror/modules/MMM-PIR-Sensor $ grep -r compression node_modules/epoll/
node_modules/epoll/build/config.gypi:    "v8_enable_pointer_compression": 1,

@fivdi
Copy link
Owner

fivdi commented Jan 20, 2022

What version of Electron are you using?

I haven't used Electron myself but to the best of my knowledge, native modules such as epoll that are not "Context Aware" will not work with Electrom 14 or higher. See electron/electron#18397.

@qistoph
Copy link
Author

qistoph commented Jan 21, 2022

~/MagicMirror/modules/MMM-PIR-Sensor $ DEBUG="electron-rebuild" ./node_modules/.bin/electron-rebuild -e ../../node_modules/electron
⠋ Searching dependency tree  electron-rebuild rebuilding with args: [Arguments] {
  '0': {
    buildPath: '/home/pi/MagicMirror/modules/MMM-PIR-Sensor',
    electronVersion: '16.0.5',
    arch: 'arm',
    extraModules: [],
    onlyModules: null,
    force: undefined,
    headerURL: undefined,
    types: [ 'prod', 'optional' ],
    mode: undefined,
    debug: undefined,
    prebuildTagPrefix: 'v',
    forceABI: undefined,
    useElectronClang: false,
    disablePreGypCopy: false,
    projectRootPath: '/home/pi/MagicMirror/modules/MMM-PIR-Sensor'
  }
} +0ms

I managed to find a work around, but don't understand enough of gyp to comprehend a proper fix.

I've found that ~/.electron-gyp/16.0.5/include/node/common.gypi contains rules to set v8_enable_pointer_compression: 1 only if target_arch is arm64 or x64. Which shouldn't be the case, since I'm running this on arm.

Setting v8_enable_pointer_compression: 0 in node_modules/node-gyp/addon.gypi's variables does get my electron-rebuild run.

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

No branches or pull requests

2 participants