Reon90 / glfwJS

The N-API bindings for GLFW
MIT License
49 stars 6 forks source link

Cannot use on M1 Macs #5

Open eagerestwolf opened 3 years ago

eagerestwolf commented 3 years ago

Minor issue, but since the library is hardcoded to use the prebuilt libraries, I feel that I should raise this issue. If a user on an M1 Mac downloads this package because there is no arm64 binary included, node-gyp nukes the build directory and starts from scratch. As a result of this, when the package tries to pull the prebuilt binary it fails because the prebuilt binary doesn't exist because node-gyp never creates the darwin folder (for whatever reason). This is the resulting directory structure on an M1 Mac.

Screen Shot 2021-03-07 at 9 47 23 PM

I'm not entirely sure how this could be handled...unless I were to send you my arm64 compiled node file and you could create say a darwin-arm64 folder...I'm not very good with native addons.

It should be noted, this was the result whether I installed the library directly from NPM, or from the master branch.

Reon90 commented 3 years ago

@eagerestwolf yeah, it's true, could you make PR or send me your compiled folder? Also could you print it from your terminal node -e 'console.log(process.platform)' ?

eagerestwolf commented 3 years ago

Sorry, been busy with my day job. Anyhow, my process.platform still reports as Darwin. The issue is process.arch reports as arm64 not x86_64, so that's why node-gyp wants to build a package resulting in the incorrect directory structure. Currently, as far as I am aware node-gyp doesn't provide a way to specify an output directory (although I'm not an expert), but one of the sqlite libraries copies binaries after they've been built [link], maybe that would be of help here?

Screen Shot 2021-03-24 at 8 47 45 PM
eagerestwolf commented 3 years ago

In the meantime, here is my build artifacts if they are of help.

Release.zip