pkgconf.exe segfault when build with mingw64 on windows #125

Closed
opened 2017-08-18 04:52:16 +00:00 by irakhlin · 5 comments
irakhlin commented 2017-08-18 04:52:16 +00:00 (Migrated from github.com)

Hello,
I have build the most recent commit with mingw64 in a msys2 environment. Using the cmake configuration file, which as a side not I had to change(change line 58 to IF (MSVC) as /WX and /wd4996 are not existing linkers for mingw64).

Regardless, when attempting to simply run the generated exe I get a segfault. Here is some additional information:
(gdb) run
Starting program: C:\msys64\home\irakhlin\pkgconf\build\pkgconf.exe
[New Thread 14616.0x2b78]
[New Thread 14616.0x1bec]
[New Thread 14616.0x42c0]
[New Thread 14616.0x497c]

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffb78cdea4a in vswprintf () from C:\WINDOWS\System32\msvcrt.dll
(gdb) gdb
Undefined command: "gdb". Try "help".
(gdb) bt
#0 0x00007ffb78cdea4a in vswprintf () from C:\WINDOWS\System32\msvcrt.dll
#1 0x00007ffb78cd9b90 in msvcrt!_vsnprintf_l ()
from C:\WINDOWS\System32\msvcrt.dll
#2 0x00007ffb78cd9b01 in vsnprintf () from C:\WINDOWS\System32\msvcrt.dll
#3 0x000000006d181bd4 in snprintf (
__stream=__stream@entry=0x60f690 "C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:zu [", __n=65535,
__format=0x6d18a140 <PRETTY_FUNCTION.51384+48> "%s:%zu [%s]: ",
__format=0x6d18a140 <PRETTY_FUNCTION.51384+48> "%s:%zu [%s]: ",
__n=65535) at C:/msys64/mingw64s/x86_64-w64-mingw32/include/stdio.h:597
#4 0x000000006d181d08 in pkgconf_trace (
client=client@entry=0x40c060 <pkg_client>,
filename=filename@entry=0x6d18a150 <PRETTY_FUNCTION.51384+64> "C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c", lineno=lineno@entry=552,
funcname=funcname@entry=0x6d18a3c0 <PRETTY_FUNCTION.51491> "pkgconf_client_set_trace_handler",
format=format@entry=0x6d18a228 <PRETTY_FUNCTION.51384+280> "installing default trace handler")
at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:322
#5 0x000000006d18230b in pkgconf_client_set_trace_handler (
trace_handler_data=0x0, trace_handler=0x0, client=0x40c060 <pkg_client>)
at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:552
#6 pkgconf_client_init (client=client@entry=0x40c060 <pkg_client>,
error_handler=error_handler@entry=0x401c40 <error_handler>,
error_handler_data=error_handler_data@entry=0x0)
at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:66
#7 0x00000000004045d9 in main (argc=1, argv=0x2764050)
at C:\msys64\home\irakhlin\pkgconf\main.c:730

Hello, I have build the most recent commit with mingw64 in a msys2 environment. Using the cmake configuration file, which as a side not I had to change(change line 58 to IF (MSVC) as /WX and /wd4996 are not existing linkers for mingw64). Regardless, when attempting to simply run the generated exe I get a segfault. Here is some additional information: (gdb) run Starting program: C:\msys64\home\irakhlin\pkgconf\build\pkgconf.exe [New Thread 14616.0x2b78] [New Thread 14616.0x1bec] [New Thread 14616.0x42c0] [New Thread 14616.0x497c] Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007ffb78cdea4a in vswprintf () from C:\WINDOWS\System32\msvcrt.dll (gdb) gdb Undefined command: "gdb". Try "help". (gdb) bt #0 0x00007ffb78cdea4a in vswprintf () from C:\WINDOWS\System32\msvcrt.dll #1 0x00007ffb78cd9b90 in msvcrt!_vsnprintf_l () from C:\WINDOWS\System32\msvcrt.dll #2 0x00007ffb78cd9b01 in vsnprintf () from C:\WINDOWS\System32\msvcrt.dll #3 0x000000006d181bd4 in snprintf ( __stream=__stream@entry=0x60f690 "C:\\msys64\\home\\irakhlin\\pkgconf\\libpkgconf\\client.c:zu [", __n=65535, __format=0x6d18a140 <__PRETTY_FUNCTION__.51384+48> "%s:%zu [%s]: ", __format=0x6d18a140 <__PRETTY_FUNCTION__.51384+48> "%s:%zu [%s]: ", __n=65535) at C:/msys64/mingw64s/x86_64-w64-mingw32/include/stdio.h:597 #4 0x000000006d181d08 in pkgconf_trace ( client=client@entry=0x40c060 <pkg_client>, filename=filename@entry=0x6d18a150 <__PRETTY_FUNCTION__.51384+64> "C:\\msys64\\home\\irakhlin\\pkgconf\\libpkgconf\\client.c", lineno=lineno@entry=552, funcname=funcname@entry=0x6d18a3c0 <__PRETTY_FUNCTION__.51491> "pkgconf_client_set_trace_handler", format=format@entry=0x6d18a228 <__PRETTY_FUNCTION__.51384+280> "installing default trace handler") at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:322 #5 0x000000006d18230b in pkgconf_client_set_trace_handler ( trace_handler_data=0x0, trace_handler=0x0, client=0x40c060 <pkg_client>) at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:552 #6 pkgconf_client_init (client=client@entry=0x40c060 <pkg_client>, error_handler=error_handler@entry=0x401c40 <error_handler>, error_handler_data=error_handler_data@entry=0x0) at C:\msys64\home\irakhlin\pkgconf\libpkgconf\client.c:66 #7 0x00000000004045d9 in main (argc=1, argv=0x2764050) at C:\msys64\home\irakhlin\pkgconf\main.c:730

I suspect this is because msvcrt doesn't support %zu correctly. Not sure what is the best solution here, I could probably switch it to %lu.

I suspect this is because msvcrt doesn't support %zu correctly. Not sure what is the best solution here, I could probably switch it to %lu.
irakhlin commented 2017-09-01 18:07:13 +00:00 (Migrated from github.com)

Thank you for the suggestion! I was able to get it to build and run, still need to do more testing but this is my patch based on what you said. I am not positive this is the most correct way but it seems to work so far. Ignore the removal of the dllimport; I just wanted to be sure to build a static library so its unrelated.
pkgconf_mingw64.txt

Thank you for the suggestion! I was able to get it to build and run, still need to do more testing but this is my patch based on what you said. I am not positive this is the most correct way but it seems to work so far. Ignore the removal of the dllimport; I just wanted to be sure to build a static library so its unrelated. [pkgconf_mingw64.txt](https://github.com/pkgconf/pkgconf/files/1271113/pkgconf_mingw64.txt)
karen-arutyunov commented 2017-09-07 08:59:03 +00:00 (Migrated from github.com)

Hello,

Can we expect that fix for this issue will go into the next release?

Hello, Can we expect that fix for this issue will go into the next release?

windows support is only in 1.4 series which is not released yet.

windows support is only in 1.4 series which is not released yet.
karen-arutyunov commented 2017-09-09 13:43:26 +00:00 (Migrated from github.com)

Is there an approximate date when 1.4 can be released?

Is there an approximate date when 1.4 can be released?
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#125
There is no content yet.