Jump to content
  • 0
mofo

Compiling plugins - How To (linux)

Question

I don't know how to compile a plugin using linux so I started this topic in order to figure out where it went wrong. I hope this will serve as a guide to those who want to use plugins as well. Here's what I did so far.

 

1. Download Ind's SkillErrorMessage.c plugin file.

2. Put the plugin file in src/plugins folder.

3. Add the plugin names in /conf/plugins.conf file.

4. Edit Makefile.in following this guide... http://herc.ws/wiki/Building_HPM_Plugin_for_gcc

5. "./configure"

6. "make plugins"

 

 

It doesn't work for me, when I start the server, the console says...

 

HPM:plugin_load: failed to load 'plugins/sample.so', skipping

 

So if anyone knows what I missed or did wrong, please tell me.

 

I didn't know I needed to "make plugins" in order to get it to work so thanks to Xgear. It works now but my console gets stuck at "Awaiting maps from map server." whenever I enable plugins (also happens when I enable PK). I don't have major source edits to my folder so I don't know why it stops there. But it does say the plugins are loaded, so I guess it's mission accomplished.

Edited by mofo

Share this post


Link to post
Share on other sites

21 answers to this question

Recommended Posts

  • 0

It seems to have worked. I can see 1 plugin loaded. But my console is now stuck at "Awaiting maps from map server". This also happens to me when I try to enable PK in my server. Anyhow, I'll try with a different plugin and see if that works.

 

update - Still gets stuck regardless of plugin used. But it could be an isolated case. The goal of the topic is list the steps to use plugins with linux, so I'll consider this a partial success. Thanks

Edited by mofo

Share this post


Link to post
Share on other sites
  • 0

Map server not loading after enabling plugins, that's what i think is happening to me also,

 

Maybe someone who's able to run their plugins in linux might share how they actually did it, :)

Share this post


Link to post
Share on other sites
  • 0

Could you provide some of the plugins you're using? I just tried with the default sample plugin and it loaded fine, so there could be issues with the specific plugin you're trying to load. 

If the plugin relies on functions overloading and the functions are core functions that change, the plugin might not work properly. 

Every plugin coder should keep their plugins up-to-date to avoid them breaking, specially now that the code is still being overwritten to work with the HPM, so development that could cause some conflicts is still pretty big. 

However, if I remember correctly, if a plugin has some sort of conflict it shouldnt load (Which is the function of the HPM value)

Share this post


Link to post
Share on other sites
  • 0

Could you provide some of the plugins you're using? I just tried with the default sample plugin and it loaded fine, so there could be issues with the specific plugin you're trying to load.

If the plugin relies on functions overloading and the functions are core functions that change, the plugin might not work properly.

Every plugin coder should keep their plugins up-to-date to avoid them breaking, specially now that the code is still being overwritten to work with the HPM, so development that could cause some conflicts is still pretty big.

However, if I remember correctly, if a plugin has some sort of conflict it shouldnt load (Which is the function of the HPM value)

what is bugging me is wiy is it working in windows and not in linux,

 

just tried the afk plugin

Share this post


Link to post
Share on other sites
  • 0

I just tried it using CentOS and Windows and the plugin worked fine... You are most likely missing some steps of the guides. 

Add the source to src/plugins

Edit src/plugins/Makefile accordingly: (This is what mine looks like)

COMMON_H = ../common/HPMi.h ../common/cbasetypes.hPLUGINS = sample db2sql afk#####################################################################.PHONY : all $(PLUGINS) sample db2sql clean helpall: $(PLUGINS)sample: sample.sodb2sql: db2sql.soafk: afk.soclean:        @echo " CLEAN   plugins"        @rm -rf *.ohelp:        @echo "possible targets are $(PLUGINS:%='%') 'all' 'clean' 'help'"        @echo "'sample'   - sample plugin"        @echo "'help'     - outputs this message"#####################################################################%.so: %.c $(COMMON_H)        @echo " CC      $<"        @gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAV$

(nano kiled the final line, so nevermind that)

 

run "make plugins" from within your server's directory (aka ~/Hercules/)

edit conf/plugins.conf and add "afk" into the array (this is what mine looks like)

//====================================================//=       _   _                     _//=      | | | |                   | |//=      | |_| | ___ _ __ ___ _   _| | ___  ___//=      |  _  |/ _  '__/ __| | | | |/ _ / __|//=      | | | |  __/ | | (__| |_| | |  __/__ //=      _| |_/___|_|  ___|__,_|_|___||___///=//=            http://herc.ws/board///====================================================//== Topic Discussion ================================//== http://herc.ws/board/topic/549-introducing-hercules-plugin-manager///====================================================//== Description =====================================//The plugin system allows you to create customized scripts//outside of the source. These scripts won't conflict with any//future source updates - think of it as a /conf/import/ for the source.//====================================================/* --------------- Format ---------------After you have listed your  plugin(s) in "quotations",you need to put in a comma, to separate the plugins.-----------------------------------------plugins_list: [        "example",        "other"]-----------------------------------------Please note that your scripts need to be savedin the .c (source code) extension and placed in the /src/plugin/ folder.-----------------------------------------*/plugins_list:[        //"db2sql",        //"sample",        //"other"        "afk"]

Restart...

Voila...

Share this post


Link to post
Share on other sites
  • 0

sample: sample.so

db2sql: db2sql.so

afk: afk.so

 

this is the problem i think, it's different from the one in the wiki,

 

I use something like afk@dllext@ since that's what the wiki says

 

i will try later when I get home

Share this post


Link to post
Share on other sites
  • 0

This would only affect how the plugin is compiled (or if it is compiled). If I am not wrong, Makefile Variables are case sensitive, which means @dllext@ != @DLLEXT@

 

The guide on the wiki is a basic template and as it states, is similar to what it should look like.

For example, in my Makefile, I have this line:

sample: sample.so

While on the wiki, it shows as

sample: sample@DLLEXT@

 

So if I wanna implement my plugin I need to follow my own Makefile (generated for my compilers) and copy the entries as needed. (Pretty much try to copy any entry of "sample" available, except for the 'help' one :P)

 

Also, if you say you have the afk.so @ ~/Hercules/plugins/ the plugin should've been properly compiled. 

Edited by Xgear

Share this post


Link to post
Share on other sites
  • 0

Could you provide some of the plugins you're using? I just tried with the default sample plugin and it loaded fine, so there could be issues with the specific plugin you're trying to load. 

If the plugin relies on functions overloading and the functions are core functions that change, the plugin might not work properly. 

Every plugin coder should keep their plugins up-to-date to avoid them breaking, specially now that the code is still being overwritten to work with the HPM, so development that could cause some conflicts is still pretty big. 

However, if I remember correctly, if a plugin has some sort of conflict it shouldnt load (Which is the function of the HPM value)

 

I don't know if my issue is solely plugin related since it also happens when I enable PK. I can see the plugin being loaded after I managed to compile it. It always stops at "awaiting maps from map server". I'm on centos and I really couldn't figure out why that happens even with a clean version of the emulator.

Share this post


Link to post
Share on other sites
  • 0

Does your char server go down/unable to connect to/map server doesnt connect to/ seems to stall? (aka kill the proccess and it doesnt go down?)

Share this post


Link to post
Share on other sites
  • 0

I lost my screenshot but what happens is I can see it saying 1 plugin loaded. After that it looks ok then more lines, until it stalls at "awaiting maps from map server". If I disable the plugin or if I don't enable PK, it goes on without a hitch.

Share this post


Link to post
Share on other sites
  • 0

Does your char server go down/unable to connect to/map server doesnt connect to/ seems to stall? (aka kill the proccess and it doesnt go down?)

I used the Sample.c plugin and this happens.

Untitled_zpsf4433a2e.png

The terminal just stays like that. When I try to login I get rejected by server. No disconnect or error message on terminal.

Share this post


Link to post
Share on other sites
  • 0

 

Does your char server go down/unable to connect to/map server doesnt connect to/ seems to stall? (aka kill the proccess and it doesnt go down?)

I used the Sample.c plugin and this happens.

Untitled_zpsf4433a2e.png

The terminal just stays like that. When I try to login I get rejected by server. No disconnect or error message on terminal.

Your map-server is not running, recompile the server and check if compiling gives error, or try running

./map-server &

and check if it gives some error.

Edited by dastgirpojee

Share this post


Link to post
Share on other sites
  • 0

Actually map server is loaded.. the HPM Message only comes from the Map Server if I remember correctly.

 

You have one plugin loaded, is it the afk one? Are you running the latest revision?

The map server seems to stall after loading the plugin (It isnt reading conf or anything)

Could you provide some more info like which os are you running and which compiler/version are you using? 

Share this post


Link to post
Share on other sites
  • 0

Actually map server is loaded.. the HPM Message only comes from the Map Server if I remember correctly.

 

You have one plugin loaded, is it the afk one? Are you running the latest revision?

The map server seems to stall after loading the plugin (It isnt reading conf or anything)

Could you provide some more info like which os are you running and which compiler/version are you using? 

 

Having the same problem with mofo.

 

Using centos 5 x 86

 

when i use gcc -dumpversion = 4.1.2

gcc -dumpmachine = i386-redhat-linux

Share this post


Link to post
Share on other sites
  • 0

@Xgear

The plugin that loaded on that screenshot is Sample.c, I get the same results with SkillErrorMessages and mapmoblist. I'm running the same OS Samuel listed.

Share this post


Link to post
Share on other sites
  • 0

I am using the very same specs on a x64 machine without any issues.

 

Could you run the map server alone (./map-server) and paste the entire output here?

Also as an addition for whatever it might be worth, could you post the output of: 

 

gcc -E -v - </dev/null 2>&1

Just in case it can provide anything useful... 

 

Also for the sake of it, once map server stops loading or freezes or whatever do a "ps x" to make sure its still running and it didnt exit/crsh for whatever reason while loading the plugins. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.