The following patch removes the optimize flag (-O) when building common/patches/SoF.o. There is a bug in gcc that causes stringstreams not to work if optimized under 64bit.
Without this patch to the makefile, zone will segfault when a SoF client tries to enter the game (post char select). I also patch the makefile for world since the same object file is linked into world.
Code:
Index: world/makefile
===================================================================
--- world/makefile (revision 27)
+++ world/makefile (working copy)
@@ -21,6 +21,8 @@
MYSQL_FLAGS=$(shell mysql_config --cflags)
MYSQL_LIB=$(shell mysql_config --libs)
+SOFCOPTS=$(WFLAGS) -g -pthread -pipe -I../common/SocketLib \
+ -DFX -D_GNU_SOURCE -DINVERSEXY -DWORLD $(DFLAGS) $(MYSQL_FLAGS) $(PERL_FLAGS)
COPTS=$(WFLAGS) -g -O -pthread -pipe -I../common/SocketLib \
-DFX -D_GNU_SOURCE -DINVERSEXY -DWORLD $(DFLAGS) $(MYSQL_FLAGS) $(PERL_FLAGS)
LINKOPTS=$(COPTS) -rdynamic -L. -lstdc++ -lm -lz -ldl \
@@ -33,6 +35,9 @@
include makefile.common
+../common/patches/SoF.o: ../common/patches/SoF.cpp
+ $(CC) $(NOLINK) $(SOFCOPTS) $< $(OUT)$@
+
.depend depend:
for f in $(SF); \
do \
Index: zone/makefile
===================================================================
--- zone/makefile (revision 27)
+++ zone/makefile (working copy)
@@ -18,6 +18,7 @@
PERL_LIB=$(shell perl -MExtUtils::Embed -e ldopts)
DFLAGS+=-DEMBPERL -DEMBPERL_PLUGIN -DHAS_UNION_SEMUN
WFLAGS=-fpermissive -Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wno-deprecated -Wcomment -Wcast-align
+SOFCOPTS=$(WFLAGS) -g -pthread -pipe -D_GNU_SOURCE -DINVERSEXY -DFX -DZONE $(DFLAGS) $(MYSQL_FLAGS) $(PERL_FLAGS)
COPTS=$(WFLAGS) -O -g -pthread -pipe -D_GNU_SOURCE -DINVERSEXY -DFX -DZONE $(DFLAGS) $(MYSQL_FLAGS) $(PERL_FLAGS)
LINKOPTS=$(COPTS) -rdynamic -L. -lstdc++ -ldl $(MYSQL_LIB) $(PERL_LIB)
@@ -27,6 +28,9 @@
include makefile.common
+../common/patches/SoF.o: ../common/patches/SoF.cpp
+ $(CC) $(NOLINK) $(SOFCOPTS) $< $(OUT)$@
+
.depend depend:
for f in $(SF); \
do \