Server Help

ASSS Questions - compiling modules in linux

Anonymous - Sat Dec 12, 2009 9:48 pm
Post subject: compiling modules in linux
Hey everyone, i'm back!

I'm just curious if there is a tutorial or wiki page that explains how to make and compile a simple module in asss on linux. I've been searching for a while and can't find anything.

Thank you.
Dr Brain - Sat Dec 12, 2009 10:05 pm
Post subject:
Once you've got the basic asss core compiling on linux (and you really should do that first), then adding a new module is relatively easy:

1. make a new directory for the module in src/, e.g. src/my_mod
2. create a new .mk file for it, e.g. src/my_mod/my_mod.mk. Look at the other .mk files for examples. Post if you get confused on this step and I'll provide an example.
3. create/copy the source file into the directory, e.g. src/my_mod/my_mod.c
4. run "make" in the src directory. A "make deps" may be necessary after the first creation of source files.
5. enjoy your new module

Sorry if this post was a bit rushed, but it should be enough to get you started. Let me know if you need clarification on any point.
JoWie - Sun Dec 13, 2009 8:17 am
Post subject:
http://wiki.minegoboom.com/index.php/Installing_New_Modules#Using_Makefile_fragments
tcsoccerman - Sun Dec 13, 2009 11:35 am
Post subject:
Thank you for the reply.

I'm having trouble with my make file.

I named it troops.mk and put it in src/troops/ and put this code in it:

Code: Show/Hide
troops_mods = troops

$(eval $(call dl_template,troops))


and i went to asss/src/ and did a "make deps" and got this:

Code: Show/Hide
python ../scripts/makedeps.py -I. -Iinclude -I../build  -D_REENTRANT -D_GNU_SOURCE -fPIC -I/opt/db-4.0.14/include -I/opt/mysql/include -I/usr/include/python2.4 \
      */*.c -P '$(BUILDDIR)/' -o ../build/deps.mk
makedeps: ignoring option: -D_REENTRANT
makedeps: ignoring option: -D_GNU_SOURCE
makedeps: ignoring option: -fPIC
makedeps: ignoring option: -I/opt/db-4.0.14/include
makedeps: ignoring option: -I/opt/mysql/include
makedeps: ignoring option: -I/usr/include/python2.4
makedeps: warning: "pthread.h" not found
makedeps: warning: "zlib.h" not found
makedeps: warning: "mysql.h" not found
makedeps: warning: "db.h" not found
makedeps: warning: "errno.h" not found
makedeps: warning: "Python.h" not found
makedeps: warning: "structmember.h" not found
makedeps: warning: "troops.h" not found


(troops.h is one of my modules files)

then i called make in asss/src and got
Code: Show/Hide

gcc -std=gnu99 -pipe -I. -Iinclude -I../build  -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall   -c -o ../build/admincmd.o core/admincmd.c
core/admincmd.c: In function ?Cdelfile?:
core/admincmd.c:63: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:63: error: (Each undeclared identifier is reported only once
core/admincmd.c:63: error: for each function it appears in.)
core/admincmd.c:63: warning: unused variable ?path?
core/admincmd.c:63: warning: unused variable ?wd?
core/admincmd.c: In function ?Crenfile?:
core/admincmd.c:85: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:85: warning: unused variable ?newpath?
core/admincmd.c:85: warning: unused variable ?oldpath?
core/admincmd.c:85: warning: unused variable ?wd?
core/admincmd.c: In function ?Cgetfile?:
core/admincmd.c:124: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:124: warning: unused variable ?path?
core/admincmd.c:124: warning: unused variable ?wd?
core/admincmd.c: In function ?Cputfile?:
core/admincmd.c:241: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:241: warning: unused variable ?serverpath?
core/admincmd.c:241: warning: unused variable ?wd?
core/admincmd.c: In function ?Cputzip?:
core/admincmd.c:288: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:288: warning: unused variable ?serverpath?
core/admincmd.c:288: warning: unused variable ?wd?
core/admincmd.c: In function ?Cpwd?:
core/admincmd.c:379: error: ?PATH_MAX? undeclared (first use in this function)
core/admincmd.c:379: warning: unused variable ?wd?
make: *** [../build/admincmd.o] Error 1


it looks like it isn't compiling, which prob. has something to do w/ my newly added module because it compiled successfully when i compiled it on a clean install.

Lastly, when i try and "make -f troops.mk" in src/troops/ (my custom module), i get this:

Code: Show/Hide
make: *** No targets.  Stop.


Any ideas?
BDwinsAlt - Sun Dec 13, 2009 12:48 pm
Post subject:
Edit: Hmm didn't read the last part of your post. Make sure your using the right options, check your cases, I don't think the Makefile is setup correctly.
tcsoccerman - Sun Dec 13, 2009 1:54 pm
Post subject:
I think there is something wrong w/ the way I am calling the make in terminal, because when I try to make turf.mk, I get the same errors. So to clarify:

1. cd /home/scott/asss-1.4.4/src/turf/
2. make deps
3. make -f turf.mk

Right? Or am i doing something wrong?
Dr Brain - Sun Dec 13, 2009 3:20 pm
Post subject:
No, you were doing it right the first time. You're using an older version of ASSS without the patch on admincmd.c. You have to add
Code: Show/Hide

#include <limits.h>

near the top of admincmd.c. The errors weren't about your new stuff, they were about compiling parts of the core.

There's nothing to be concerned about with those warnings for make deps.
tcsoccerman - Sun Dec 13, 2009 4:50 pm
Post subject:
Ok. Do you suggest I use the 1.50rc I saw you were working on?

And also, what about my custom module problem?
Dr Brain - Sun Dec 13, 2009 5:38 pm
Post subject:
If you're compiling modules to run on a zone, then you should be compiling whatever version they're running (probably 1.4.4). If you're making your own zone then I recommend using the 1.5.0rc1 version.

I didn't see any problems relating to your custom module.
tcsoccerman - Sun Dec 13, 2009 9:18 pm
Post subject:
I switched to 1.5.0rc1 as you suggested since it is my own zone.

I'm stilling having trouble compiling my own module though. "make deps" and "make -f troops.mk" in "~/asss-1.5.0rc1/src/troops/" still returns "make: *** No rule to make target `deps'. Stop." and "'make: *** No targets. Stop." respectively and does not make any .so file.

my troops.mk:

Code: Show/Hide
troops_mods = troops

$(eval $(call dl_template,troops))


Thanks for the help.

EDIT: I am trying all of this after compiling asss as a whole.
Dr Brain - Sun Dec 13, 2009 9:47 pm
Post subject:
You build everything (including your module) with a "make" in src.
tcsoccerman - Sun Dec 13, 2009 10:43 pm
Post subject:
Ohhhh... I get it now.

I got it to work thank you.the problem was actually with python. I just set have_python or w/e that variable is in system.mk to 'no'. Will have to fix that later.

Thank you.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group