DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 59PCDPH93464011
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 59PCDPH93464011
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=rvu9JhK+
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FB113857400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1761394404;
bh=e28bR3Qa6mM2jmnsN/w8qcYDTFO7u5j52rFZJcO42ZU=;
h=Date:To:Cc:Subject:In-Reply-To:References:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=rvu9JhK+5hHXGWogz8lcaZfXkrnGE9EH1w3JRQbyYVzcW7HQnNYJawNZUmsb2dnUh
8dDLdrCZW19chWIWHNzfb9vKSAtjd+gWbLSR9EntUX6MMGvDlsKcTVQQuLpWwmsRR+
fgIWnvFSSywjYOI6YJM/GE16DmJgFb0S/uFI9qlA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BFEC3857B84
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2BFEC3857B84
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761394372; cv=none;
b=r51ku7Rd3b6dlQcr62yNIL11em5Ou+1okYxfFjQT9K1otAEphfW84M87tr1u5SUHf8g98RgbEYr93AAGL/puMq1RazL82KCy1nTelT7GEtP82SnqEqEUze5le6OcJvgGPrKjE9um3BWd60brW297UcAcUhNSDtdCJIdUZEIfrE0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1761394372; c=relaxed/simple;
bh=/8/2ivYJmNDqA9MJsjK3ony90zbx6jSk/Di5Cn9fUJo=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=FNvssj7LNHN93HWAG1olzNfX56Q+ofeRpbQ/Ha4abJPxDikS7UHfYYKbmUriKmmUexxOzD/B2H/2AjKOrK72EDfbvihsVaT/fOfwFKuK7Y5ZhmEjNvCZ0mFplQPrNCm3OLmUdaeAXyfc8NSa1N+Xa8l2WWWHVfYd4F5BQ/DDqgU=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BFEC3857B84
Date: Sat, 25 Oct 2025 21:12:47 +0900
To: cygwin AT cygwin DOT com
Cc: Thomas Huth
Subject: Re: Problem with the SDL2 package in Cygwin
Message-Id: <20251025211247.602c8d8916cffdfc8ac645e6@nifty.ne.jp>
In-Reply-To: <20251011205113.0d09ca46@tpx1>
References: <20251011205113 DOT 0d09ca46 AT tpx1>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe="
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
From: Takashi Yano via Cygwin
Reply-To: Takashi Yano
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin"
This is a multi-part message in MIME format.
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
On Sat, 11 Oct 2025 18:51:14 +0000
Thomas Huth wrote:
>
> Hi!
>
> In the Hatari project (www.hatari-emu.org), we recently hit a problem in the
> CI when we compile Hatari with Cygwin. A couple of weeks ago, everything
> was working still fine:
>
> https://cirrus-ci.com/task/4681700988420096
>
> Then it suddenly started failing - also for the very same code level of
> Hatari that was working fine before:
>
> https://cirrus-ci.com/task/6377222543507456
>
> The only difference was that the SDL2 package of Cygwin recently has been
> upgraded from 2.32.8-1 to 2.32.56-1.
>
> Christian Zietz, a user of Hatari who has a Windows installation (I don't)
> debugged the issue a little bit and concluded that it's crashing somewhere
> during exit():
>
> https://sourceforge.net/p/hatari/mailman/hatari-devel/thread/00253a75-4089-4d8a-846e-8d5c0a4899ee%40gmx.net/#msg59242465
>
> He reproduced it with the following small test program:
>
> --------------------- 8< ----------------------------------------
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ cat sdltest.c
> #include
> #include
>
> int main(int arc, char ** argv) {
>
> if (SDL_Init( SDL_INIT_VIDEO ) == 0) {
>
> printf("SDL_Init succeeded\n");
> printf("Calling SDL_Quit()\n");
> SDL_Quit();
> }
>
> return 0;
> }
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ sdl2-config --version
> 2.32.56
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ gcc -g -O1 -o sdltest sdltest.c -I /usr/include/SDL2/ -lsdl2
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ ./sdltest
> SDL_Init succeeded
> Calling SDL_Quit()
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ ./sdltest > out.txt
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ cat out.txt
>
> WDAGUtilityAccount AT 9f56fa41-fdda-4d08-96da-76c506c9465a /tmp/sdltest
> $ gdb sdltest.exe
> GNU gdb (GDB) (Cygwin 14.2-1) 14.2
> Copyright (C) 2023 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-pc-cygwin".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> .
> Find the GDB manual and other documentation resources online at:
> .
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from sdltest.exe...
> (gdb) run
> Starting program: /tmp/sdltest/sdltest.exe
> [New Thread 7024.0x1918]
> [New Thread 7024.0x1210]
> [New Thread 7024.0x1a80]
> [New Thread 7024.0x18d0]
> SDL_Init succeeded
> Calling SDL_Quit()
>
> Thread 1 "sdltest" received signal SIGSEGV, Segmentation fault.
> 0x00000003f96f1020 in ?? ()
> (gdb) bt
> #0 0x00000003f96f1020 in ?? ()
> #1 0x00007ffb2a577a63 in __call_exitprocs (code=code AT entry=0, d=d AT entry=0x0)
> at /usr/src/debug/cygwin-3.6.4-1/newlib/libc/stdlib/__call_atexit.c:123
> #2 0x00007ffb2a5356ce in exit (code=0) at /usr/src/debug/cygwin-3.6.4-1/newlib/libc/stdlib/exit.c:60
> #3 0x00007ffb2a3d6a98 in cygwin_exit (n=0) at /usr/src/debug/cygwin-3.6.4-1/winsup/cygwin/dcrt0.cc:1238
> #4 0x00007ffb2a3d80d4 in dll_crt0_1 () at /usr/src/debug/cygwin-3.6.4-1/winsup/cygwin/dcrt0.cc:1003
> #5 0x00007ffb2a3d5d05 in _cygtls::call2 (this=0x7ffffce00, func=0x7ffb2a3d707c , arg=0x0,
> buf=buf AT entry=0x7ffffcdf0) at /usr/src/debug/cygwin-3.6.4-1/winsup/cygwin/cygtls.cc:41
> #6 0x00007ffb2a3d5dbb in _cygtls::call (func=, arg=)
> at /usr/src/debug/cygwin-3.6.4-1/winsup/cygwin/cygtls.cc:28
> #7 0x0000000000000000 in ?? ()
> (gdb)
>
> --------------------- 8< ----------------------------------------
>
> Could someone please have a look?
Thanks for the report.
I looked into this problem, and found this issue is not a bug of
SDL2/SDL3 package.
Attached simple test case also reproduces the same issue.
I also found the following patch against cygwin1.dll resolves
the issue. I'll submit the patch to cygwin-patches mailing list
after aome more review by myself.
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 1369165c9..42ee73c79 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -584,7 +584,8 @@ dll_list::detach (void *retaddr)
/* Ensure our exception handler is enabled for destructors */
exception protect;
/* Call finalize function if we are not already exiting */
- if (!exit_state)
+ /* Loaded DLLs need finalize function even in the exiting state */
+ if (!exit_state || d->type == DLL_LOAD)
__cxa_finalize (d->handle);
d->run_dtors ();
}
@@ -609,9 +610,10 @@ dll_list::init ()
/* Walk the dll chain, initializing each dll */
dll *d = &start;
dll_global_dtors_recorded = d->next != NULL;
- /* Init linked and early loaded Cygwin DLLs. */
+ /* Init linked Cygwin DLLs. As for loaded DLLs, dll::init() is already
+ called from dlopen(). */
while ((d = d->next))
- if (d->type == DLL_LINK || d->type == DLL_LOAD)
+ if (d->type == DLL_LINK)
d->init ();
}
--
Takashi Yano
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/x-csrc;
name="dll2.c"
Content-Disposition: attachment;
filename="dll2.c"
Content-Transfer-Encoding: 7bit
#include
#include
static void *dll3;
static void dllinit(void) __attribute__((constructor));
static void dllinit(void)
{
printf("+++++++++++++++++++++++++++++\n");
dll3 = dlopen("dll3.dll", RTLD_LOCAL|RTLD_NOW);
}
static void dllquit(void) __attribute__((destructor));
static void dllquit(void)
{
printf("-----------------------------\n");
dlclose(dll3);
}
void func2()
{
}
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/x-csrc;
name="dll3.c"
Content-Disposition: attachment;
filename="dll3.c"
Content-Transfer-Encoding: 7bit
#include
static void dllinit(void) __attribute__((constructor));
static void dllinit(void)
{
printf("++++++++++++++\n");
}
static void dllquit(void) __attribute__((destructor));
static void dllquit(void)
{
printf("--------------\n");
}
void func3()
{
}
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/x-csrc;
name="main.c"
Content-Disposition: attachment;
filename="main.c"
Content-Transfer-Encoding: 7bit
extern void func2();
int main()
{
func2();
return 0;
}
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/plain;
name="Makefile"
Content-Disposition: attachment;
filename="Makefile"
Content-Transfer-Encoding: base64
YWxsOiBtYWluIGRsbDIuZGxsIGRsbDMuZGxsDQoNCm1haW46IG1haW4uYyBkbGwyLmRsbA0KCSQo
Q0MpIG1haW4uYyBkbGwyLmRsbCAtbyBtYWluDQoNCmRsbDIuZGxsOiBkbGwyLmMNCgkkKENDKSBk
bGwyLmMgLXNoYXJlZCAtbyBkbGwyLmRsbA0KDQpkbGwzLmRsbDogZGxsMy5jDQoJJChDQykgZGxs
My5jIC1zaGFyZWQgLW8gZGxsMy5kbGwNCg0KY2xlYW46DQoJJChSTSkgLWYgbWFpbiBkbGwyLmRs
bCBkbGwzLmRsbA0K
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
--Multipart=_Sat__25_Oct_2025_21_12_47_+0900_A_Yd8eB823eZXpe=--
|