Author |
Message |
tcsoccerman guest Guest
Offline
|
Posted: 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. |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: 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:
troops_mods = troops
$(eval $(call dl_template,troops)) |
and i went to asss/src/ and did a "make deps" and got this:
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
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:
make: *** No targets. Stop.
|
Any ideas? |
|
Back to top |
|
|
BDwinsAlt Agurus's Posse
Age:33 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: 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. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: 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? |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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
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. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: 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? |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sun Dec 13, 2009 9:47 pm Post subject: |
|
|
|
|
You build everything (including your module) with a "make" in src. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: 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. |
|
Back to top |
|
|
|