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

[package] glib: Can't have multiple dependencies linking against static glib in Windows #11022

Open
theartful opened this issue Jun 2, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@theartful
Copy link
Contributor

theartful commented Jun 2, 2022

For all intents and purposes, static libraries with global state are generally broken in Windows.
If we have two shared libraries linking against a static library, then each one of these two libraries will get its own version of the global state. This is unlike on Linux.

The problem here is that glib relies heavily on global state, and many of the dependencies of gtk link against glib. If any of these dependencies is a shared library (which is actually the case with cairo and gdk-pixbuf), it will get its own version of glib separate from the others.

if self.settings.os == "Windows":
del self.options.fPIC
# Fix duplicate definitions of DllMain
self.options["gdk-pixbuf"].shared = True
# Fix segmentation fault
self.options["cairo"].shared = True

I suggest that we make glib (and any other library with global state for that matter) shared by default on Windows.

This issue is a blocker for #11013. Sorry I'm not sure if this is the right repository for this issue.

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: glib/all
  • Operating System+version: Windows
  • Compiler+version: msvc
@theartful theartful added the bug Something isn't working label Jun 2, 2022
@SSE4
Copy link
Contributor

SSE4 commented Jun 5, 2022

that's true, in general you cannot have multiple instances of GLib in your address space, and it bites not only on Windows.
we faced exactly this problem with GStremer already, where in general static/shared GLib/GStreamer cannot be mixed.
we marked these combinations as invalid configurations to prevent such bugs.
see also: #7142 #7734 #8148 #10539 and conan-io/conan#9712

@theartful
Copy link
Contributor Author

Do you think making glib shared by default a good solution? Glib works correctly as shared in most configurations, while it fails if static on many configurations.

@SSE4
Copy link
Contributor

SSE4 commented Jun 5, 2022

Do you think making glib shared by default a good solution? Glib works correctly as shared in most configurations, while it fails if static on many configurations.

if it's what upstream recommends, then yes.

@AndreyMlashkin
Copy link
Contributor

@memsharded

Can conan client recognize such static+shared dependencies problems? Maybe it would be a good feature to implement a warning? Version override is already logged as a warning, it could be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants