stackgl / headless-gl

🎃 Windowless WebGL for node.js
1.73k stars 166 forks source link

macOS v6.0.2 prebuilt binary for `arm64` Node v14 is actually `x86_64` #256

Closed stepankuzmin closed 1 year ago

stepankuzmin commented 1 year ago

It seems like the gl-v6.0.2-node-v83-darwin-arm64.tar.gz prebuilt binary is the same as gl-v6.0.2-node-v83-darwin-x64.tar.gz

$ node -p "process.arch"
arm64

$ git clone --branch v6.0.2 https://github.com/stackgl/headless-gl.git
$ cd headless-gl
$ rm -rf ~/.npm/_prebuilds/
$ npx prebuild-install --verbose --debug

npx: installed 37 in 2.762s
prebuild-install info begin Prebuild-install version 7.1.1
prebuild-install info looking for local prebuild @ prebuilds/gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install info looking for cached prebuild @ ~/.npm/_prebuilds/e950fb-gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install http request GET https://github.com/stackgl/headless-gl/releases/download/v6.0.2/gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install http 200 https://github.com/stackgl/headless-gl/releases/download/v6.0.2/gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install info downloading to @ ~/.npm/_prebuilds/e950fb-gl-v6.0.2-node-v83-darwin-arm64.tar.gz.3503-0e9fb9bfd0ba7.tmp
prebuild-install info renaming to @ ~/.npm/_prebuilds/e950fb-gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install info unpacking @ ~/.npm/_prebuilds/e950fb-gl-v6.0.2-node-v83-darwin-arm64.tar.gz
prebuild-install info unpack resolved to ~/Code/headless-gl/build/Release/webgl.node
prebuild-install warn install dlopen(~/Code/headless-gl/build/Release/webgl.node, 0x0001): tried: '~/Code/headless-gl/build/Release/webgl.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

Both libs have the same cputype 16777223 / 0x1000007, which is the identifier for x86_64 https://developer.apple.com/documentation/foundation/1495005-mach-o_architecture/nsbundleexecutablearchitecturex86_64

$ otool -h arm64/Release/webgl.node
arm64/Release/webgl.node:
Mach header
      magic  cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedfacf 16777223          3  0x00           8    21       3368 0x00018085

$ otool -h x64/Release/webgl.node
x64/Release/webgl.node:
Mach header
      magic  cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedfacf 16777223          3  0x00           8    21       3368 0x00018085
dhritzkiv commented 1 year ago

Yes, it looks like the darwin-arm64 binary is the same as the darwin-x64 one. Curious how that could happen, as it was part of an automated build.

Thanks for flagging this. I've removed the prebuilt binary in the meantime, and will look into re-uploading a new one, possibly for a new build in the near future.

Are you able to build from source OK?

stepankuzmin commented 1 year ago

Yep, I'm building from the source atm. Thanks!