I'm running Ubuntu 18.04.1 LTS and I'm attempting to get Half Life's game libraries to run within the Xash3D engine. They build OK, but when I attempt to run the engine I get the following confusing error:
undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
After a bit of internet research, I gather that this basically resolves to "VTable for __cxxabiv1::__si_class_type_info
". I have libc++abi-dev
, libc++-dev
, libc++abi1
and libc++1
installed, as well as their i386 counterparts (as I have to compile in 32-bit), so I don't know why runtime linking would fail.
In case it helps, I've found that other libraries from the Half Life repo (specifically Deathmatch Classic ones) do work. I've checked the makefiles and the DMC libraries don't have any LDFLAGS
set, whereas the standard Half Life libraries use:
LDFLAGS= -lm -lstdc++
Is there any reason why I should be getting linker errors here? What can I do to fix them?
EDIT: I'm using GCC/G++ 7.3.0. If it helps, the makefiles for the libraries I'm using are here:
The one that works: https://github.com/ValveSoftware/halflife/blob/master/linux/Makefile.dmcdll
The one that doesn't: https://github.com/ValveSoftware/halflife/blob/master/linux/Makefile.hldll
I've also searched for "libc" in the *_map.txt
files generated on compilation. This is what's present:
In the working DMC map file:
Archive member included to satisfy reference by file (symbol)
/usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
/home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/animating.o (__stack_chk_fail_local)
As-needed library included to satisfy reference by file (symbol)
libstdc++.so.6 /home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/nodes.o (operator new[](unsigned int)@@GLIBCXX_3.4)
libpthread.so.0 /usr/lib/gcc/x86_64-linux-gnu/7/32/libstdc++.so (write@@GLIBC_2.0)
libc.so.6 /home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/client.o (strcpy@@GLIBC_2.0)
/home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/triggers.o: dynamic relocation against `CTriggerPush::CTriggerPush()' in read-only section `.text._Z11GetClassPtrI12CTriggerPushEPT_S2_[_Z11GetClassPtrI12CTriggerPushEPT_S2_]'
Discarded input sections
...
.group 0x0000000000000000 0x8 /usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
.text.__x86.get_pc_thunk.bx
0x0000000000000000 0x4 /usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
.note.GNU-stack
0x0000000000000000 0x0 /usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
Linker script and memory map
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/crti.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/crtbeginS.o
... [Game object files] ...
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/libdl.so
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/libpthread.so
START GROUP
LOAD /lib/i386-linux-gnu/libpthread.so.0
LOAD /usr/lib/i386-linux-gnu/libpthread_nonshared.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/libc++abi.so
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/libc.so
START GROUP
LOAD /lib/i386-linux-gnu/libc.so.6
LOAD /usr/lib/i386-linux-gnu/libc_nonshared.a
LOAD /lib/i386-linux-gnu/ld-linux.so.2
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/crtendS.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/crtn.o
In the non-working HL map file:
Archive member included to satisfy reference by file (symbol)
/usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
/home/vesper/Documents/afterburner-game/build/game/obj/hldll/aflock.o (__stack_chk_fail_local)
As-needed library included to satisfy reference by file (symbol)
libc.so.6 /home/vesper/Documents/afterburner-game/build/game/obj/hldll/client.o (strcpy@@GLIBC_2.0)
/home/vesper/Documents/afterburner-game/build/game/obj/hldll/egon.o: dynamic relocation against `CEgon::UpdateEffect(Vector const&, Vector const&, float)' in read-only section `.text'
...
Linker script and memory map
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/crti.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/crtbeginS.o
... [Game object files] ...
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/libc.so
START GROUP
LOAD /lib/i386-linux-gnu/libc.so.6
LOAD /usr/lib/i386-linux-gnu/libc_nonshared.a
LOAD /lib/i386-linux-gnu/ld-linux.so.2
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so
START GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc_s.so.1
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a
END GROUP
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/32/crtendS.o
LOAD /usr/lib/gcc/x86_64-linux-gnu/7/../../../i386-linux-gnu/crtn.o