Commit f1aec344 authored by Philipp Kutin's avatar Philipp Kutin

GNUmakefile: compile enet.cpp only if NETCODE!=0.

Background: gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
I'm getting a missing compiler-provided symbol:

 /usr/bin/ld: obj/build/enet.o: in function `enet_time_get':
 source/build/include/enet.h:4948: undefined reference to `__atomic_load_8'
 /usr/bin/ld: source/build/include/enet.h:4958: undefined reference to `__atomic_compare_exchange_8'
 collect2: error: ld returned 1 exit status

so have a means of omitting the object file when it is not actually needed.
parent 54883815
......@@ -215,7 +215,6 @@ engine_objs := \
crc32.cpp \
defs.cpp \
dxtfilter.cpp \
enet.cpp \
engine.cpp \
fix16.cpp \
hash.cpp \
......@@ -275,6 +274,9 @@ else
engine_objs += a64.yasm
endif
endif
ifneq (0,$(NETCODE))
engine_objs += enet.cpp
endif
ifeq (1,$(USE_OPENGL))
engine_objs += glsurface.cpp voxmodel.cpp mdsprite.cpp tilepacker.cpp
engine_deps += glad
......
  • This doesn't work because enet.cpp is required for the function enet_gettime() (which is actually located inside enet.h) that is used inside timerGetClockRate() of timer.cpp.

    Compilation will now fail with NETCODE:=0.

    Edited by Dino Bollinger
  • mentioned in issue #121

    Toggle commit list
  • Philipp Kutin @helixhorned

    mentioned in merge request !61

    ·

    mentioned in merge request !61

    Toggle commit list
  • @Doom64hunter

    Compilation will now fail with NETCODE:=0.

    Sorry for breaking the Windows [1] build. Could you try MR !61 and see if that fixes it?

    [1] or rather, any platform for which this holds, from enet.h:

    #if defined _WIN32 || __APPLE__ && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200
        extern int enet_gettime(int X, struct timespec *tv);
  • Yes that solves the problem for me.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment