Raised This Month: $51 Target: $400
 12% 

Building gamedata for a SDK 2013 mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
foo bar
AlliedModders Donor
Join Date: Dec 2012
Location: Canada
Old 04-28-2014 , 23:43   Building gamedata for a SDK 2013 mod
Reply With Quote #1

Hello,

I'm trying to generate game data for an SDK 2013 based mod, but am receiving the error:

Code:
Failed to open server image, error [server_srv.so: cannot open shared object file: No such file or director
when running vtable-scanner. The Linux server_srv.so is in the correct place.

When I do a readelf -s server_srv.so I get ~229 entries, and nothing referring to CBasePlayer or any of the vtable entries I'm after.

Could someone direct me on how to generate gamedata for this mod? We're in private playtesting right now but would like to distribute gamedata updates with our srcds updates to take advantage of Sourcemod.

Thanks

[foo] bar
__________________
[foo] bar
foo-games.com Game Mods, Plugins and Tools for Game Masters | My Github
foo bar is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-29-2014 , 09:06   Re: Building gamedata for a SDK 2013 mod
Reply With Quote #2

The default 2013 Source SDK makefile strips symbols from the linux binaries, causing those tools to not work.

If wanting to leave them in the server binary, the mod dev would have to do something like:
Code:
diff --git a/devtools/makefile_base_posix.mak b/devtools/makefile_base_posix.mak
--- a/devtools/makefile_base_posix.mak
+++ b/devtools/makefile_base_posix.mak
@@ -90,17 +90,19 @@ ifeq ($(OS),Linux)
             ifneq ($(CXX),clang++)
                 VALVE_BINDIR = /valve/steam-runtime/bin/
             endif
         endif
         GCC_VER =
         MARCH_TARGET = pentium4
         # On dedicated servers, some plugins depend on global variable symbols in addition to functions.
         # So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
-        STRIP_FLAGS = -x
+        ifeq (,$(findstring server.so,$(GAMEOUTPUTFILE)))
+            STRIP_FLAGS = -x
+        endif
     endif
 
     ifeq ($(CXX),clang++)
         # Clang does not support -mfpmath=sse because it uses whatever
         # instruction set extensions are available by default.
         SSE_GEN_FLAGS = -msse2
     else
         SSE_GEN_FLAGS = -msse2 -mfpmath=sse
Edit: That said, the Mac version, if available, will typically still have symbols. It's also possible to find the offsets needed from just the Windows binary, albeit an exercise in tedium.

Last edited by psychonic; 04-29-2014 at 09:13.
psychonic is offline
foo bar
AlliedModders Donor
Join Date: Dec 2012
Location: Canada
Old 04-29-2014 , 12:28   Re: Building gamedata for a SDK 2013 mod
Reply With Quote #3

I now see the symbols in the .symtab table but not .dynsym. dlsym() is returning NULL when looking for CBasePlayer:

Quote:
./vtablecheck ../srcds/bin/server_srv.so CBasePlayer RemoveAllWeaponsEb
ConVarRef mat_dxlevel doesn't point to an existing ConVar
StartSym = _ZTV11CBasePlayer
Invalid vtable symbol "CBasePlayer"
Quote:
readelf -s ../srcds/bin/server_srv.so |grep -i _ZTV11CBasePlayer
27779: 00c5c080 1812 OBJECT LOCAL DEFAULT 13 _ZTV11CBasePlayer
Do I need to be exporting the symbols differently? This is with GCC 4.8.2 on Ubuntu 4.8.2-19ubuntu1.

I could do a Mac build but if Linux .so's can be used I'd greatly prefer that. I'd like to automate this as part of the build process for the mod, and a Linux build is presently already part of it.
__________________
[foo] bar
foo-games.com Game Mods, Plugins and Tools for Game Masters | My Github
foo bar is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-29-2014 , 12:57   Re: Building gamedata for a SDK 2013 mod
Reply With Quote #4

Quote:
Originally Posted by foo bar View Post
I now see the symbols in the .symtab table but not .dynsym. dlsym() is returning NULL when looking for CBasePlayer:





Do I need to be exporting the symbols differently? This is with GCC 4.8.2 on Ubuntu 4.8.2-19ubuntu1.

I could do a Mac build but if Linux .so's can be used I'd greatly prefer that. I'd like to automate this as part of the build process for the mod, and a Linux build is presently already part of it.
Oh, right. So, dlsym isn't going to work due to -fvisibility=hidden and those functions not being explicitly exported. That's also in the Makefile and has been present on just about every Source game for the past few years.

The way we (or at least I) dump them now is with asherkin's vtable_dump.py, a script for IDA. In addition to it not caring about hidden visibility, the Windows offsets it gives are correct in any case I've seen, accounting for differences from overloads and multiple inheritance rather than assuming -1 from linux. There's also a modified version floating around that works on the mac binaries.

Last edited by psychonic; 04-29-2014 at 12:58.
psychonic is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-29-2014 , 13:24   Re: Building gamedata for a SDK 2013 mod
Reply With Quote #5

Double-post, but this will also work well enough, https://forums.alliedmods.net/showthread.php?t=186248
psychonic is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode