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

Module bad load | Linux


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-05-2013 , 12:26   Module bad load | Linux
Reply With Quote #1

I compiled the module on VirtualBox

PHP Code:
#include <extdll.h>
#include <meta_api.h>

meta_globals_t *gpMetaGlobals;

plugin_info_t info = {
   
META_INTERFACE_VERSION,            // ifvers
   
"HELLO WORLD",                  // name
   
"1.01",                        // version
   
"2011/02/19",                  // date
   
"6a6kin",                     // author
   
"http://ultra.ucoz.ru",            // url
   
"HELLOWORLD",                  // logtag, all caps please
   
PT_ANYTIME,                     // (when) loadable
   
PT_ANYPAUSE                     // (when) unloadable
};

static 
META_FUNCTIONS gMetaFunctionTable 
{
   
NULL,            // pfnGetEntityAPI            HL SDK; called before game DLL
   
NULL,            // pfnGetEntityAPI_Post         META; called after game DLL
   
NULL,            // pfnGetEntityAPI2            HL SDK2; called before game DLL
   
NULL,            // pfnGetEntityAPI2_Post      META; called after game DLL
   
NULL,            // pfnGetNewDLLFunctions      HL SDK2; called before game DLL
   
NULL,            // pfnGetNewDLLFunctions_Post   META; called after game DLL
   
GetEngineFunctions,   // pfnGetEngineFunctions      META; called before HL engine
   
NULL            // pfnGetEngineFunctions_Post   META; called after HL engine
};

enginefuncs_t g_engfuncs;
globalvars_t  *gpGlobals;

#if defined _MSC_VER
   #pragma comment(linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8")
#endif

C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_tpengfuncsFromEngineglobalvars_t *pGlobals)
{
   
memcpy(&g_engfuncspengfuncsFromEnginesizeof(enginefuncs_t));
   
gpGlobals pGlobals;
   
ALERT(at_console"[HELLOWORLD]: GiveFnptrsToDll\n");
}

C_DLLEXPORT int Meta_Query(char *interfaceVersionplugin_info_t **pinfomutil_funcs_t *pMetaUtilFuncs)
{
   *
pinfo = &info;
   
ALERT(at_console"[HELLOWORLD]: meta_query\n");
   return(
TRUE);
}

C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME nowMETA_FUNCTIONS *pFunctionTablemeta_globals_t *pMGlobalsgamedll_funcs_t *pGamedllFuncs)
{

   if(!
pFunctionTable)
   {
      return(
FALSE);
   }


   
memcpy(pFunctionTable, &gMetaFunctionTablesizeof(META_FUNCTIONS));
   
gpMetaGlobals pMGlobals;
   
ALERT(at_console"[HELLOWORLD]: meta_attach\n");
   return(
TRUE);
}

C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME nowPL_UNLOAD_REASON reason)
{
   
ALERT(at_console"[HELLOWORLD]: meta_detach\n");
   return(
TRUE);
}

int fnPre(char *s)
{
   
ALERT(at_console"[HELLOWORLD]: model precaching\n");
   
RETURN_META_VALUE(MRES_IGNORED0);
}

enginefuncs_t my_tracers 
{
   
fnPre,                  // pfnPrecacheModel()
   
NULL,                  // pfnPrecacheSound()
   
NULL,                  // pfnSetModel()
   
NULL,                  // pfnModelIndex()
   
NULL,                  // pfnModelFrames()

   
NULL,                  // pfnSetSize()
   
NULL,                  // pfnChangeLevel()
   
NULL,                  // pfnGetSpawnParms()
   
NULL,                  // pfnSaveSpawnParms()

   
NULL,                  // pfnVecToYaw()
   
NULL,                  // pfnVecToAngles()
   
NULL,                  // pfnMoveToOrigin()
   
NULL,                  // pfnChangeYaw()
   
NULL,                  // pfnChangePitch()

   
NULL,                  // pfnFindEntityByString()
   
NULL,                  // pfnGetEntityIllum()
   
NULL,                  // pfnFindEntityInSphere()
   
NULL,                  // pfnFindClientInPVS()
   
NULL,                  // pfnEntitiesInPVS()

   
NULL,                  // pfnMakeVectors()
   
NULL,                  // pfnAngleVectors()

   
NULL,                  // pfnCreateEntity()
   
NULL,                  // pfnRemoveEntity()
   
NULL,                  // pfnCreateNamedEntity()

   
NULL,                  // pfnMakeStatic()
   
NULL,                  // pfnEntIsOnFloor()
   
NULL,                  // pfnDropToFloor()

   
NULL,                  // pfnWalkMove()
   
NULL,                  // pfnSetOrigin()

   
NULL,                  // pfnEmitSound()
   
NULL,                  // pfnEmitAmbientSound()

   
NULL,                  // pfnTraceLine()
   
NULL,                  // pfnTraceToss()
   
NULL,                  // pfnTraceMonsterHull()
   
NULL,                  // pfnTraceHull()
   
NULL,                  // pfnTraceModel()
   
NULL,                  // pfnTraceTexture()
   
NULL,                  // pfnTraceSphere()
   
NULL,                  // pfnGetAimVector()

   
NULL,                  // pfnServerCommand()
   
NULL,                  // pfnServerExecute()
   
NULL,                  // pfnClientCommand()

   
NULL,                  // pfnParticleEffect()
   
NULL,                  // pfnLightStyle()
   
NULL,                  // pfnDecalIndex()
   
NULL,                  // pfnPointContents()

   
NULL,                  // pfnMessageBegin()
   
NULL,                  // pfnMessageEnd()

   
NULL,                  // pfnWriteByte()
   
NULL,                  // pfnWriteChar()
   
NULL,                  // pfnWriteShort()
   
NULL,                  // pfnWriteLong()
   
NULL,                  // pfnWriteAngle()
   
NULL,                  // pfnWriteCoord()
   
NULL,                  // pfnWriteString()
   
NULL,                  // pfnWriteEntity()

   
NULL,                  // pfnCVarRegister()
   
NULL,                  // pfnCVarGetFloat()
   
NULL,                  // pfnCVarGetString()
   
NULL,                  // pfnCVarSetFloat()
   
NULL,                  // pfnCVarSetString()

   
NULL,                  // pfnAlertMessage()
   
NULL,                  // pfnEngineFprintf()

   
NULL,                  // pfnPvAllocEntPrivateData()
   
NULL,                  // pfnPvEntPrivateData()
   
NULL,                  // pfnFreeEntPrivateData()

   
NULL,                  // pfnSzFromIndex()
   
NULL,                  // pfnAllocString()

   
NULL,                   // pfnGetVarsOfEnt()
   
NULL,                  // pfnPEntityOfEntOffset()
   
NULL,                  // pfnEntOffsetOfPEntity()
   
NULL,                  // pfnIndexOfEdict()
   
NULL,                  // pfnPEntityOfEntIndex()
   
NULL,                  // pfnFindEntityByVars()
   
NULL,                  // pfnGetModelPtr()

   
NULL,                  // pfnRegUserMsg()

   
NULL,                  // pfnAnimationAutomove()
   
NULL,                  // pfnGetBonePosition()

   
NULL,                  // pfnFunctionFromName()
   
NULL,                  // pfnNameForFunction()

   
NULL,                  // pfnClientPrintf()
   
NULL,                  // pfnServerPrint()

   
NULL,                  // pfnCmd_Args()
   
NULL,                  // pfnCmd_Argv()
   
NULL,                  // pfnCmd_Argc()

   
NULL,                  // pfnGetAttachment()

   
NULL,                  // pfnCRC32_Init()
   
NULL,                  // pfnCRC32_ProcessBuffer()
   
NULL,                  // pfnCRC32_ProcessByte()
   
NULL,                  // pfnCRC32_Final()

   
NULL,                  // pfnRandomLong()
   
NULL,                  // pfnRandomFloat()

   
NULL,                  // pfnSetView()
   
NULL,                  // pfnTime()
   
NULL,                  // pfnCrosshairAngle()

   
NULL,                  // pfnLoadFileForMe()
   
NULL,                  // pfnFreeFile()

   
NULL,                  // pfnEndSection()
   
NULL,                  // pfnCompareFileTime()
   
NULL,                  // pfnGetGameDir()
   
NULL,                  // pfnCvar_RegisterVariable()
   
NULL,                  // pfnFadeClientVolume()
   
NULL,                  // pfnSetClientMaxspeed()
   
NULL,                  // pfnCreateFakeClient()
   
NULL,                  // pfnRunPlayerMove()
   
NULL,                  // pfnNumberOfEntities()

   
NULL,                  // pfnGetInfoKeyBuffer()
   
NULL,                  // pfnInfoKeyValue()
   
NULL,                  // pfnSetKeyValue()
   
NULL,                  // pfnSetClientKeyValue()

   
NULL,                  // pfnIsMapValid()
   
NULL,                  // pfnStaticDecal()
   
NULL,                  // pfnPrecacheGeneric()
   
NULL,                   // pfnGetPlayerUserId()
   
NULL,                  // pfnBuildSoundMsg()
   
NULL,                  // pfnIsDedicatedServer()
   
NULL,                  // pfnCVarGetPointer()
   
NULL,                  // pfnGetPlayerWONId()

   
NULL,                  // pfnInfo_RemoveKey()
   
NULL,                  // pfnGetPhysicsKeyValue()
   
NULL,                  // pfnSetPhysicsKeyValue()
   
NULL,                  // pfnGetPhysicsInfoString()
   
NULL,                  // pfnPrecacheEvent()
   
NULL,                  // pfnPlaybackEvent()

   
NULL,                  // pfnSetFatPVS()
   
NULL,                  // pfnSetFatPAS()

   
NULL,                  // pfnCheckVisibility()

   
NULL,                  // pfnDeltaSetField()
   
NULL,                  // pfnDeltaUnsetField()
   
NULL,                  // pfnDeltaAddEncoder()
   
NULL,                  // pfnGetCurrentPlayer()
   
NULL,                  // pfnCanSkipPlayer()
   
NULL,                  // pfnDeltaFindField()
   
NULL,                  // pfnDeltaSetFieldByIndex()
   
NULL,                  // pfnDeltaUnsetFieldByIndex()

   
NULL,                  // pfnSetGroupMask()

   
NULL,                  // pfnCreateInstancedBaseline()
   
NULL,                  // pfnCvar_DirectSet()

   
NULL,                  // pfnForceUnmodified()

   
NULL,                  // pfnGetPlayerStats()

   
NULL,                  // pfnAddServerCommand()

   
NULL,                  // pfnVoice_GetClientListening()
   
NULL,                  // pfnVoice_SetClientListening()

   
NULL,                  // pfnGetPlayerAuthId()

   
NULL,                  // pfnSequenceGet()
   
NULL,                  // pfnSequencePickSentence()
   
NULL,                  // pfnGetFileSize()
   
NULL,                  // pfnGetApproxWavePlayLen()
   
NULL,                  // pfnIsCareerMatch()
   
NULL,                  // pfnGetLocalizedStringLength()
   
NULL,                  // pfnRegisterTutorMessageShown()
   
NULL,                  // pfnGetTimesTutorMessageShown()
   
NULL,                  // pfnProcessTutorMessageDecayBuffer()
   
NULL,                  // pfnConstructTutorMessageDecayBuffer()
   
NULL,                  // pfnResetTutorMessageDecayData()
   
NULL,                  // pfnQueryClientCvarValue()
   
NULL,                  // pfnQueryClientCvarValue2()
};

C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngineint *interfaceVersion)
{
   if(!
pengfuncsFromEngine)
   {
      return(
FALSE);
   } else if(*
interfaceVersion != ENGINE_INTERFACE_VERSION)
   {
      *
interfaceVersion ENGINE_INTERFACE_VERSION;
      return(
FALSE);
   }

   
memcpy(pengfuncsFromEngine, &my_tracerssizeof(enginefuncs_t));
   
ALERT(at_console"[HELLOWORLD]: transfer successfully ended\n");
   
   return(
TRUE);

PHP Code:
#(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson

HLSDK = ../../hlsdk-2.3-p3
MM_ROOT 
= ../metamod

### EDIT BELOW FOR OTHER PROJECTS ###

OPT_FLAGS = -O2 -funroll-loops --pipe -fomit-frame-pointer -fno-strict-aliasing
DEBUG_FLAGS 
= --ggdb3
CPP 
g++
NAME stub

BIN_SUFFIX_32 
i386.so
BIN_SUFFIX_64 
amd64.so

OBJECTS 
stub.cpp


LINK 
=

INCLUDE = -
I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
    -
I$(MM_ROOT) -I$(HLSDK)/common -I$(HLSDK)/pm_shared -Isdk -Iinclude

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

ifeq "$(GCC_VERSION)" "4"
        
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif

ifeq "$(DEBUG)" "true"
    
BIN_DIR Debug
    CFLAGS 
= $(DEBUG_FLAGS)
else
    
BIN_DIR Release
    CFLAGS 
= $(OPT_FLAGS)
endif

CFLAGS += -DNDEBUG -Wall -Wno-char-subscripts -Wno-unknown-pragmas -Wno-write-strings -Wno-deprecated -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc -m32

ifeq 
"$(AMD64)" "true"
    
BINARY = $(NAME)_$(BIN_SUFFIX_64)
    
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 
else
    
BINARY = $(NAME)_$(BIN_SUFFIX_32)
    
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
    OPT_FLAGS 
+= -march=i586
endif

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

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

all:
    
mkdir -$(BIN_DIR)
    
mkdir -$(BIN_DIR)/sdk
    
$(MAKEstub

amd64
:
    $(
MAKEall AMD64=true

stub
: $(OBJ_LINUX)
    $(
CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)

debug:    
    $(
MAKEall DEBUG=true

default: all

clean
:
    
rm -rf $(BIN_DIR)/sdk/*.o
    rm -rf $(BIN_DIR)/*.o
    rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_32)
    rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_64) 

PHP Code:
meta list
Currently loaded plugins:
      
description      stat pend  file              vers      src  load  unlod
 
1] <stub.so>        badf load  stub.so           v -       ini   -     -
1 plugins0 running 
plugins.ini :

linux addons/stub/stub.so

module:

/addons/stub/stub.so


What's the problem?
Attached Files
File Type: so stub.so (6.0 KB, 57 views)
__________________

Last edited by Bos93; 02-05-2013 at 12:30.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-06-2013 , 15:23   Re: Module bad load | Linux
Reply With Quote #2

I compiled amxmod module, it is loaded, and any meta plugins are not loaded. have any ideas?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-06-2013 , 16:56   Re: Module bad load | Linux
Reply With Quote #3

meta refresh

Code:
meta refresh L 02/07/2013 - 00:54:33: [META] Refreshing the plugins on demand... L 02/07/2013 - 00:54:33: [META] ini: Begin re-reading plugins list: /root/hlds/cstrike/addons/metamod/plugins.ini L 02/07/2013 - 00:54:33: [META] ERROR: ini: Plugin '<stub_i386.so>' has newer file, but unexpected status (badfile) L 02/07/2013 - 00:54:33: [META] ini: Read plugin config for: <stub_i386.so> L 02/07/2013 - 00:54:33: [META] ini: Finished reading plugins list: /root/hlds/cstrike/addons/metamod/plugins.ini; Found 1 plugins L 02/07/2013 - 00:54:33: [META] dll: Updating plugins... L 02/07/2013 - 00:54:33: [META] ERROR: dll: Failed query plugin '<stub_i386.so>'; Couldn't find Meta_Query(): /root/hlds/cstrike/addons/stub/stub_i386.so: undefined symbol: Meta_Query L 02/07/2013 - 00:54:33: [META] ERROR: dll: Skipping plugin '<stub_i386.so>'; couldn't query L 02/07/2013 - 00:54:33: [META] dll: Finished updating 1 plugins; kept 0, loaded 0, unloaded 0, reloaded 0, delayed 0

undefined symbol: Meta_Query

Why?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-06-2013 , 17:02   Re: Module bad load | Linux
Reply With Quote #4

You could just use the the code provided with AMXX modules (amxxmodules.cpp/h), it's complete, fully working, and you won't have any problems.
__________________

Last edited by Arkshine; 02-06-2013 at 17:03.
Arkshine is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-06-2013 , 17:39   Re: Module bad load | Linux
Reply With Quote #5

Adding sdk solved my problem. Thank you!

____________________________________
But why the features were not found without sdk?
__________________

Last edited by Bos93; 02-06-2013 at 17:41.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-07-2013 , 07:44   Re: Module bad load | Linux
Reply With Quote #6

PHP Code:
objdump -T stub_i386.so

stub_i386
.so:     file format elf32-i386

DYNAMIC SYMBOL TABLE
:
00000000      DF *UND*   00000000  GLIBC_2.0   memcpy
00000000  w   DF 
*UND*   00000000  GLIBC_2.1.3 __cxa_finalize
00000000  w   D  
*UND*   00000000              __gmon_start__
00000000  w   D  
*UND*   00000000              _Jv_RegisterClasses
00002320 g    D  
*ABS*   00000000  Base        _edata
000025d8 g    D  
*ABS*   00000000  Base        _end
00002320 g    D  
*ABS*   00000000  Base        __bss_start
00000400 g    DF 
.init   00000000  Base        _init
00000758 g    DF 
.fini   00000000  Base        _fini 
the characters were not visible

_______________________________

remove:

PHP Code:
ifeq "$(GCC_VERSION)" "4"
        
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif 

PHP Code:
objdump -T stub_i386.so

stub_i386
.so:     file format elf32-i386

DYNAMIC SYMBOL TABLE
:
00000000      DF *UND*   00000000  GLIBC_2.0   memcpy
00000000  w   DF 
*UND*   00000000  GLIBC_2.1.3 __cxa_finalize
00000000  w   D  
*UND*   00000000              __gmon_start__
00000000  w   D  
*UND*   00000000              _Jv_RegisterClasses
00002040 g    
DO .data   00000274  Base        my_tracers
00002320 g    D  
*ABS*   00000000  Base        _edata
000025d8 g    D  
*ABS*   00000000  Base        _end
00000850 g    DF 
.text   00000021  Base        Meta_Detach
00000790 g    DF 
.text   000000b8  Base        Meta_Attach
00002320 g    D  
*ABS*   00000000  Base        __bss_start
0000055c g    DF 
.init   00000000  Base        _init
00000680 g    DF 
.text   00000029  Base        _Z5fnPrePc
000006b0 g    DF 
.text   0000005e  Base        GetEngineFunctions
000008b8 g    DF 
.fini   00000000  Base        _fini
00002360 g    
DO .bss   00000274  Base        g_engfuncs
00002340 g    
DO .bss   00000004  Base        gpGlobals
00000710 g    DF 
.text   00000045  Base        GiveFnptrsToDll
000022c0 g    
DO .data   00000024  Base        info
00000760 g    DF 
.text   0000002b  Base        Meta_Query 

It worked. My problem is solved.

credits: 6a6kin for helping
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-07-2013 , 09:49   Re: Module bad load | Linux
Reply With Quote #7

Shit. New error:

PHP Code:
L 02/07/2013 17:48:14: [METAERRORdllFailed query plugin '<zbm.so>'Couldn't open file '/root/hlds/cstrike/addons/zbm.so': ./libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /root/hlds/cstrike/addons/zbm.so
Where is problem ?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2013 , 09:50   Re: Module bad load | Linux
Reply With Quote #8

It's well written : ./libstdc++.so.6: version `GLIBCXX_3.4.15' not found

With what version of gcc/g++ you compile ?
__________________
Arkshine is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-07-2013 , 09:56   Re: Module bad load | Linux
Reply With Quote #9

Arkshine, how to know the version?

sudo apt-get install g++

The latest version
__________________

Last edited by Bos93; 02-07-2013 at 09:57.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 02-07-2013 , 14:58   Re: Module bad load | Linux
Reply With Quote #10

Solved.A bug in my code.
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
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 03:22.


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