node-3d / webgl-raub

OpenGL/WebGL for Node.js
https://github.com/node-3d/node-3d
MIT License
79 stars 12 forks source link

darwin-arm64.zip: 404, not found #23

Open trusktr opened 1 year ago

trusktr commented 1 year ago

Hello. Thanks again for this excellent work! I'm on a MacBook Air M2 these days, and when I run npm install in https://github.com/lume/glas, I now get this error:

npm ERR! code 255
npm ERR! path /Users/trusktr/src/lume+lume/packages/glas/node_modules/deps-opengl-raub
npm ERR! command failed
npm ERR! command sh -c -- node install
npm ERR! https://github.com/node-3d/deps-opengl-raub/releases/download/4.1.0/darwin-arm64.zip
npm ERR! Response status was 404

I'm guessing this isn't compiled for MacBook Air M2 architecture yet?

I thought I was able to install successfully before though.

trusktr commented 1 year ago

Update. Yep, I was able to install before! I've pinned my dependencies,

        "glfw-raub": "4.6.0",
        "webgl-raub": "2.2.4",

without the ^ and now I'm back in business. The newer releases are missing the binary.

trusktr commented 1 year ago

Ah, I'm not back in business. The npm install now works with the pinned versions, but this at least allows me to npm install locally in my super repo, and then the rest (f.e. tests) I can run on Linux CI.

Locally on M2 I get:

[Error] There was a problem loading [/Users/trusktr/src/lume+lume/packages/glas/as-pect.config.cjs].
Error: dlopen(/Users/trusktr/src/lume+lume/packages/glas/node_modules/segfault-raub/bin-osx/segfault.node, 0x0001):
tried: '/Users/trusktr/src/lume+lume/packages/glas/node_modules/segfault-raub/bin-osx/segfault.node'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/trusktr/src/lume+lume/packages/glas/node_modules/segfault-raub/bin-osx/segfault.node' (no such file),
'/Users/trusktr/src/lume+lume/packages/glas/node_modules/segfault-raub/bin-osx/segfault.node'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
    at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/trusktr/src/lume+lume/packages/glas/node_modules/segfault-raub/index.js:12:15)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/trusktr/src/lume+lume/packages/glas/node_modules/webgl-raub/core.js:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) {
  code: 'ERR_DLOPEN_FAILED'
}
Failed with exit code: 1

So it looks like the new version tries to fetch the actually-correct binary, which doesn't exist yet.

Can I help get this binary published for you, if you don't have this architecture to compile on? If so, I need some guidance on the steps. Open to a video call to make this easier?

raub commented 1 year ago

Hello. The older versions make no distinction between processor architectures, this is why you've been able to download the binaries, but those are the wrong binaries. I've started expanding the list of supported platforms recently, and that is why the latest version "knows" you need an ARM64 binary.

I'm currently working on segfault-raub package to try and put together a fully automated build action, along with Linux ARM64 support and the improved features. I was able to use a free Linux ARM64 machine from Oracle Cloud to host a GitHub Action runner. I wonder if there is a similar opportunity to host an OSX ARM runner, but Oracle Cloud seems to only have x86_64 (as GitHub also does). That would greatly help in establishing a robust multiplatform environment for future builds and other CI stuff.

Other than that, we may try to build the libraries on M2 manually for now. To do so, we'll also need to build some other third-party binaries (such as glew) and build other dependency modules (such as segfault-raub). Please let me know which module you want to fully build and use, so that I can infer all the dependencies and come up with a build plan. For example, if you only need webgl-raub, we will ignore image-raub and glfw-raub related binaries.

Then we can actually try to build the binaries in a video call. My local time is GMT+4, I think we could use Google Meet or Zoom, but I'm open to other suggestions.

trusktr commented 1 year ago

Hey, Google Meet should work fine. It would be sweet if GitHub Actions had ARM. So far I need only webgl-raub and glfw-raub, doing Document.setWebgl(webgl) then a few small custom polyfills/mocks as needed. I'm using it here for example:

https://github.com/lume/glas/blob/acde4d6b9d11a06f51aa358f1de762a7653685e7/as-pect.config.cjs#L11-L24

trusktr commented 1 year ago

Maybe this can help: https://github.com/uraimo/run-on-arch-action

raub commented 1 year ago

The run-on-arch-action is interesting but doesn't seem to provide any macOS images.

I think the hardest part is going to be building the M2 binaries here: https://github.com/node-3d/deps-opengl-raub. I'm going to also research the cross-compilation options, unsure if they exist on OSX. I'll follow up on cross-compilation research results.

trusktr commented 1 year ago

Hello Luis! Sounds good. Keep us posted. :) The project is on pause for now, because focused on a new TS-to-Wasm compile process, but will circle back once that's in good enough shape to resume running Wasm WebGL in Node.js.

raub commented 1 month ago

Hey @trusktr, I've just added the MacOS ARM build for version 4.2.0. Will it be possible for you to check if it indeed works?