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

My episode1 plugin loads fine in Windows, but not in Linux


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
taansari
Member
Join Date: Nov 2011
Old 02-07-2012 , 01:41   My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #1

Hi!

Please note: I've asked same question here: http://forums.alliedmods.net/showthr...2#post1645472; but I suppose this is the better place. If mods are reading this, please feel free to delete thread there.

I've made a cross platform plug-in that works fine under Windows (Orange box valve (TF, HL2DM), and episode 1 (Fortress forver)).

However, my episode1 plugin does not load under linux, it just gives me this error:
Code:
Listing 1 plugin:
  [01] <ERROR>
When I try to get its information, I get this:
Code:
meta info 1
Plugin 1 is not loaded.
File:  /media/2d9c079a-7c97-4221-98f4-c7f1d713ff1f/HLServer/episode1/fortressforever/addons/my_plugin/bin/my_plugin.so
And when I try to reload it, it gives me:
Code:
meta retry 1
Error reloading plugin: [111]
I've made sure I'm linking against the right SDK, just like in Windows (and its HL2SDK original).

If it were giving me at least one line of human readable error, I would have taken that point as lead, but its either error or just a magic number (111) that I cannot understand.

Can some one please highlight what could I be doing wrong?

Thanks for your guidance!

Last edited by taansari; 02-07-2012 at 01:42.
taansari is offline
taansari
Member
Join Date: Nov 2011
Old 02-07-2012 , 02:23   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #2

A bit of an update: I'm using Ubuntu 11.10 32bit with code::blocks for compiling my plugin.
taansari is offline
taansari
Member
Join Date: Nov 2011
Old 02-09-2012 , 01:13   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #3

*Bump* post. Anyone?
taansari is offline
API
Veteran Member
Join Date: May 2006
Old 02-10-2012 , 13:25   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #4

Usually when you first load a plugin (especially when manually loaded) you get a better error message. Try that out; I know compiling for Linux can be quite the pain in the neck. By the way, common instances of this issue occur when:
1. You linked an old library.
2. You forgot to link a library.
__________________
API is offline
Send a message via AIM to API
taansari
Member
Join Date: Nov 2011
Old 02-13-2012 , 00:19   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #5

Thanks for the guidance pimpinjuice

I'll try the same and get back here with updates, hopefully.

Last edited by taansari; 02-13-2012 at 00:20.
taansari is offline
taansari
Member
Join Date: Nov 2011
Old 02-13-2012 , 06:35   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #6

Quote:
Originally Posted by pimpinjuice View Post
Usually when you first load a plugin (especially when manually loaded) you get a better error message. Try that out; I know compiling for Linux can be quite the pain in the neck.
I tried manually loading the plug-in. Still it does not display any error message.

All I get is:

Code:
Failed to load plugin addons/stub/bin/stub_mm ([2]).


BTW I have moved from my plug-in to this bare-bone plug-in (stub_mm); which also does not work.

Quote:
By the way, common instances of this issue occur when:
1. You linked an old library.
This is the only lib I'm linking against:
Code:
../../../hl2sdk/linux_sdk/tier1_i486.a
Inside hl2sdk for original/ep1 engines.

Quote:
2. You forgot to link a library.
Should I be linking more libs? I've tried different combinations, but none worked for me.
taansari is offline
API
Veteran Member
Join Date: May 2006
Old 02-13-2012 , 14:51   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #7

Try linking tier0 as well. Looks like the error message is most likely being returned from dlerror(), and I'm not finding alot of helpful discussion on it.
__________________
API is offline
Send a message via AIM to API
API
Veteran Member
Join Date: May 2006
Old 02-13-2012 , 17:43   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #8

Additionally if that doesn't work you should try linking libc
__________________
API is offline
Send a message via AIM to API
taansari
Member
Join Date: Nov 2011
Old 02-14-2012 , 02:35   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #9

Quote:
Originally Posted by pimpinjuice View Post
Additionally if that doesn't work you should try linking libc
Hi pimpinjuice

Total lib files present inside hlsdk folder are:

Code:
hl2sdk/linux_sdk/choreoobjects_i486.a
hl2sdk/linux_sdk/mathlib_i486.a
hl2sdk/linux_sdk/tier1_i486.a
And the .so files are:

Code:
hl2sdk/linux_sdk/tier0_i486.so
hl2sdk/linux_sdk/vstdlib_i486.so
I've tried linking against all .a files. But I didn't specify/mention of any .so files inside code::blocks.

How should I add tier0_i486.so and vstdlib_i486.so inside code::blocks?

FYI, adding all .a files did not work for me.

Thanks for your guidance...
taansari is offline
taansari
Member
Join Date: Nov 2011
Old 02-15-2012 , 04:02   Re: My episode1 plugin loads fine in Windows, but not in Linux
Reply With Quote #10

Hi

Please let me post all code, details regarding the stub_mm plug-in which builds fine but is not loaded by Linux-Ep1 server.

.H file:
Code:
/**
 * vim: set ts=4 sw=4 tw=99 noet :
 * ======================================================
 * Metamod:Source Stub Plugin
 * Written by AlliedModders LLC.
 * ======================================================
 *
 * This software is provided 'as-is', without any express or implied warranty.
 * In no event will the authors be held liable for any damages arising from
 * the use of this software.
 *
 * This stub plugin is public domain.
 */

#ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
#define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_

#ifndef WIN32
#define _vsnprintf vsnprintf
#define stricmp strcasecmp
#endif

#include <ISmmPlugin.h>

#if defined WIN32 && !defined snprintf
#define snprintf _snprintf
#endif


class StubPlugin : public ISmmPlugin
{
public:
    bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
    bool Unload(char *error, size_t maxlen);
    bool Pause(char *error, size_t maxlen);
    bool Unpause(char *error, size_t maxlen);
    void AllPluginsLoaded();
public:
    const char *GetAuthor();
    const char *GetName();
    const char *GetDescription();
    const char *GetURL();
    const char *GetLicense();
    const char *GetVersion();
    const char *GetDate();
    const char *GetLogTag();
};

void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);

extern StubPlugin g_StubPlugin;

PLUGIN_GLOBALVARS();

#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
.CPP file:
Code:
/**
 * vim: set ts=4 sw=4 tw=99 noet :
 * ======================================================
 * Metamod:Source Stub Plugin
 * Written by AlliedModders LLC.
 * ======================================================
 *
 * This software is provided 'as-is', without any express or implied warranty.
 * In no event will the authors be held liable for any damages arising from
 * the use of this software.
 *
 * This stub plugin is public domain.
 */

#include <stdio.h>
#include "stub_mm.h"

SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);

StubPlugin g_StubPlugin;
IServerGameDLL *server = NULL;

PLUGIN_EXPOSE(StubPlugin, g_StubPlugin);
bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
    PLUGIN_SAVEVARS();

    /* Make sure we build on MM:S 1.4 */
#if defined METAMOD_PLAPI_VERSION
    GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
#else
    GET_V_IFACE_ANY(serverFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
#endif

    SH_ADD_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, server, Hook_ServerActivate, true);

    return true;
}

bool StubPlugin::Unload(char *error, size_t maxlen)
{
    SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, server, Hook_ServerActivate, true);

    return true;
}

void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
    META_LOG(g_PLAPI, "ServerActivate() called: edictCount = %d, clientMax = %d", edictCount, clientMax);
}

void StubPlugin::AllPluginsLoaded()
{
    /* This is where we'd do stuff that relies on the mod or other plugins
     * being initialized (for example, cvars added and events registered).
     */
}

bool StubPlugin::Pause(char *error, size_t maxlen)
{
    return true;
}

bool StubPlugin::Unpause(char *error, size_t maxlen)
{
    return true;
}

const char *StubPlugin::GetLicense()
{
    return "Public Domain";
}

const char *StubPlugin::GetVersion()
{
    return "1.0.0.0";
}

const char *StubPlugin::GetDate()
{
    return __DATE__;
}

const char *StubPlugin::GetLogTag()
{
    return "STUB";
}

const char *StubPlugin::GetAuthor()
{
    return "AlliedModders LLC";
}

const char *StubPlugin::GetDescription()
{
    return "Sample empty plugin";
}

const char *StubPlugin::GetName()
{
    return "Stub Plugin";
}

const char *StubPlugin::GetURL()
{
    return "http://www.sourcemm.net/";
}
In above kindly note I've added a define, without which plug-in was not compiling:

Code:
#ifndef WIN32
#define _vsnprintf vsnprintf
#define stricmp strcasecmp
#endif
Please note additional files/dependancies I've set up:

Linker:
Code:
../../../hl2sdk/linux_sdk/tier1_i486.a
Compiler options:
Code:
-W
-O0
-msse
Defines:
Code:
_LINUX
_DEBUG
_USRDLL
STUB_MM_EXPORTS
SOURCE_ENGINE=1
SE_EPISODEONE=1
SE_DARKMESSIAH=2
SE_ORANGEBOX=3
SE_ORANGEBOXVALVE=4
SE_LEFT4DEAD=5
SE_LEFT4DEAD2=6
SE_ALIENSWARM=7
Search directories:
Code:
                    <"../../core-legacy/sourcehook" />
                    <"../../../hl2sdk/public" />
                    <"../../../hl2sdk/public/dlls" />
                    <"../../../hl2sdk/public/engine" />
                    <"../../../hl2sdk/public/tier0" />
                    <"../../../hl2sdk/public/tier1" />
                    <"../../../hl2sdk/public/vstdlib" />
Error I get while trying to load:

Code:
Failed to load plugin addons/stub/bin/stub_mm  ([2]).
Currently I am using metamod 1.9 dev version (but initially I was using the stable 1.8 version which was also not working):
Code:
Metamod:Source version 1.9.0-dev
Build ID: 768:e6394d70ced0-dev
Loaded As: Valve Server Plugin
Compiled on: Dec 12 2011
Plugin interface version: 11:7
SourceHook version: 4:4
http://www.metamodsource.net/
Any ideas for this thing? Is it just with me, or is Linux-Ep1 no longer being supported?

Thanks for reading this, and for your time.
taansari 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 09:01.


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