bnordli / rftg

Race for the Galaxy AI
173 stars 32 forks source link

Compilation issues in Arch (`struct timeval` missing, segfault at `__strlen_avx2`) #55

Open dessaya opened 5 years ago

dessaya commented 5 years ago

I'm compiling in my Arch Linux box, and I ran into a few issues. I managed to work around them as shown below.

1)

client.c: In function ‘send_msg’:
client.c:104:17: error: storage size of ‘timeout’ isn’t known
  struct timeval timeout;
                 ^~~~~~~

This is fixed by replacing #include <time.h> with #include <sys/time.h> in rftg.h and comm.h. I don't know if that would break other platforms but it works in my setup.

2) Segfault in read_campaign():

#0  0x00007ffff6c8a715 in __strlen_avx2 () at /usr/lib/libc.so.6
#1  0x000055555557fb1a in read_campaign () at init.c:798
#2  0x00005555555b56f7 in main (argc=5, argv=0x7fffffffe5c8) at gui.c:14291

Apparently strdup() needs a #define to be correctly declared. So my workaround was to compile with:

make CFLAGS='-D_SVID_SOURCE'