-
Notifications
You must be signed in to change notification settings - Fork 85
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
Linker issues on Windows #146
Comments
I managed to build the dll successfully by limiting generation with |
@tishin Could I get a bit more elaboration on the |
Wow, this is really painful. It looks like Windows only allows 64k exported symbols, so that is the hard limit we are facing. @lorenalexm the binding generator has a built-in list of types that it can generate code for, I sometimes use that to iterate more quickly, so rather than compiling all the files, it compiles a handful of them. Looking at the list of exported symbols, there might be some candidates to trim this down, for example, consider this property which I do not know why it gets exposed as it is not flagged as public:
Those are four symbols for an internal property, and these account for 80,000 of the symbols. |
Ok, I have a patch committed. This went from 95,721 symbols to 48,736 symbols, so that should unblock Windows for now, now that we know this, it might be worth looking at other savings like this. |
Another 6,600 fewer symbols. We are now at 42,801 |
@migueldeicaza Thank you! Both for the explanation, and your immediate work cutting down on the symbols. Though now, it's funny, I am no longer receiving the linker error but instead receiving a myriad of |
@lorenalexm your log url is expired, so I can't say for sure, but: - |
@tishin I have edited my GitHub build scripts to clean before building, and ran After these changes and the update, my macOS and Linux builds are working without a hitch, though I am still hitting blocking errors with the Windows build. I am now experiencing this build error never actually making it to linking now:
Do I need to completely forsake the macros and attributes to build properly on Windows, or am I managing to find issue where there shouldn't be any? |
@lorenalexm Unfortunately macros aren't supported on Windows yet. You can track the progress at swiftlang/swift#68272
|
With some tinkering to the Package file and a bit of verbosity, I am now successfully compiling on Windows. @tishin @migueldeicaza I cannot express how grateful I am to the both of you in your guidance through my missteps. Thank you! I will find some time and submit a PR with docs stepping someone through the Windows build process; hopefully alleviating some of the pain points. |
Oh that would be a great contribution! |
The release of 5.9.1 should include the macro support. Hopefully we can get newer snapshots with macros soon. |
This is music to my ears @compnerd ! |
I have just successfully built and linked the GitHub README sample with macros on Windows (via GitHub actions) using the 5.9.1 toolchain. I can try to get a PR to you in the next few days. It just required removing the compiler directives, and went without a hitch afterwards. |
Great news! |
Closing this since Windows build is included in CI checks and succeeds. |
@migueldeicaza sorry to comment on a closed issue, but I'm running into the same limitation for a different Swift library and was wondering if you could provide any more detail as to how to work around this? Is it just a maximum of swift symbols that can exist in a package period? Or just ones that need to be accessible externally? |
The ones that are available externally. So if you can reduce your public surface app, you get those slots back |
Oddly, I think it made no difference to debug, but helped with the release config... Maybe there's something I need to do to make it not export all symbols in debug mode? |
1. Linker flag
-undefined dynamic_lookup
is macOS specificLinking
SwiftGodot
product on Windows fails withIt works fine on Linux, but I don't think the flag does anything there.
2. After removing the flags Windows linking fails with
and so on for every generated symbol eventually hitting
This only happens on the first build, the next build after the initial one does not have those errors anymore.
3. Finally, Windows linking fails with
Not sure what can be done here other than separating generated codebase into different modules.
P.S. Since macros aren't yet supported on Windows, you have to specifically build
SwiftGodot
product to even get to linking. Building the whole package will throw macro-related compilation errors.The text was updated successfully, but these errors were encountered: