-
Notifications
You must be signed in to change notification settings - Fork 178
Description
Since 8.1.6, the build process has been changed to no longer build the ANGLE code from source, but to include the already built binaries/dynamic libraries (from a Chrome install?) in the repo. This simplifies and speeds up the build step, in addition to updating the project to use a non-severely-outdated version of ANGLE.
However, one side effect is that on macOS, these files –specifically libEGL.dylib and libGLESv2.dylib– when packaged up into the prebuild files –along with webgl.node– lead to the Node runtime crashing when webgl.node is loaded after the gl package's main method is run.
I've done some digging and here are the reproducible steps on macOS:
- in a fresh repo, install the gl package through npm:
npm install gl@9.0.0-rc.3 - start a node REPL (or create and run a script file) with
const gl = require("gl")(10, 10) - 💥
Note that the RC3 version is important as this one has macOS prebuilt binaries still included. RC4 has them disabled and RC2 and lower have missing files.
I managed to fix the prebuilt ANGLE files locally by navigating to node_modules/gl/build/Release and running codesign -f -s - libGLESv2.dylib and codesign -f -s - libEGL.dylib to re-codesign the packages (presumably with my local machine's toolchain and signing info – I'm not entirely sure). This results in the library behaving as intended. However, this is a local-only solution, and not suitable for distribution. Also note that simply removing the signature (via --remove-signature), if there is any, has no effect.
In the meantime, I've disabled prebuilt binaries for macOS, and instead opted to force installing macOS users to build from source. This might be an OK compromise as most devs are doing development on macOS (as opposed to deployment) and likely have the requisite build tools available.
Note: I have not tested the Linux or Windows prebuilds yet. The code signing issue may not affect Linux. I do not have a Windows machine to test with.