Missing linux library for SourceSDK DLL compilation
1 replies, posted
Hey boys, I'm trying to compile a DLL for Garry's Mod that hooks into the Source SDK functions to try and expose some factors of models and particles. Problem is when I go to compile the DLL from the makefile, I get an error saying I'm missing the following two libraries.
-ltier0_srv ( LIBTIER0_SRV.SO )
-lvstdlib_srv ( LIBVSTDLIB_SRV.SO )
Both these libraries exist in the sourcesdk-minimal files, and moving them to any position that's being linked doesn't seem to be working. Setting an exact path for them works, but the libraries will fail to load when required by Garry's Mod. Here's the make I'm attempting to use:
RESCOMP = windres
TARGETDIR = release
TARGET = $(TARGETDIR)/gmsv_wos_extension_linux.dll
OBJDIR = intermediate/x86/Release
DEFINES += -DNDEBUG -DGMMODULE -DWOS_EXTENSION_SERVER -DIS_SERVERSIDE=true -DGAME_DLL -DCOMPILER_GCC -DPOSIX -D_POSIX -DLINUX -D_LINUX -DGNUC -DNO_MALLOC_OVERRIDE -DGMOD_USE_SOURCESDK
INCLUDES += -I../../../source -I../../../../garrysmod_common-master/include -I../../../../sourcesdk-minimal-master/common -I../../../../sourcesdk-minimal-master/public -I../../../../sourcesdk-minimal-master/game/server -I../../../../sourcesdk-minimal-master/game/shared -I../../../../sourcesdk-minimal-master/public/tier0 -I../../../../sourcesdk-minimal-master/public/tier1 -I../../../source/module
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -msse2 -w -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-invalid-offsetof
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fPIC -msse2 -w -std=gnu++11 -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-invalid-offsetof
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../../../../garrysmod_common-master/projects/linux/gmake/release/liblua_shared.a ../../../../garrysmod_common-master/projects/linux/gmake/release/libtier1.a -ltier0_srv -lvstdlib_srv
LDDEPS += ../../../../garrysmod_common-master/projects/linux/gmake/release/liblua_shared.a ../../../../garrysmod_common-master/projects/linux/gmake/release/libtier1.a
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../../../../sourcesdk-minimal-master/lib/public/linux32 -m32 -shared -Wl,-soname=gmsv_wos_extension_linux.dll -s -static-libgcc -static-libstdc++
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
And here's the error on compile, as well as the LD check.
/usr/bin/ld: cannot find -ltier0_srv
/usr/bin/ld: cannot find -lvstdlib_srv
ld: warning: cannot find entry symbol _start; not setting start address
gmsv_wos_extension_linux.dll: undefined reference to `Plat_localtime'
gmsv_wos_extension_linux.dll: undefined reference to `Msg'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_key_create'
gmsv_wos_extension_linux.dll: undefined reference to `dlsym'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_rwlock_rdlock'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_once'
gmsv_wos_extension_linux.dll: undefined reference to `dlerror'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_getspecific'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_rwlock_wrlock'
gmsv_wos_extension_linux.dll: undefined reference to `Error'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_create'
gmsv_wos_extension_linux.dll: undefined reference to `dladdr'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_rwlock_destroy'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_atfork'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_rwlock_init'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_rwlock_unlock'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_key_delete'
gmsv_wos_extension_linux.dll: undefined reference to `Plat_IsInDebugSession'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_detach'
gmsv_wos_extension_linux.dll: undefined reference to `dlopen'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_setspecific'
gmsv_wos_extension_linux.dll: undefined reference to `dlclose'
gmsv_wos_extension_linux.dll: undefined reference to `pthread_join'
Also, when I do get it compiling and require the module, it fails with an error essentially saying
Undefined reference to 'Plat_IsInDebugSession'
which shows it isn't loading.
Here's the repo for the minimal files: GitHub
Got it loading properly by setting the runtime path, if anyone happens to google this thread with the same issue
Sorry, you need to Log In to post a reply to this thread.