From ee1e0d0eff0e4d93f17a4b90322735f3b66e63c5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 7 Apr 2013 21:15:10 +0000 Subject: Fixed linux compilation in regard to SQLite dependency on libdl For some reason newer G++ linker requires libraries to come after object files, yuck! git-svn-id: http://mc-server.googlecode.com/svn/trunk@1371 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- GNUmakefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6e29f0a8b..4907f7217 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -33,15 +33,19 @@ all: MCServer/MCServer # CC_OPTIONS ... options for the C code compiler # CXX_OPTIONS ... options for the C++ code compiler # LNK_OPTIONS ... options for the linker +# LNK_LIBS ... libraries to link in +# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources # BUILDDIR ... folder where the intermediate object files are built +LNK_LIBS = -lstdc++ -ldl + ifeq ($(release),1) ################ # release build - fastest run-time, no gdb support ################ CC_OPTIONS = -s -g -O3 -DNDEBUG CXX_OPTIONS = -s -g -O3 -DNDEBUG -LNK_OPTIONS = -lstdc++ -ldl -pthread -O3 +LNK_OPTIONS = -pthread -O3 BUILDDIR = build/release/ else @@ -51,7 +55,7 @@ ifeq ($(profile),1) ################ CC_OPTIONS = -s -g -ggdb -O3 -pg -DNDEBUG CXX_OPTIONS = -s -g -ggdb -O3 -pg -DNDEBUG -LNK_OPTIONS = -lstdc++ -ldl -pthread -ggdb -O3 -pg +LNK_OPTIONS = -pthread -ggdb -O3 -pg BUILDDIR = build/profile/ else @@ -61,7 +65,7 @@ ifeq ($(pedantic),1) ################ CC_OPTIONS = -s -g -ggdb -D_DEBUG -Wall -Wextra -pedantic -ansi -Wno-long-long CXX_OPTIONS = -s -g -ggdb -D_DEBUG -Wall -Wextra -pedantic -ansi -Wno-long-long -LNK_OPTIONS = -lstdc++ -ldl -pthread -ggdb +LNK_OPTIONS = -pthread -ggdb BUILDDIR = build/pedantic/ else @@ -71,7 +75,7 @@ else ################ CC_OPTIONS = -s -ggdb -g -D_DEBUG -O3 CXX_OPTIONS = -s -ggdb -g -D_DEBUG -LNK_OPTIONS = -lstdc++ -ldl -pthread -g -ggdb +LNK_OPTIONS = -pthread -g -ggdb BUILDDIR = build/debug/ endif endif @@ -123,7 +127,7 @@ OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS)) -include $(patsubst %.o,%.d,$(OBJECTS)) MCServer/MCServer : $(OBJECTS) - $(CC) $(LNK_OPTIONS) $(OBJECTS) -o MCServer/MCServer + $(CC) $(LNK_OPTIONS) $(OBJECTS) $(LNK_LIBS) -o MCServer/MCServer clean : rm -rf $(BUILDDIR) MCServer/MCServer -- cgit v1.2.3