DBSaga Compiling Issues

Posted by Ohlookadime on Thu 01 Oct 2020 04:16 AM — 22 posts, 74,636 views.

#0
Hello everyone OLaD here. I'm new to coding and found this old DBSaga codebase. I've spent a week on this forum and other boards trying to get this to compile on my widows 10 x64 with cygwin.

I know this has been addressed many times and is an old topic. I hope you all are still around to help a newbie like me!

This is the newest result of running 'make' in cygwin.

NOTE; per instructions with the read me with the code, the folder dbs is moved into the c:\cygwin64\home\ohloo\ dir


Quote:

OhLoo@LAPTOP-SCPLGT8K ~
$ cd dbs/src

OhLoo@LAPTOP-SCPLGT8K ~/dbs/src
$ make
Makefile:93: warning: ignoring prerequisites on suffix rule definition
Starting the Compile.. ...
make -s dbs
Makefile:93: warning: ignoring prerequisites on suffix rule definition
Compiling DBS - < o/act_comm.o >
make[1]: gcc34: No such file or directory
make[1]: *** [Makefile:90: o/act_comm.o] Error 127
make: *** [Makefile:64: all] Error 2



this is the make file



Quote:

CC = gcc34
#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

#IMC2 - Comment out to disable IMC2 support
IMC = 1

#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 $(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)

O_FILES = $(patsubst %.c,o/%.o,$(C_FILES))

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 changes.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 mapout.c mapper.c marry.c md5.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 skills_genie.c \
new_auth.c

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

#ifdef IMC
# C_FILES := imc.c $(C_FILES)
# O_FILES := imc.o $(O_FILES)
# C_FLAGS := $(C_FLAGS) -DIMC -DIMCSMAUG
#endif

all:
@echo Starting the Compile.. $< ...
$(MAKE) -s dbs

dbs: $(O_FILES)
rm -f dbsaga
$(CC) $(L_FLAGS) -o dbsaga $(O_FILES) -lcrypt
echo "DBS is fully compiled. Enjoy.";
chmod g+w dbsaga
chmod a+x dbsaga
chmod g+w $(O_FILES)

dbs2: $(O_FILES)
rm -f dbsaga2
$(CC) $(L_FLAGS) -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

o/%.o: %.c
echo "Compiling DBS - < $@ >";
$(CC) -c $(C_FLAGS) $< -o $@

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

clean:
@echo Cleaning Code $< ...
rm -f o/*.o dbsaga *~
@echo Done.
Amended on Thu 01 Oct 2020 04:18 AM by Ohlookadime
#1
also this lol



and the startup file



ohlookadime said:

#!/bin/csh -f

# Set the port number.
set port = 6000
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
cd ../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 $port >&! $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






I am so sorry for how this may appear to to bombard the board with it.

thank you all so much for your help in advance.
#2
also this lol



and the startup file



ohlookadime said:

#!/bin/csh -f

# Set the port number.
set port = 6000
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
cd ../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 $port >&! $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






I am so sorry for how this may appear to to bombard the board with it.

thank you all so much for your help in advance.
Australia Forum Administrator #3
The first thing is to get the "make" working and by the look of it you possibly don't have an "o" directory (for the object files) underneath the "src" directory.
#4
There is one already. In the dbs/src dir
Australia Forum Administrator #5
Try running make in debug mode. Possibly:


make --dry-run



You should see echoed what make is trying to do, what files it is sending to gcc (or g++) so you can confirm if the source files exists, and the destination directories exist.
#6
This is what I got. I'm a complete n00b still but I didn't see anything bad.

https://pastebin.com/mkEY8wsf
Australia Forum Administrator #7
Does gcc34 exist? Try typing:


gcc34 --version
#8
There is one already. In the dbs/src dir
Australia Forum Administrator #9
What? Can you please post the output from typing:


gcc34 --version
USA Global Moderator #10
Quote:
Does gcc34 exist?

Quote:
There is one already. In the dbs/src dir

Quote:
What?

LOL. This exchange got me laughing.
Amended on Mon 05 Oct 2020 09:20 PM by Fiendish
#11
lol im sorry about that. I been trying to reply on my phone and its having issues apparently lol. This is what I got from;

gcc34 --ver
Quote:

OhLoo@LAPTOP-SCPLGT8K ~/dbs/src
$ gcc34 --version
-bash: gcc34: command not found


I've reinstalled more gcc packages for cygwin, apparently I don't have the right ones yet lol. Thank y'all for the continued help!


[EDIT]
I have removed the '34' from gcc34 in the make file, that has solved the gcc issue. Now this is showing when I run make again.

https://pastebin.com/SJdkrSpZ
Amended on Tue 06 Oct 2020 01:50 AM by Ohlookadime
Australia Forum Administrator #12
It looks like the same error, over and over for each file. Why you get that message I can't say, as I can't see the source code you are using.
#13
Nick Gammon said:

... as I can't see the source code you are using.


I could upload the archive I have as a zip or is there another way to show you? I'd really like to get this to work.

Thank you.
Australia Forum Administrator #14
Perhaps post the link to where it is?

An occupational hazard of compiling old source code is that compilers have become more strict. They try to stop you doing things like buffer overflow, which people exploit to hack into systems.

Thus, code that compiled 10 or 20 years ago doesn't compile now. So, you need to understand what the code does in order to fix the issues. Sometimes this is not at all simple.
#15
Nick Gammon said:

Perhaps post the link to where it is?



https://ufile.io/28mdf53d




Thanks for all the help, I apologize for the delay in my response.
#16
Anyone have any luck?
Australia Forum Administrator #17
Quote:

I'm new to coding and found this old DBSaga codebase ...


You found it on ufile.io?

I meant, where is the download link of the codebase that you found?
#18
No, that is mine with all the files that I'm using now that I uploaded for ya to look at. I originally found it here

https://sourceforge.net/projects/dbsaga/
Amended on Thu 22 Oct 2020 01:27 PM by Ohlookadime
Australia Forum Administrator #19

o/act_info.o:.../mud.h:1158: multiple definition of `MOBtrigger'; o/act_comm.o:/home/OhLoo/dbs/src/mud.h:1158: first defined here
o/act_info.o:.../mud.h:5601: multiple definition of `note_free'; o/act_comm.o:/home/OhLoo/dbs/src/mud.h:5601: first defined here
o/act_info.o:.../mud.h:364: multiple definition of `top_mob_serial'; o/act_comm.o:/home/OhLoo/dbs/src/mud.h:364: first defined here
...


OK, what is happening here is that the author defined variables in the mud.h file, for example:


...

bool	MOBtrigger;

...

NOTE_DATA *note_free;

...

int	top_mob_serial;



And so on. You can't do that, because each compilation unit (the .c files) then adds that declaration into the object file, and then the linker (not the compiler) finds multiple instances of them.

What you need to do is find all those variables in mud.h (the variable names will be in the error message, as shown above) and then change them to extern <the variable> for example:


...

extern bool	MOBtrigger;

...

extern NOTE_DATA *note_free;

...

extern int	top_mob_serial;



That tells the compiler to not set memory aside for them because they will be declared elsewhere (externally).

Then you have to declare them once, so you choose a file (eg. comm.c) and put them all inside there, ie. (after all the #include lines):



bool	MOBtrigger;
NOTE_DATA *note_free;
int	top_mob_serial;
...


So that declares the one (and only) copy of those variables. Now all the other files will be redirected to the single instance of them.

I can't say that will get rid of all the errors, but it should help.
Amended on Sat 24 Oct 2020 11:25 PM by Nick Gammon
#20
Thank you very much, I will try this tomorrow.

Also, I have another version from a friend that's been trying to get this codebase to work also. Not getting any duplicate errors instead I receive this;


$ make
Makefile:94: warning: ignoring prerequisites on suffix rule definition
make dbs
make[1]: Entering directory '/home/OhLoo/dbs/src'
Makefile:94: warning: ignoring prerequisites on suffix rule definition
gcc -c  -O -g3 -Wall -Wuninitialized    -DSMAUG  -DTIMEFORMAT   -DNOCRYPT act_move.c
In file included from act_move.c:23:
act_move.c: In function ‘grab_word’:
act_move.c:170:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  170 |  while ( isspace(*argument) )
      |                  ^~~~~~~~~
act_move.c:188:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  188 |  while ( isspace(*argument) )
      |                  ^~~~~~~~~
act_move.c: In function ‘decorate_room’:
act_move.c:293:32: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
  293 |     switch ( number_range(1, 2 * (iRand == nRand - 1) ? 1 : 2) )
      |                              ~~^~~~~~~~~~~~~~~~~~~~~~
act_move.c: In function ‘generate_exit’:
act_move.c:653:22: error: lvalue required as left operand of assignment
  653 |  (EXIT_DATA *) pexit = xit;
      |                      ^
act_move.c: In function ‘do_climb’:
act_move.c:2401:7: warning: variable ‘found’ set but not used [-Wunused-but-set-variable]
 2401 |  bool found;
      |       ^~~~~
act_move.c: In function ‘do_enter’:
act_move.c:2432:7: warning: variable ‘found’ set but not used [-Wunused-but-set-variable]
 2432 |  bool found;
      |       ^~~~~
act_move.c: In function ‘do_leave’:
act_move.c:2471:7: warning: variable ‘found’ set but not used [-Wunused-but-set-variable]
 2471 |  bool found;
      |       ^~~~~
make[1]: *** [Makefile:94: act_move.o] Error 1
make[1]: Leaving directory '/home/OhLoo/dbs/src'
make: *** [Makefile:70: all] Error 2



Thank you very much for your continued help!
Amended on Sun 25 Oct 2020 09:29 AM by Ohlookadime
Australia Forum Administrator #21
You only have one error there (the rest are warnings):


act_move.c:653:22: error: lvalue required as left operand of assignment


You may want to search what that means.

As an example, this simple program gives the same error message:


int main ()
  {
  unsigned char c;
  (char) c = 'a';
  }


However this does not:


int main ()
  {
  unsigned char c;
  c = (unsigned char) 'a';
  }


In other words, you cast the source of an assignment (the rvalue), not the destination (the lvalue).