After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793086 - static library compilation fails on windows
static library compilation fails on windows
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: win32
2.55.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks: 698118
 
 
Reported: 2018-02-01 07:05 UTC by kkartaltepe
Modified: 2018-05-24 20:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch of required changes (3.38 KB, patch)
2018-02-01 07:05 UTC, kkartaltepe
none Details | Review

Description kkartaltepe 2018-02-01 07:05:56 UTC
Created attachment 367740 [details] [review]
patch of required changes

This is a patch to fix static builds for windows and the appropriate changes to the meson build tool.

This includes:
Moving initialization functions inside glib_init() so that they are properly called during static initialization. It is critical that they be added to glib_init() as the gobject ctors function only calls glib_init() and so in a static build where order of initialization might not deterministic putting these outside glib_init() may result in glib_init() being called before windows threading is initialized leading to segfaults. See https://bugzilla.gnome.org/show_bug.cgi?id=756139
Fixing #if's so that during static compilation extraneous DllMain symbols are not exported which would prevent linking.
Fixing up meson.build's to set proper defines for subprojects when building statically.

Forgive my patch file if it was incorrectly created. I havn't created one before for submission with a bug report. I diff'ed between my changes and a clean copy of the tarball.
Comment 1 kkartaltepe 2018-02-01 17:34:32 UTC
Appears this may be a duplicate of Bug 698118
However my patch does include required changes to the Meson build to support static compilation.
Comment 2 Christoph Reiter (lazka) 2018-02-02 10:08:30 UTC
Is this for MSVC or MinGW? (I've filed a similar bug 792297 for MinGW)
Comment 3 kkartaltepe 2018-02-02 15:14:19 UTC
This is for MSVC
Comment 4 kkartaltepe 2018-04-25 15:37:59 UTC
For anyone who finds this, the patch is indeed incomplete. Please refer to bug #698118

>So, in summation the current patch is incomplete since destructors aren't 
>called on thread exit, so these patches will leak one GPrivate per thread. 
>The best fix right now is to detect when a thread exits by polling on a kernel mutex.
Comment 5 GNOME Infrastructure Team 2018-05-24 20:10:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1330.