Bug 1306047 - [Patch] Fix static library
[Patch] Fix static library
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: mingw-glib2 (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kalev Lember
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-09 18:20 EST by Sandro Mani
Modified: 2017-11-16 13:53 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch (6.72 KB, application/mbox)
2016-02-09 18:20 EST, Sandro Mani
no flags Details
Patch (4.12 KB, patch)
2016-02-09 20:02 EST, Sandro Mani
no flags Details | Diff
Patch (4.94 KB, application/mbox)
2016-02-10 07:15 EST, Sandro Mani
no flags Details
Patch (4.81 KB, application/mbox)
2016-02-10 08:39 EST, Sandro Mani
no flags Details
Patch (4.26 KB, patch)
2016-05-12 17:52 EDT, Sandro Mani
no flags Details | Diff

  None (edit)
Description Sandro Mani 2016-02-09 18:20:14 EST
Created attachment 1122556 [details]
Patch

The attached patch
- Sets the threading implementation to posix. Win32 threads seem broken (regardless of whether used with static or dynamically linked glib)
- Improves glib-prefer-constructors-over-DllMain.patch to always prefer constructors over DllMain, also handling a second case of DllMain
- Adds a missing BR for mingw-pcre
Comment 1 Marc-Andre Lureau 2016-02-09 18:37:30 EST
(In reply to Sandro Mani from comment #0)
> Created attachment 1122556 [details]
> Patch
> 
> The attached patch
> - Sets the threading implementation to posix. Win32 threads seem broken
> (regardless of whether used with static or dynamically linked glib)

what backs this claim?
Comment 2 Sandro Mani 2016-02-09 18:40:15 EST
Apologies for the scarse info:

Program received signal SIGSEGV, Segmentation faul
0x7c919af2 in ntdll!RtlpWaitForCriticalSection ()

#0  0x7c919af2 in ntdll!RtlpWaitForCriticalSection ()
   from C:\WINDOWS\system32\ntdll.dll
#1  0x7c901046 in ntdll!RtlEnterCriticalSection ()
   from C:\WINDOWS\system32\ntdll.dll
#2  0x008ae4dc in ?? ()
#3  0x68837025 in g_private_get_impl (
    key=key@entry=0x688497d4 <private_thread_memory>)
    at ../../glib/gthread-win32.c:342
#4  0x68837b32 in g_private_get_impl (key=0x688497d4 <private_thread_memory>)
    at ../../glib/gthread-win32.c:340
#5  g_private_get (key=key@entry=0x688497d4 <private_thread_memory>)
    at ../../glib/gthread-win32.c:386
#6  0x6880edb3 in thread_memory_from_self () at ../../glib/gslice.c:507
#7  g_slice_alloc (mem_size=mem_size@entry=56) at ../../glib/gslice.c:1003
#8  0x687e2c45 in g_hash_table_new_full (
    hash_func=hash_func@entry=0x687e3c90 <g_str_hash>,
    key_equal_func=key_equal_func@entry=0x687e3c60 <g_str_equal>,
    key_destroy_func=key_destroy_func@entry=0x0,
    value_destroy_func=value_destroy_func@entry=0x0) at ../../glib/ghash.c:711
#9  0x687e2cf7 in g_hash_table_new (hash_func=0x687e3c90 <g_str_hash>,
    key_equal_func=0x687e3c60 <g_str_equal>) at ../../glib/ghash.c:674
#10 0x68801fd4 in g_quark_init () at ../../glib/gquark.c:61
#11 0x68847f75 in glib_init () at ../../glib/glib-init.c:243
#12 glib_init_ctor () at ../../glib/glib-init.c:258
#13 0x688424fc in __do_global_ctors ()
Comment 3 Marc-Andre Lureau 2016-02-09 18:46:59 EST
(In reply to Sandro Mani from comment #2)
> Apologies for the scarse info:


That is still very very scarse. Please give more details on what you are running and how to reproduce.

> Program received signal SIGSEGV, Segmentation faul
> 0x7c919af2 in ntdll!RtlpWaitForCriticalSection ()
> 
> #0  0x7c919af2 in ntdll!RtlpWaitForCriticalSection ()
>    from C:\WINDOWS\system32\ntdll.dll
> #1  0x7c901046 in ntdll!RtlEnterCriticalSection ()
>    from C:\WINDOWS\system32\ntdll.dll
> #2  0x008ae4dc in ?? ()
> #3  0x68837025 in g_private_get_impl (
>     key=key@entry=0x688497d4 <private_thread_memory>)
>     at ../../glib/gthread-win32.c:342
> #4  0x68837b32 in g_private_get_impl (key=0x688497d4 <private_thread_memory>)
>     at ../../glib/gthread-win32.c:340
> #5  g_private_get (key=key@entry=0x688497d4 <private_thread_memory>)
>     at ../../glib/gthread-win32.c:386
> #6  0x6880edb3 in thread_memory_from_self () at ../../glib/gslice.c:507
> #7  g_slice_alloc (mem_size=mem_size@entry=56) at ../../glib/gslice.c:1003
> #8  0x687e2c45 in g_hash_table_new_full (
>     hash_func=hash_func@entry=0x687e3c90 <g_str_hash>,
>     key_equal_func=key_equal_func@entry=0x687e3c60 <g_str_equal>,
>     key_destroy_func=key_destroy_func@entry=0x0,
>     value_destroy_func=value_destroy_func@entry=0x0) at
> ../../glib/ghash.c:711
> #9  0x687e2cf7 in g_hash_table_new (hash_func=0x687e3c90 <g_str_hash>,
>     key_equal_func=0x687e3c60 <g_str_equal>) at ../../glib/ghash.c:674
> #10 0x68801fd4 in g_quark_init () at ../../glib/gquark.c:61
> #11 0x68847f75 in glib_init () at ../../glib/glib-init.c:243
> #12 glib_init_ctor () at ../../glib/glib-init.c:258
> #13 0x688424fc in __do_global_ctors ()
Comment 4 Sandro Mani 2016-02-09 20:02 EST
Created attachment 1122599 [details]
Patch

(Oh boy, after a day looking at linking errors and segfaults and got sloppy resp. overexcited when things worked, while I should just have gone to bed. Turns out I screwed things up myself. Sorry for the false alarm.)

Proper patch attached.
Comment 5 Erik van Pienbroek 2016-02-10 06:20:19 EST
(In reply to Sandro Mani from comment #4)
> (Oh boy, after a day looking at linking errors and segfaults and got sloppy
> resp. overexcited when things worked, while I should just have gone to bed.
> Turns out I screwed things up myself. Sorry for the false alarm.)
> 
> Proper patch attached.

It looks you were already half asleep when you uploaded the updated patch. The new patch is one for the mingw-pango package instead of the mingw-glib2 package :)
Comment 6 Sandro Mani 2016-02-10 07:15 EST
Created attachment 1122778 [details]
Patch

Yes indeed....
Comment 7 Erik van Pienbroek 2016-02-10 08:27:41 EST
If I understand the patch correctly there are 3 different changes here:
- The glib-prefer-constructors-over-DllMain patch is improved so it also covers a similar issue in the gobject library
- A BR: mingw{32,64}-pcre is added so that the external PCRE library is used instead of the bundled one
- A BR: mingw{32,64}-winpthreads is added

It appears that the DllMain in gobject was added just recently: https://git.gnome.org/browse/glib/commit/gobject/gtype.c?id=7a29771a743a8b5337af5f3fcd1fbfdfdc5d1b81 and appears to have been done to fix a compatibility issue with MSVC2015/Windows 10 SDK: https://bugzilla.gnome.org/show_bug.cgi?id=752837
For mingw I think the updated patch is correct although it may not work correctly anymore for MSVC..

The change about pcre looks good enough to more, external libraries should be used where possible

The last one shouldn't be necessary. winpthreads should already automatically get pulled in by mingw{32,64}-gcc

In your updated patch the posix threading configure argument seem to have gotten lost. Was this intentional?
Comment 8 Sandro Mani 2016-02-10 08:39 EST
Created attachment 1122789 [details]
Patch

The winpthreads was a bad leftover. Removed.

I had mis-diagnosed a crash as being related to win32 threads. Win32 threads are working fine, so yes, it is intentional that I dropped the posix threads configure argument from the patch.

About the glib-prefer-constructors-over-DllMain: the modified code should fall back cleanly to the previous DllMain approach if G_HAS_CONSTRUCTORS is not defined, which should be the case with MSVC. So, unless I'm missing something, nothing should change for MSVC?
Comment 9 Jan Kurik 2016-02-24 09:27:48 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 10 Sandro Mani 2016-05-12 17:52 EDT
Created attachment 1156926 [details]
Patch

Patch rebased.

Would be nice if this could get merged.
Comment 11 Kalev Lember 2016-05-13 03:07:55 EDT
Can you send this upstream to https://bugzilla.gnome.org/enter_bug.cgi?product=glib , please? And maybe ask nacho to review it on IRC afterwards?

Thanks!
Comment 12 Jan Kurik 2016-07-26 00:16:10 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.
Comment 13 Fedora Admin XMLRPC Client 2017-01-05 15:54:27 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 14 Fedora Admin XMLRPC Client 2017-01-05 16:08:16 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 15 Fedora End Of Life 2017-11-16 13:53:15 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Note You need to log in before you can comment on or make changes to this bug.