-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Remove references to CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS #5937
Remove references to CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS #5937
Conversation
Thanks for cherry picking. I am more than busy these days, but let me know if I broke anything so that I can try to fix it |
…emove-windows-export-all-symbols
I just hoping that it won't become too troublesome to fix the Git history in your OpenCV 4 PR. |
No problem. After this merge I will clean up there everything and force push something much more manageable. I just hope you will see the light after this tunnel. I am sure you are finding like me so many broken ports... |
I'm not sure if I like this. I see the points and I followed the discussion in #5784. But this seems to target a lot of libraries, and I'm concerned that we might hit problems with mixing static and dynamic libraries. From #5784:
@ras0219-msft @vicroms @qis Can we find a way to allow this choice without touching any port files? Having changed files is such a mess during upgrade. E.g an triplet option. MAKE_WINDOWS_EXPORT_ALL_SYMBOLS might be a hack, but disallowing dynamic linkage for so many ports is a huge change that many people might be surprised about. Also is there any roadmap on the compiler side to handle this issue, or will these libraries stay with static linkage for ever? |
Being the author of the original commit, I agree with you that the rationale behind it should be really explained at least in the documentation. for me, the work I did was more of a demonstration of the huge changes required because of the policy change than a real PR (almost automated changes, I didn’t really had to use any intelligence and I did it like an anti-stress...). |
I agree this sounds reasonable. But still that should be done with care. If the library comes from linux and could be build there as linked library it should be assumed that the library is intended to be used as linked library is certain scenarios. Vcpkg still doesn't build and run tests #3107. If dependent libraries consist of multiple dlls, this could result in undetected errors from duplicated global state. Probably the best option, but also with highest effort, would be to forward issues to the libraries itself. E.g. a couple of month ago I tried to apply WINDOWS_EXPORT_ALL_SYMBOLS to ompl and it failed on the symbol limit. I asked the authors if they can support windows dll by adding exports. They did, and now there is an (still unmerged) branch https://github.com/ompl/ompl/tree/symbol_visibility which needs some further work. It seems a lot of Linux focused libraries are not aware of the need to specify exports explicitly. |
would you mind cherry-picking also b994fb6 in this PR? |
I am working towards cleaning up the OpenCV4 PR commit history (which is huge anyway), removing all "external" to the project itself, while at the same time I'd like to save all the useful fruits, if you consider them tasty |
…rnize some scripts in the meantime
…emove-windows-export-all-symbols
@cenit |
Thanks. I sincerely can’t understand how reducing options is causing regressions... i was convinced that many are not regressions, the ports were failing also in master. |
Current Status All "regressions" fixed. |
…emove-windows-export-all-symbols
@qis the fact that we just reduced build options should not introduce any problem from this point of view. I would agree with you in case of an expansion of the build options! On the contrary, this PR just emerged many ports with small problems, which would have never worked in any case... @Fleischner I agree with you that a clear stance on it is necessary. In any case, with ports properly written, it's extremely easy to revert this PR or (example) just adopt a "bypass" mechanism that can opt-in to CMAKE_EXPORT_ALL_SYMBOLS and enable dynamic libs also when declared static-only, with very little effort. |
@cenit @ras0219-msft I would suggest to allow an per port option that can be enabled in the triplet as described in the Proposal: Extend vcpkg_check_linkage
Furthermore:
|
…emove-windows-export-all-symbols
…emove-windows-export-all-symbols
…emove-windows-export-all-symbols
The following packages will now fail to build for
This is intended behavior as |
great job Victor @vicroms ! |
My point is: using CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS will break the permissions of the function interface, which may not be what the author hopes, but setting |
I believe a problem that I'm currently struggling with is caused by this change: glibmm is build with ONLY_STATIC_LIBRARY but at least three libraries (pangomm, atkmm and gtkmm) are built as dynamic libraries. That means that an application using gtkmm which pulls in all of them ends up with three copies of glibmm and therefore three copies of all static variables that are inside. I see various options:
I'm fairly new to the topic, but my understanding is that CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is intended exactly for this use case: a libraries developed on Linux where every symbol is exported when building a dynamic library. Sure, it is a hack, but it seems a bit premature to generically remove it before a clean replacement exists. |
Correction: the three dependent libraries cannot be built as static libraries. They have ONLY_DYNAMIC_LIBRARY set and naively replacing that by ONLY_STATIC_LIBRARY leads to errors that i do not want to attempt digging into. Simply reverting this patch selectively for glibmm fixes all my problems. I would ask to consider reverting this patch completely and only selectively removing CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS in those cases where it actually causes problems or a clean solution without it exists. Just forcing ONLY_STATIC_LIBRARY for all cases does not appear to be a viable solution. |
This is more or less exactly the situation I expected to happen.
Is not an option for us, because of LGPL license issues
same reason Additional options:
|
@NNemec @Fleischner We actually provide a build system replacement for glibmm, which overrides their build system which does export all symbols when producing dlls. In this case we should have left CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS. |
(partially reverts change discussed in microsoft#5937)
Cherry-picked from PR #5169