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

undefined symbol from my own plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-13-2011 , 06:43   undefined symbol from my own plugin
Reply With Quote #1

All files got included and my class have no dependency on .so or .a, under windows works but under linux it sucks:

Code:
plugin_load addons/plugintemplate_ep2v
 failed to dlopen /home/tiago/srcds_l/orangebox/cstrike/addons/plugintemplate_ep2v.so error=/home/tiago/srcds_l/orangebox/cstrike/addons/plugintemplate_ep2v.so: undefined symbol: _ZN11CSigScanLib4LoadEP9KeyValues
Unable to load plugin "addons/plugintemplate_ep2v"
Unable to load plugin "addons/plugintemplate_ep2v"
sigscan.h

PHP Code:
#ifndef LIB_SIGSCAN_H
#define LIB_SIGSCAN_H
//=================================================================================
// Defines
//=================================================================================
#define LIB_SIGSCAN_VERSION "1.0"
#define LIB_SIGSCAN_CLASS CSigScanLib

#define SIGSCAN_ASSERT_FUNCTION(_address, _return) \
    
if(!pBase) return _return; \
    if(!
addressName) \
        
addressName _address; \
    
void *pAddr GetFunction(addressNameGamePlayer); \
    if (!
pAddr) return _return;

#ifdef WIN32 /* GCC's member function pointers all contain a this pointer adjustor. You'd probably set it to 0 */
    #define SIGSCAN_END(o) \
        
void *addr;    } u;     u.addr o;    
#else 
    #define SIGSCAN_END(o) \
        
struct {void *addrintptr_t adjustor;} s; } uu.s.addr ou.s.adjustor 0;
#endif


#define SIGSCAN_0(p, o, r1, r2) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(void); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)();

#define SIGSCAN_1(p, o, r1, r2, t1, v1) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1);

#define SIGSCAN_2(p, o, r1, r2, t1, v1, t2, v2) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2);

#define SIGSCAN_3(p, o, r1, r2, t1, v1, t2, v2, t3, v3) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3);

#define SIGSCAN_4(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4);

#define SIGSCAN_5(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5);

#define SIGSCAN_6(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6);

#define SIGSCAN_7(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7);

#define SIGSCAN_8(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8);

#define SIGSCAN_9(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8t9); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8v9);

#define SIGSCAN_10(p, o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9, t10, v10) \
    
union r2(CPlugin_EmptyClass::*mfpnew)(t1t2t3t4t5t6t7t8t9t10); \
    
SIGSCAN_END(o) \
    
r1 (r2) (reinterpret_cast<CPlugin_EmptyClass*>(p)->*u.mfpnew)(v1v2v3v4v5v6v7v8v9v10);

#define SIGSCAN_STATIC_0(o, r1, r2) \
    
typedef r2 (*func)(); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc();

#define SIGSCAN_STATIC_1(o, r1, r2, t1, v1) \
    
typedef r2 (*func)(t1); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1);

#define SIGSCAN_STATIC_2(o, r1, r2, t1, v1, t2, v2) \
    
typedef r2 (*func)(t1t2); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2);

#define SIGSCAN_STATIC_3(o, r1, r2, t1, v1, t2, v2, t3, v3) \
    
typedef r2 (*func)(t1t2t3); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3);

#define SIGSCAN_STATIC_4(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4) \
    
typedef r2 (*func)(t1t2t3t4); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4);

#define SIGSCAN_STATIC_5(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5) \
    
typedef r2 (*func)(t1t2t3t4t5); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5);

#define SIGSCAN_STATIC_6(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6) \
    
typedef r2 (*func)(t1t2t3t4t5t6); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6);

#define SIGSCAN_STATIC_7(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7);

#define SIGSCAN_STATIC_8(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8);

#define SIGSCAN_STATIC_9(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8t9); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8v9);

#define SIGSCAN_STATIC_10(o, r1, r2, t1, v1, t2, v2, t3, v3, t4, v4, t5, v5, t6, v6, t7, v7, t8, v8, t9, v9, t10, v10) \
    
typedef r2 (*func)(t1t2t3t4t5t6t7t8t9t10); \
    
func thisfunc = (func)o; \
    
r1 (r2thisfunc(v1v2v3v4v5v6v7v8v9v10);

//=================================================================================
// Class
//=================================================================================
class LIB_SIGSCAN_CLASS
{
public:
    
// SigsScan Function
    
struct SigScan_t
    
{
        const 
char *Name;
        const 
char *Signature;    // Windows
        
const char *Symbol;        // Linux
        
void *pFunction;        // Address to function
    
};

    
// Load signature configs from a KeyValues file
    
bool Load(KeyValues *kvSigscan);

    
// Add signature to list, but never write to file
    
bool Add(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Add or Replace a signature to list, but never write to file
    
bool AddOrReplace(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Replace a signature from list, but never write to file
    
bool Replace(const char *name, const char *signature, const char *symbolvoid *pFunction);

    
// Remove a signature from list, but never write to file
    
bool Remove(const char *name);

    
// Get the index from list of a sigscan stored on the game configs ie. common.txt and cstrike.txt
    
int GetIndex(const char *name, ...);

    
// Get the sigscan function address
    
void *GetFunction(const char *name, ...);

/************************************************************************************
                                    SigScan Functions
*************************************************************************************/

    // Get Advanced Effects
    
ITempEntsSystem *GetTempEnts(const char *addressName /*= "te"*/);

    
// Switch a player to other team (CSS)
    // void SwitchTeam(int team_index);
    
bool CSSPlayer_SwitchTeam(edict_t *pEntityint team_index, const char *addressName /*= "CSSPlayer::SwitchTeam"*/);

    
// Switch a player to other team (CSS)
    // void SwitchTeam(int team_index);
    
bool CSSPlayer_SwitchTeam(CBaseEntity *pBaseint team_index, const char *addressName /*= "CSSPlayer::SwitchTeam"*/);

    
// Respawn a player (CSS)
    // void RoundRespawn(void);
    
bool CSSPlayer_RoundRespawn(edict_t *pEntity, const char *addressName /*= "CSSPlayer::RoundRespawn"*/);

    
// Respawn a player (CSS)
    // void RoundRespawn(void);
    
bool CSSPlayer_RoundRespawn(CBaseEntity *pBase, const char *addressName /*= "CSSPlayer::RoundRespawn"*/);

/************************************************************************************
                                    Static Methods
*************************************************************************************/

#ifdef WIN32
    
static bool GetDllMemInfo(void *pAddrunsigned char **base_addrsize_t *base_len);
    static 
void *FindSignature(unsigned char *pBaseAddresssize_t baseLengthunsigned char *pSignature);
#endif

    // Holds all signatures
    // Use only to loop
    
CUtlVector<SigScan_tvec_sigscan;

    
// Current game player
    
const char *GamePlayer;
    
};



#endif 
sigscan.cpp
PHP Code:
//=================================================================================
// Includes
//=================================================================================
#define NO_INCLUDE_LIBRARIES
#include "includes/default.h"
#include "serverplugin/serverplugin_engine.h"
#include "libs/lib_string.h"
#include "libs/lib_entity.h"
#include "libs/lib_sigscan.h"

//=================================================================================
// Utilities
//=================================================================================
#ifdef WIN32
static unsigned char HexToBin(char hex_char)
{
    
char upper_char toupper(hex_char);
    return ((
upper_char >= '0' && upper_char <= '9') ? upper_char 48:upper_char 55);
}

static 
bool ValidHexChar(char hex_char)
{
    
char upper_char toupper(hex_char);
    return ((
upper_char >= '0' && upper_char <= '9') || (upper_char >= 'A' && upper_char <= 'F'));
}

//=================================================================================
// Functions
//=================================================================================
// Load signature configs from a KeyValues file
bool LIB_SIGSCAN_CLASS::Load(KeyValues *kvSigscan)
{
    if(!
kvSigscan) return false;
    if(
kvSigscan->IsEmpty())
    {
        
//kvSigscan->deleteThis();
        
return true;
    }
    
KeyValues *kvLoop;
#ifdef WIN32
    
unsigned char *base 0;
    
size_t len 0;
    
bool success GetDllMemInfo(VAR_IFACE_GAMESERVERDLL, &base, &len);
    if(!
success) return false;
#else

#endif
    
for(kvLoop kvSigscan->GetFirstSubKey(); kvLoopkvLoop kvLoop->GetNextKey())
    {
        if(
kvLoop->GetInt("enable"1) <= 0) continue; // Not enabled
        
const char *name kvLoop->GetName();
        if(!
name) continue;
        const 
char *signature kvLoop->GetString("signature"NULL);
        const 
char *symbol kvLoop->GetString("symbol"NULL);
        
void *pFunction NULL;
#ifdef WIN32
        
if(!signature)
        {
            
DevMsg("[WARNING] SigScan: %s got no signature, skip this\n"name);
            continue;
        }
        
pFunction FindSignature(baselen, (unsigned char *)signature);
        if(!
pFunction) continue;
        
AddOrReplace(namesignaturesymbolpFunction);
#else
        
if(!symbol)
        {
            
DevMsg("[WARNING] SigScan: %s got no symbol, skip this\n"name);
            continue;
        }
#endif
        
if(!pFunction) continue;
        
DevMsg("SigScan: %s got address @ %p\n"namepFunction);
        
AddOrReplace(namesignaturesymbolpFunction);
        
//kvLoop->deleteThis();
    
}
    
//kvSigscan->deleteThis();
    
return true;
}
/// ...
/// ... 
dont know why is happening, object is compiled ...

Last edited by sn4k3; 01-13-2011 at 06:48.
sn4k3 is offline
Send a message via MSN to sn4k3
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-13-2011 , 08:38   Re: undefined symbol from my own plugin
Reply With Quote #2

You haven't configured your build system to link the object generated from sigscan.cpp.
__________________
asherkin is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-13-2011 , 10:09   Re: undefined symbol from my own plugin
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
You haven't configured your build system to link the object generated from sigscan.cpp.
thats the problem, object got compiled and generated lib_sigscan.o with 2.2KB
sn4k3 is offline
Send a message via MSN to sn4k3
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-13-2011 , 11:47   Re: undefined symbol from my own plugin
Reply With Quote #4

Linking != Compiling.
__________________
asherkin is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-13-2011 , 12:04   Re: undefined symbol from my own plugin
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
Linking != Compiling.
true, but i use a variable for both, so what link also compiles

my makefile:

Code:
# (C)2004-2010 Metamod:Source Development Team
# Makefile written by David "BAILOPAN" Anderson

###########################################
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
###########################################

HL2SDK_ORIG = ../..
HL2SDK_DARKMESSIAH = ../..
HL2SDK_OB = ../..
HL2SDK_OB_VALVE = ../..
HL2SDK_L4D = ../../hl2sdk-l4d
HL2SDK_L4D2 = ../../hl2sdk-l4d2
HL2SDK_ALIENSWARM = ../../hl2sdk-alienswarm
MMSOURCE = ../../mmsource

# setup plugin folder
PLUGIN_ADDONS_FOLDER = GameFolder/addons/plugintemplate

#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
#####################################

# Compile to metamod source-Werror
COMPILE_MM = false
# Compile plugin with python Eventscripts support
ENABLE_PYTHON = false
# Include SourceHook?
INCLUDE_SOURCEHOOK = true

PROJECT = plugintemplate
OBJECTS = serverplugin_main.cpp plugin_python.cpp plugin_gameevents.cpp plugin_convars.cpp plugin_concommands.cpp \
	plugin_player.cpp plugin_hack.cpp plugin_timers.cpp plugin_globals.cpp 

PLUGINTEMPLATE_OBJECTS = plugintemplate/others/oslink.cpp plugintemplate/serverplugin/serverplugin_engine.cpp plugintemplate/serverplugin/serverplugin_enginepython.cpp \
	plugintemplate/libs/lib_admin.cpp plugintemplate/libs/lib_cfg.cpp plugintemplate/libs/lib_convar.cpp plugintemplate/libs/lib_download.cpp \
	plugintemplate/libs/lib_entity.cpp plugintemplate/libs/lib_hack.cpp plugintemplate/libs/lib_ini.cpp plugintemplate/libs/lib_lang.cpp \
	plugintemplate/libs/lib_menu.cpp plugintemplate/libs/lib_message.cpp plugintemplate/libs/lib_player.cpp plugintemplate/libs/lib_profiling.cpp \
	plugintemplate/libs/lib_prop.cpp plugintemplate/libs/lib_sigscan.cpp plugintemplate/libs/lib_sound.cpp plugintemplate/libs/lib_string.cpp \
	plugintemplate/libs/lib_timer.cpp plugintemplate/libs/lib_unitconverter.cpp plugintemplate/libs/lib_vfuncs.cpp plugintemplate/libs/libraries.cpp \
	plugintemplate/libs/MRecipientFilter.cpp 

# SourceHook files
SOURCEHOOK_FILES = sourcehook.cpp sourcehook_impl_chookidman.cpp  sourcehook_impl_chookmaninfo.cpp sourcehook_impl_cproto.cpp sourcehook_impl_cvfnptr.cpp
	
##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
##############################################

OPT_FLAGS = -O3 -funroll-loops -s -pipe
GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
DEBUG_FLAGS = -g -ggdb3 -D_DEBUG
CPP = gcc
OBJECTS += $(PLUGINTEMPLATE_OBJECTS)

##########################
### SDK CONFIGURATIONS ###
##########################

PROJECT := $(PROJECT)_
ifeq "$(DEBUG)" "true"
	PROJECT := $(PROJECT)d
endif

override ENGSET = false

# Check for valid list of engines
ifneq (,$(filter original darkmessiah orangebox orangeboxvalve left4dead left4dead2 alienswarm,$(ENGINE)))
	override ENGSET = true
endif

ifeq "$(ENGINE)" "original"
	HL2SDK = $(HL2SDK_ORIG)
	CFLAGS += -DSOURCE_ENGINE=1
	PROJECT := $(PROJECT)ep1
endif
ifeq "$(ENGINE)" "darkmessiah"
	HL2SDK = $(HL2SDK_DARKMESSIAH)
	CFLAGS += -DSOURCE_ENGINE=2
	PROJECT := $(PROJECT)darkm
endif
ifeq "$(ENGINE)" "orangebox"
	HL2SDK = $(HL2SDK_OB)
	CFLAGS += -DSOURCE_ENGINE=3
	PROJECT := $(PROJECT)ep2
endif
ifeq "$(ENGINE)" "orangeboxvalve"
	HL2SDK = $(HL2SDK_OB_VALVE)
	CFLAGS += -DSOURCE_ENGINE=4
	PROJECT := $(PROJECT)ep2v
endif
ifeq "$(ENGINE)" "left4dead"
	HL2SDK = $(HL2SDK_L4D)
	CFLAGS += -DSOURCE_ENGINE=5
	PROJECT := $(PROJECT)l4d
endif
ifeq "$(ENGINE)" "left4dead2"
	HL2SDK = $(HL2SDK_L4D2)
	CFLAGS += -DSOURCE_ENGINE=6
	PROJECT := $(PROJECT)l4d2
endif
ifeq "$(ENGINE)" "alienswarm"
	HL2SDK = $(HL2SDK_ALIENSWARM)
	CFLAGS += -DSOURCE_ENGINE=7
	PROJECT := $(PROJECT)alienswarm
endif

PLUGIN_ENGINE = VSP
ifeq "$(COMPILE_MM)" "true"
	PROJECT := $(PROJECT)_mm
	CFLAGS += -DSOURCEMM
	PLUGIN_ENGINE = MMS
endif

HL2PUB = $(HL2SDK)/public

ifeq "$(ENGINE)" "original"
	INCLUDE += -I$(HL2SDK)/dlls -I$(HL2PUB)/dlls -I$(HL2SDK)/game_shared 
	METAMOD = $(MMSOURCE)/core-legacy
else
	INCLUDE += -I$(HL2SDK)/game/server -I$(HL2SDK)/game/shared -I$(HL2PUB)/game/server -I$(HL2PUB)/game/shared
	METAMOD = $(MMSOURCE)/core
endif

SOURCEHOOK = $(METAMOD)/sourcehook


ifeq "$(INCLUDE_SOURCEHOOK)" "true"
	OBJECTS += $(SOURCEHOOK_FILES)
endif

OS := $(shell uname -s)

ifeq "$(OS)" "Darwin"
	LIB_EXT = dylib
	HL2LIB = $(HL2SDK)/lib/mac
else
	LIB_EXT = so
	ifeq "$(ENGINE)" "original"
		HL2LIB = $(HL2SDK)/linux_sdk
	else
		HL2LIB = $(HL2SDK)/lib/linux
	endif
endif

# if ENGINE is orig, OB, or L4D
ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
	LIB_SUFFIX = _i486.$(LIB_EXT)
else
	LIB_PREFIX = lib
	LIB_SUFFIX = .$(LIB_EXT)
endif

ifeq "$(ENABLE_PYTHON)" "true"
	INCLUDE += plugintemplate/externlibs/python/linux/include
	CFLAGS += -DPYTHON
	LINK += plugintemplate/externlibs/python/libs/libpython2.5.so.1.0 
endif

CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 \
	-DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6 -DSE_ALIENSWARM=7

LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/tier2_i486.a $(HL2LIB)/mathlib_i486.a \
	$(LIB_PREFIX)vstdlib$(LIB_SUFFIX) $(LIB_PREFIX)tier0$(LIB_SUFFIX) \
	-static-libgcc

INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/common -I$(HL2PUB)/engine \
	-I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
	-I. -I$(METAMOD) -I$(METAMOD)/sourcehook \
	-Iconfig -Iplugintemplate -Iplugintemplate/macros 

################################################
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
################################################

BINARY = $(PROJECT).$(LIB_EXT)

ifeq "$(DEBUG)" "true"
	BIN_DIR = bin/linux/Debug.$(PLUGIN_ENGINE).$(ENGINE)
	CFLAGS += $(DEBUG_FLAGS)
else
	BIN_DIR = bin/linux/Release.$(PLUGIN_ENGINE).$(ENGINE)
	CFLAGS += $(OPT_FLAGS)
endif

GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)

ifeq "$(OS)" "Darwin"
	LIB_EXT = dylib
	CFLAGS += -isysroot /Developer/SDKs/MacOSX10.5.sdk
	LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
else
	LIB_EXT = so
	CFLAGS += -D_LINUX
	LINK += -shared
endif

CFLAGS += -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
	-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca \
	-Dstrcmpi=strcasecmp -Wall -Wno-non-virtual-dtor -Wfatal-errors -fPIC -fno-exceptions \
	-fno-rtti -msse -m32 -fno-strict-aliasing
#-Werror
ifeq "$(GCC_VERSION)" "4"
	CFLAGS += $(GCC4_FLAGS)
endif

OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)

$(BIN_DIR)/%.o: %.cpp
	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<

all: check
	mkdir -p $(BIN_DIR)
	mkdir -p $(BIN_DIR)/plugintemplate/others
	mkdir -p $(BIN_DIR)/plugintemplate/serverplugin
	mkdir -p $(BIN_DIR)/plugintemplate/libs
	mkdir -p $(PLUGIN_ADDONS_FOLDER)/bin
	ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
	ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX)
	if [ "$(INCLUDE_SOURCEHOOK)" = "true" ]; then \
		for number in $(SOURCEHOOK_FILES) ; do \
			ln -sf $(SOURCEHOOK)/$$number ; \
		done \
		#ln -sf $(SOURCEHOOK)/sourcehook.cpp; \
		#ln -sf $(SOURCEHOOK)/sourcehook_impl_chookidman.cpp; \
		#ln -sf $(SOURCEHOOK)/sourcehook_impl_chookmaninfo.cpp; \
		#ln -sf $(SOURCEHOOK)/sourcehook_impl_cproto.cpp; \
		#ln -sf $(SOURCEHOOK)/sourcehook_impl_cvfnptr.cpp; \
	fi
	$(MAKE) -f Makefile plugin
	$(MAKE) -f Makefile plugin_clean
	
check:
	if [ "$(ENGSET)" = "false" ]; then \
		echo "You must supply one of the following values for ENGINE:"; \
		echo "alienswarm, left4dead2, left4dead, orangeboxvalve, orangebox, darkmessiah or original"; \
		exit 1; \
	fi
	
plugin: check $(OBJ_BIN)
	echo "start";
	$(CPP) $(INCLUDE) -m32 $(OBJ_BIN) $(LINK) -ldl -lm -o $(BIN_DIR)/$(BINARY)
	cp -f $(BIN_DIR)/$(BINARY) $(PLUGIN_ADDONS_FOLDER)/bin/$(BINARY)

default: all

clean: check
	rm -rf $(BIN_DIR)/*.o
	rm -rf $(BIN_DIR)/$(BINARY)
	rm -rf $(BIN_DIR)

plugin_clean:
	for number in $(SOURCEHOOK_FILES) ; do \
		rm -rf $$number ; \
	done
	rm -rf $(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
	rm -rf $(LIB_PREFIX)tier0$(LIB_SUFFIX)
also im getting a 650KB plugin, windows: 325KB
any way to reduce linux binary?

thanks
sn4k3 is offline
Send a message via MSN to sn4k3
Afronanny
Veteran Member
Join Date: Aug 2009
Old 01-13-2011 , 12:21   Re: undefined symbol from my own plugin
Reply With Quote #6

Quote:
Originally Posted by sn4k3 View Post
any way to reduce linux binary?
Strip the symbols
Afronanny is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-13-2011 , 12:33   Re: undefined symbol from my own plugin
Reply With Quote #7

Quote:
Originally Posted by Afronanny View Post
Strip the symbols
That's generally quite annoying for anything publicly released, as it makes 3rd party debugging much harder.
__________________
asherkin is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-13-2011 , 14:43   Re: undefined symbol from my own plugin
Reply With Quote #8

so its better no

that symbol problem is annoying me... Cant get a fix
sn4k3 is offline
Send a message via MSN to sn4k3
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 01-14-2011 , 13:58   Re: undefined symbol from my own plugin
Reply With Quote #9

Maybe the first
Code:
#ifdef WIN32
in (lib_)sigscan.cpp is preventing the bool CSigScanlib::Load(KeyValues*) function definition from being seen by the compiler on linux.
__________________
hello, i am pm
PM is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 01-14-2011 , 14:02   Re: undefined symbol from my own plugin
Reply With Quote #10

Quote:
Originally Posted by PM View Post
Maybe the first
Code:
#ifdef WIN32
in (lib_)sigscan.cpp is preventing the bool CSigScanlib::Load(KeyValues*) function definition from being seen by the compiler on linux.
already do, after say undefined symbol to other function (::CSSPlayer_SwitchTeam)
not just because of ::Load
sn4k3 is offline
Send a message via MSN to sn4k3
Reply


Thread Tools
Display Modes

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 14:26.


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