Makefile For DBS2.0 Problems

Posted by Jeremy_S on Wed 18 Mar 2009 06:48 AM — 19 posts, 85,226 views.

#0
Well, I am very new to Coding and I am trying to create a Dragonball Mud. I have everything that I need and cyg seems to work just fine but. I am having problems with my Makefile. When I make I get the same errors and I am not sure what to do about it can anyone help. Here is the error message.



comm.o: In function 'write_to_descriptor':
/home/owner/dbs2.0/src/comm.c:1761: undefined reference to '_deflate'
comm.o: In function 'compressStart':
/home/owner/dbs2.0/src/comm.c:5681: undefined reference to '_deflateInit_'
comm.o: In function 'compressEnd':
/home/owner/dbs2.0/src/comm.c:5716: undefined reference
to 'deflate' /home/owner/dbs2.0/src/comm.c:5722: undefined reference to '_deflateEnd'
fight.o: In function 'damage':
/home/owner/dbs2.0/src/fight.c:2545: undefined reference to
'_floor1'
/home/owner/dbs2.0/src/fight.c:2558: undefined reference to
'_floor1'
collect2: ld returned 1 exit status
make[1]: ***[dbs] Error 1
make[1]: Leaving directory '/home/owner/dbs2.0/src'
make: *** [all] Error 2
Amended on Wed 18 Mar 2009 07:32 AM by Jeremy_S
Australia Forum Administrator #1
You need to install zlib. Search this forum for posts about that if you are not sure how.
#2
I have zlib 1.2.3-3
zlib-devel 1.2.3-3
and zlib0 1.2.3-3

I used cygcheck to see what I have and those are it. They should work right? I reinstalled Cygwin with the addition of a few extra lib and zlib packages but it still comes up with the same error.
Amended on Wed 18 Mar 2009 03:34 PM by Jeremy_S
USA #3
The Makefile needs to be correct as well, for example see http://www.gammon.com.au/forum/bbshowpost.php?id=9199
#4
I'm not exactly sure what to edit within the makefile. Here is the makefile.

CC = gcc
#PROF = -p
NOCRYPT =

# Uncomment the line below if you have problems with math functions
MATH_LINK = -lm

# Uncomment the two lines below if compiling on a Solaris box
#SOLARIS_FLAG = -Dsun -DSYSV
#SOLARIS_LINK = -lnsl -lsocket

#Uncomment the line below if you are getting a line like:
#interp.c:757: warning: int format, time_t arg (arg 7)
TIME = -DTIMEFORMAT

#Uncomment the line below if you are getting implicit decleration of re_exec
#REG = -DREGEX

#Uncomment the line below if you are getting undefined re_exec errors
NEED_REG = -lgnuregex

#Uncomment the line below if you are getting undefined crypt errors
#NEED_CRYPT = -NOCRYPT

#DBUGFLG = -DREQUESTS

#Uncomment the line below if you want a performance increase though beware
#your core files may not be as much of a benefit if you do.
#OPT_FLAG = -finline-functions -funroll-loops -fdefer-pop -fstrength-reduce
OPT_FLAG = -DMCCP

C_FLAGS = $(OPT_FLAG) -O -g3 -Wall -Wuninitialized $(PROF) $(NOCRYPT) $(DBUGFLG) -DSMAUG $(SOLARIS_FLAG) $(TIME) $(REG)
L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT) ${MATH_LINK} -lz

#D_FLAGS : For the DNS Slave process. No need in linking all the extra libs for this.
D_FLAGS = -g3 -O $(PROF) $(SOLARIS_LINK)

#Uncomment the next three comments below if you want to use IMC
#USE_IMC = -DUSE_IMC

#IMC_OFILES = imc.o imc-mail.o imc-interp.o imc-util.o imc-config.o \
# imc-events.o imc-version.o imc-mercbase.o ice.o icec.o icec-mercbase.o

#IMC_CFILES = imc.c imc-mail.c imc-interp.c imc-util.c imc-config.c \
# imc-events.c imc-version.c imc-mercbase.c ice.c icec.c icec-mercbase.c

O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o ban.o \
board.o boards.o bounty.o build.o clans.o colorize.o comm.o \
comments.o const.o db.o deity.o editor.o fight.o finger.o grub.o \
handler.o hashstr.o hiscores.o hotboot.o house.o ibuild.o ident.o \
imm_host.o interp.o magic.o makeobjs.o malloc.o mapout.o marry.o \
misc.o mpxset.o mud_comm.o mud_prog.o new_fun.o pfiles.o planes.o \
planet.o player.o polymorph.o rare.o requests.o reset.o save.o \
services.o shops.o skills.o skills_android.o skills_dbs.o space.o \
special.o stat_obj.o tables.o track.o update.o dns.o

C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c ban.c \
board.c boards.c bounty.c build.c clans.c colorize.c comm.c \
comments.c const.c db.c deity.c editor.c fight.c finger.c grub.c \
handler.c hashstr.c hiscores.c hotboot.c house.c ibuild.c ident.c \
imm_host.c interp.c magic.c makeobjs.c malloc.c mapout.c marry.c \
misc.c mpxset.c mud_comm.c mud_prog.c new_fun.c pfiles.c planes.c \
planet.c player.c polymorph.c rare.c requests.c reset.c save.c \
services.c shops.c skills.c skills_android.c skills_dbs.c space.c \
special.c stat_obj.c tables.c track.c update.c dns.c

H_FILES = mud.h bet.h board.h finger.h hotboot.h house.h pfiles.h rare.h

all:
make dbs

dbs: $(O_FILES)
rm -f dbsaga
$(CC) $(L_FLAGS) $(USE_IMC) -o dbsaga $(O_FILES)
chmod g+w dbsaga
chmod a+x dbsaga
chmod g+w $(O_FILES)

dbs2: $(O_FILES)
rm -f dbsaga2
$(CC) $(L_FLAGS) $(USE_IMC) -o dbsaga2 $(O_FILES)
chmod g+w dbsaga2
chmod a+x dbsaga2
chmod g+w $(O_FILES)

dns: resolver.o
rm -f resolver
$(CC) $(D_FLAGS) -o resolver resolver.o
chmod g+w resolver
chmod a+x resolver
chmod g+w resolver.o

.c.o: mud.h
$(CC) -c $(C_FLAGS) $(USE_IMC) -DNOCRYPT $<

clean:
rm -f *.o dbsaga *~
Australia Forum Administrator #5
Where did you get the source exactly? I'll try it myself.
#6
The Cyg source was http://cygwin.elite-systems.org

The makefile and codebase was: http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/d/db/dbsaga/

The zlib from http://www.zlib.net/
Australia Forum Administrator #7
I thought this problem sounded familiar. :)

It is in the Makefile. You need to change:


dbs: $(O_FILES)
    rm -f dbsaga
    $(CC) $(L_FLAGS) $(USE_IMC) -o dbsaga $(O_FILES) -lcrypt 
    chmod g+w dbsaga
    chmod a+x dbsaga
    chmod g+w $(O_FILES)


to:


dbs: $(O_FILES)
    rm -f dbsaga
    $(CC) $(USE_IMC) -o dbsaga $(O_FILES) -lcrypt $(L_FLAGS)
    chmod g+w dbsaga
    chmod a+x dbsaga
    chmod g+w $(O_FILES)


The problem is that the linker is told to use the zlib library before any object files that need it, so it ignores it. If you put the flags at the end, the link succeeds.
#8
Ok I will try it and let you know. Thank you very much for your help so far I really appreciate it.
#9
Ok, I made the adjustments and then I had to search through my fight.o file to make a few adjustments and now my makfile has ran and completed. Now my startup file is having problems..:(
Error Message as follows:


$ ./startup
limit: Command not found.
ulimit: Command not found.
mv: cannot stat '../log/syslog.8': No such file or directory
mv: cannot stat '../log/syslog.7': No such file or directory
mv: cannot stat '../log/syslog.6': No such file or directory
mv: cannot stat '../log/syslog.5': No such file or directory
mv: cannot stat '../log/syslog.4': No such file or directory
mv: cannot stat '../log/syslog.3': No such file or directory
mv: cannot stat '../log/syslog.2': No such file or directory
mv: cannot stat '../log/syslog.1': No such file or directory
mv: cannot stat 'backup/dbsbackup.current.tar.gz': No such file or directory
tar: backup/exclude.list: No such file or directory
tar: Error is not recoverable: exiting now
dbs/area: No such file or directory.

Not sure what this means. Here is my startup file.
Sorry for spamming screen:


set port = 9000
if ( "$1" != "" ) set port="$1"

# Change to area directory.
cd ../area

# Set limits.
nohup
nice
limit stack 1024k
ulimit -Sc unlimited
if ( -e shutdown.txt ) rm -f shutdown.txt

while ( 1 )
# If you want to have logs in a different directory,
# change the 'set logfile' line to reflect the directory name.

# rm ../log/syslog.9
# We have space to archive old log files now...
if ( -e ../log/syslog.9 ) then
set index = 1000
while ( 1 )
set archivefile = ../log/archived/$index.log
if ( ! -e $archivefile ) break
@ index++
end
mv ../log/syslog.9 $archivefile
endif

mv ../log/syslog.8 ../log/syslog.9
mv ../log/syslog.7 ../log/syslog.8
mv ../log/syslog.6 ../log/syslog.7
mv ../log/syslog.5 ../log/syslog.6
mv ../log/syslog.4 ../log/syslog.5
mv ../log/syslog.3 ../log/syslog.4
mv ../log/syslog.2 ../log/syslog.3
mv ../log/syslog.1 ../log/syslog.2
mv ../log/syslog.log ../log/syslog.1
#touch ../log/syslog.log

# start DBSaga tarball backup
cd ../../
mv backup/dbsbackup.current.tar.gz backup/dbsbackup.previous.tar.gz
tar -czf backup/dbsbackup.current.tar.gz -X backup/exclude.list ./dbs
cd dbs/area
# end DBSaga tarball backup

cp ../system/hiscores.dat ../system/hiscores.bak

set logfile = ../log/syslog.log

# Record starting time
date > $logfile
date > ../area/boot.txt

# Record initial charges
# charges >> $logfile

# Run SMAUG.
# NO! Run DBSaga!
../src/dbsaga 9000 >&! $logfile

# ../src/smaug 7654 >&! $logfile
# ../src/smaug $port >&! $logfile
# ../src/smaug >>&! $logfile

# Record ending charges
# charges >> $logfile

# # Delete this out if no adb.
# if ( -e core ) then
# echo '$c' | adb ../src/smaug
# endif

# Let's see if this works...
# Using old index value, would be nice to have
# it be the date for the file name
if ( -e core ) then
set index = 1000
while ( 1 )
set crashfile = ../crash/$index.crash
if ( ! -e $crashfile ) break
@ index++
end
\mv core ../src
cd ../src
date > $crashfile
gdb -batch -x commands dbsaga core >> $crashfile
# mv core ../crash/core.$index
rm -f core
cd ../area
endif

# Restart, giving old connections a chance to die.
if ( -e shutdown.txt ) then
rm -f shutdown.txt
exit 0
endif
sleep 10
end

USA #10
How are you starting the MUD? Are you in src directory?

Do you have an area directory?
#11
I am starting the mud with ./startup within src.
It says that I don't have area directory but I do.
There are two startup files that came with my DBS download. The other startup file (which doesn't seem to work either) is this:

#!/bin/csh -f

# Set the port number.
set port = 9000
if ( "$1" != "" ) set port="$1"

# Change to area directory.
cd ../area

# Set limits.
nohup
nice
limit stack 1024k
ulimit -Sc unlimited
if ( -e shutdown.txt ) rm -f shutdown.txt

while ( 1 )
# If you want to have logs in a different directory,
# change the 'set logfile' line to reflect the directory name.

cp ../log/start2.log ../log/start2.bak
cp ../system/hiscores.dat ../system/hiscores.bak

set logfile = ../log/start2.log

# Record starting time
date > $logfile
date > ../area/boot.txt

# Record initial charges
# charges >> $logfile

# Run SMAUG.
# NO! Run DBSaga!
../src/dbsaga 9001 >&! $logfile

# ../src/smaug 7654 >&! $logfile
# ../src/smaug $port >&! $logfile
# ../src/smaug >>&! $logfile

# Record ending charges
# charges >> $logfile

# # Delete this out if no adb.
# if ( -e core ) then
# echo '$c' | adb ../src/smaug
# endif

# Let's see if this works...
# Using old index value, would be nice to have
# it be the date for the file name
if ( -e core ) then
set index = 1000
while ( 1 )
set crashfile = ../crash/$index.crash
if ( ! -e $crashfile ) break
@ index++
end
\mv core ../src
cd ../src
date > $crashfile
gdb -batch -x commands dbsaga core >> $crashfile
rm -f core
cd ../area
endif

# Restart, giving old connections a chance to die.
if ( -e shutdown.txt ) then
rm -f shutdown.txt
exit 0
endif
sleep 5
end

Amended on Thu 19 Mar 2009 01:45 PM by Jeremy_S
Australia Forum Administrator #12
First, make sure you have a "log" directory at the same level as the src and area directories.
#13
I do, it is an empty file/ dir.
It is in my dbs2.0 dir, the log dir itself
is not within my src dir. The area dir also is only within
the dbs2.0 dir. It is not within src, do they have to be within src?
I tried putting log and area files within src and that gave me this:

$ ./startup
../area: No such file or directory
Amended on Fri 20 Mar 2009 03:23 AM by Jeremy_S
USA #14
The log errors are fine, that won't stop startup. Pretty sure this is stopping it:
Quote:
dbs/area: No such file or directory.


In your script you have:
cd dbs/area

Change that to the correct folder names you have.
Amended on Fri 20 Mar 2009 03:31 AM by Zeno
#15
Well I rewrote the directory for dbs2.0/area. That eliminated a few things but I still get this and then it does nothing and I can no longer type in cyg.

$ ./startup
limit: Command not found.
ulimit: Command not found.
mv: cannot stat '../log/syslog.8': No such file or directory
mv: cannot stat '../log/syslog.7': No such file or directory
mv: cannot stat '../log/syslog.6': No such file or directory
mv: cannot stat '../log/syslog.5': No such file or directory
mv: cannot stat 'backup/dbsbackup.current.tar.gz': No such file or directory
tar: backup/exclude.list: No such file or directory
tar: Error is not recoverable: exiting now

I have officially logged onto the mud with MUSH. Everything seems to be working well. Will it run succesfully and "smoothly" even with the log errors?
Amended on Fri 20 Mar 2009 12:42 PM by Jeremy_S
USA #16
You should be starting the MUD up like:
./startup &

Or:
nohup ./startup &


Yes, it'll run fine with those errors. It just couldn't rotate logs or backup the MUD.
#17
Alright I probably won't see a response since this is such an old topic but I started off having the same problems as a different poster and it ended up leading me to this post. I've done what was needed to be done and I changed the makefile to have the changes that Gammon suggested. When I type make again I get "Makefile:74: *** missing separator. Stop."

Just wondering what I did to make it do that? I am a very newbie coder so I apologize in advance.
Australia Forum Administrator #18
One possible thing is that you typed in some spaces at the start of the line. Rather confusingly, the make program distinguishes between leading spaces and a tab.

Make sure you have a tab as the first character. Use an editor (eg. Crimson Editor) that lets you see tabs.

If that doesn't to it post the file and indicate which is line 74.