From 40047e91d9d5e9cf91b0841262a552061984199d Mon Sep 17 00:00:00 2001 From: WB2OSZ Date: Wed, 21 Dec 2016 08:47:08 -0500 Subject: [PATCH] Fix segmentation fault when -p command line option used. We need to define a couple more symbols for glibc >= 2.24. Complete details: https://github.com/wb2osz/direwolf/issues/62 modified: Makefile.linux modified: Makefile.macosx --- Makefile.linux | 11 +++++++++-- Makefile.macosx | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile.linux b/Makefile.linux index b9c5583..173309d 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -12,7 +12,14 @@ all : $(APPS) direwolf.desktop direwolf.conf @echo " " CC := gcc -CFLAGS := -O3 -pthread -Igeotranz + +# _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24. +# Explanation here: https://github.com/wb2osz/direwolf/issues/62 + +# There are a few source files where it had been necessary to define __USE_XOPEN2KXSI, +# __USE_XOPEN, or _POSIX_C_SOURCE. Doesn't seem to be needed after adding this. + +CFLAGS := -O3 -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 LDFLAGS := -lm -lpthread -lrt @@ -91,7 +98,7 @@ endif # 245 # 75 -01 # 72 -02 -# 71 -03 +# 71 -03 # 73 -O3 -march=native # 42 -O3 -ffast-math # 42 -Ofast (note below) diff --git a/Makefile.macosx b/Makefile.macosx index 0e95555..bcdab97 100644 --- a/Makefile.macosx +++ b/Makefile.macosx @@ -71,7 +71,12 @@ endif #CC := $(DARWIN_CC) -m64 $(SYS_LIBS) $(SYS_MIN) CC := $(DARWIN_CC) -m32 $(SYS_LIBS) $(SYS_MIN) -CFLAGS := -Os -pthread -Igeotranz $(EXTRA_CFLAGS) + +# _XOPEN_SOURCE=600 and _DEFAULT_SOURCE=1 are needed for glibc >= 2.24. +# Explanation here: https://github.com/wb2osz/direwolf/issues/62 + +CFLAGS := -Os -pthread -Igeotranz -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 $(EXTRA_CFLAGS) + # $(info $$CC is [${CC}]) #