goldy icon indicating copy to clipboard operation
goldy copied to clipboard

Crashes with Windows (mingw/msys)

Open mifritscher opened this issue 6 years ago • 1 comments
trafficstars

After failing with cygwin, I tried mingw. After a few trivial fixes ( https://github.com/mifritscher/goldy/tree/mingw-bringup ), it compiles - but crashes right after start:

800800 INFO  Goldy 0.2 starting up
.805800 DEBUG Binded UDP 0.0.0.0:11194
.806800 DEBUG Loaded server certificate file
.807800 DEBUG Loaded private key file
.811800 DEBUG Seeded random number generator
.811800 INFO  Proxy is ready, listening for connections on UDP 0.0.0.0:11194
.811800 INFO  main_loop - start
.811800 DEBUG start_listen_io - 116
./server.sh: Zeile 1:  2047 Segmentation fault      ./goldy -g DEBUG -l 0.0.0.0:11194 -b 127.0.0.1:1195 -c keys/individual_1_server.crt -k keys/individual_1_server.key

Ah short gdb session reveals:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000447fcf in pri_adjust (loop=0x0, w=0x22f450) at ev.c:3895
3895      ev_set_priority (w, pri);
(gdb) bt
#0  0x0000000000447fcf in pri_adjust (loop=0x0, w=0x22f450) at ev.c:3895
#1  ev_start (active=1, w=0x22f450, loop=0x0) at ev.c:3901
#2  ev_io_start (loop=0x0, w=0x22f450) at ev.c:3932
#3  0x000000000040362a in start_listen_io (loop=0x0, w=0x22f450, gc=0x22f4c0)
    at goldy.c:832
#4  0x0000000000403b27 in main_loop (gc=0x22f4c0) at goldy.c:958
#5  0x0000000000403c0e in main (argc=11, argv=0x392a10) at goldy.c:984
(gdb) quit
A debugging session is active.

mifritscher avatar Aug 07 '19 08:08 mifritscher

Btw, I get following warnings:

CC    goldy.o
goldy.c: In function 'acquire_peername':
goldy.c:499:5: warning: implicit declaration of function 'inet_ntop'; did you mean 'inet_ntoa'? [-Wimplicit-function-declaration]
 499 |     inet_ntop(AF_INET, &s_ip4->sin_addr, sc->client_ip_str,
     |     ^~~~~~~~~
     |     inet_ntoa
goldy.c: In function 'global_cb':
goldy.c:904:38: warning: pointer targets in passing argument 2 of 'recvfrom' differ in signedness [-Wpointer-sign]
 904 |     ret = recvfrom(gc->listen_fd.fd, first_packet, sizeof(first_packet), 0,
     |                                      ^~~~~~~~~~~~
     |                                      |
     |                                      unsigned char *
In file included from goldy.c:38:
C:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:993:58: note: expected 'char *' but argument is of type 'unsigned char *'
 993 |   WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen);
     |                                                    ~~~~~~^~~
 LINK  goldy


But I think these are not critical.

mifritscher avatar Aug 07 '19 08:08 mifritscher