Skip to content
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

Link with static library generated by GCC on Windows #2855

Closed
tdewolff opened this issue May 23, 2023 · 1 comment
Closed

Link with static library generated by GCC on Windows #2855

tdewolff opened this issue May 23, 2023 · 1 comment
Labels

Comments

@tdewolff
Copy link

tdewolff commented May 23, 2023

I'm using node-gyp to create prebuilt binaries for all platforms using the GitHub Actions CI. The library is a native addon using Go. The Go code (library.go) and the accompanying C interface (library.c) are first compiled using Go/CGO (which uses GCC) to a static C library (library.a). Go only support GCC and not MSVC so I don't have much choice, but at least it's not C++.

Next I try to build the node-gyp library by linking against the library.a, which is using the MSVC toolchain (again, not much choice here). It builds fine, but upon using the library I get: Error: Module did not self-register. It works find on Linux or MacOS (since they use GCC perhaps), so I figured this might be a problem of using MSVC and GCC on Windows, however it seems to build and link fine...? The binding.gyp looks like:

{
    "targets": [{
        "target_name": "library",
        "product_extension": "node",
        "type": "<(library)",
        "cflags": ["-Wall"],
        "ldflags": ["-s"],
        "sources": ["library.c"],
        "libraries": ["../library.a"],
    }],
}

How can I debug this error further? Thanks for the help!

@StefanStojanovic
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants