-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Module did not self-register only for Windows platform #2696
Comments
I figured out that on Windows you can only compile a node-gyp module using MSVC, while Go only supports compiling with GCC. I don't think you can load a non-MSVC module in Windows for a Node native module. Apparently, neither node-gyp wants to support GCC, and Go doesn't want to support MSVC, so I'm stuck in the middle I'm afraid. |
@StefanStojanovic Any ideas on this one or #2695? |
Unfortunately, I do not have any experience with this type of issue, but from what I saw here and in #2855 I have a suggestion - @tdewolff did you try using Node.js FFI and would that be feasible for your use case? |
This issue seems no longer relevant as it has been stale for a long time. If there are no objections, I will close this issue next Mon-Tue. In case something similar happens again please open a new issue. |
The problem is that Go only supports compiling with MingW, and node-gyp (or some third-party library) only supports compiling with Microsoft's compiler. Neither side budges so there isn't really a solution. I've given up on it at least, and you may close both issues if you wish. Thanks anyways! |
Can this be reproduced when NOT using the unmaintained |
I don't think I used |
Can you please rerun the GitHub Action error so we can see the output. The one in the run above has aged out. |
Yes, here is the new run: https://github.com/tdewolff/minify/actions/runs/8745650432/job/24001045387 Relevant part:
The error is really unhelpful, but I'm fairly sure this is due to using a MinW compiled archive while node-gyp seems to use MSVC. This would cause the symbols be mixed up (both compilers use a different naming scheme for their linker symbols) and thus doesn't load. I'm not sure why the linker allows them to be linked at all, shouldn't the linker throw an error? I'm not an expert though, but I've noticed this issue from 5 years back that might be relevant: #1240. Thanks a lot for looking into this @cclauss ! Your time is highly appreciated. |
Related but different from #2695
We have a Go library with JS bindings, see https://github.com/tdewolff/minify/tree/master/bindings/js which builds a Go library (using MingW) to a C archive, then we use that together with the C file to build the NAPI binary. I use GitHub actions to build on each platform, see https://github.com/tdewolff/minify/blob/master/.github/workflows/nodejs.yml.
The native addon builds and runs for Ubuntu and MacOS, but for Windows it keeps giving the error "Module did not self-register" at https://github.com/tdewolff/minify/runs/7293618101?check_suite_focus=true#step:6:94. Is there anyway to get a more specific error or debug message what is going on?
The Node and NPM version is the same which usually seems to cause this issue. Perhaps is using the MSVC compiler with GYP together with the MingW compiler for Go causing the problem. Since Go must use MingW, can I configure GYP to use MingW?
The text was updated successfully, but these errors were encountered: