Compiling Icy Depths

Posted by Lumpei on Fri 05 Mar 2004 10:14 PM — 24 posts, 90,053 views.

#0
Greetings, All!

First, let me say how much I am learning from reading these forums. Nick, don't know who you are, but I appreciate how helpful you are to all of us.

So. I am trying to compile the iceydepths codebase (which is a derivative of anatolia). Here is the Makefile:

#
# $Id: Makefile,v 1.42 1998/12/29 16:47:57 fjoe Exp $
#
CC = gcc
LD = gcc
INCLUDES = -I . -I ../msgdb

CFLAGS = -Wall -O $(INCLUDES)
LFLAGS =
LIBS =
INSTALL_PATH = ..

#
# for SUNOS
#CFLAGS += -DSUNOS
#LIBS += -lsocket -lnsl
#CFILES += compat/strsep.c compat/snprintf.c
#OFILES += strsep.o snprintf.o

#
# for FreeBSD
#CFLAGS += -DBSD44
#LIBS += -lcrypt

#
# for Linux
CFLAGS += -DLINUX -DNOCRYPT
#LIBS +=

#
# for Unixware 2.x
#CFLAGS += -DSVR4 -DOLD_RAND
#LIBS += -lsocket -lnsl -lcrypt
#CFILES += compat/strsep.c
#OFILES += strsep.o

#
# Generally Makefile should not be edited below this line
#
COMM_CFILES = comm/ban.c comm/charset.c comm/comm.c comm/comm_act.c\
comm/comm_colors.c comm/comm_info.c comm/resolver.c
COMM_OFILES = ban.o charset.o comm.o comm_act.o\
comm_colors.o comm_info.o resolver.o

DB_CFILES = db/cmd.c db/db.c db/db_area.c db/db_clan.c db/db_class.c\
db/db_skills.c db/db_lang.c db/db_race.c\
db/gsn.c db/lang.c db/msg.c db/resource.c db/spellfn.c db/word.c
DB_OFILES = cmd.o db.o db_area.o db_clan.o db_class.o\
db_skills.o db_lang.o db_race.o\
gsn.o lang.o msg.o resource.o spellfn.o word.o

OLC_CFILES = olc/olc.c olc/olc_area.c olc/olc_clan.c olc/olc_help.c\
olc/olc_lang.c olc/olc_mob.c olc/olc_mpcode.c olc/olc_msg.c\
olc/olc_room.c olc/olc_obj.c olc/olc_save.c olc/olc_word.c
OLC_OFILES = olc.o olc_area.o olc_clan.o olc_help.o\
olc_lang.o olc_mob.o olc_mpcode.o olc_msg.o\
olc_room.o olc_obj.o olc_save.o olc_word.o

CFILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c auction.c\
buffer.c clan.c class.c\
effects.c fight.c flag.c handler.c healer.c help.c hometown.c\
hunt.c interp.c log.c lookup.c magic.c magic2.c martial_art.c mem.c\
mlstring.c mob_cmds.c mob_prog.c namedp.c note.c obj_prog.c quest.c\
race.c raffects.c rating.c recycle.c religion.c repair.c\
save.c skills.c special.c str.c string_edit.c\
tables.c update.c util.c varr.c\
$(COMM_CFILES) $(DB_CFILES) $(OLC_CFILES)

OFILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o auction.o\
buffer.o clan.o class.o\
effects.o fight.o flag.o handler.o healer.o help.o hometown.o\
hunt.o interp.o log.o lookup.o magic.o magic2.o martial_art.o mem.o\
mlstring.o mob_cmds.o mob_prog.o namedp.o note.o obj_prog.o quest.o\
race.o raffects.o rating.o recycle.o religion.o repair.o\
save.o skills.o special.o str.o string_edit.o\
tables.o update.o util.o varr.o\
$(COMM_OFILES) $(DB_OFILES) $(OLC_OFILES)

muddy: $(OFILES)
rm -f muddy
$(LD) $(LFLAGS) -o muddy $(OFILES) $(LIBS)

.c.o:
$(CC) $(CFLAGS) -c $<

depend:
mkdep $(CFLAGS) $(CFILES)

clean:
rm -f *.o *.core muddy

ctags:
ctags -dtw $(CFILES) *.h

install: muddy
install -cp -m 770 muddy $(INSTALL_PATH)/bin

And here is the error I get when i try to compile in Cygwin (running on XPhome sp1):

gcc -Wall -O -I . -I ../msgdb -DLINUX -DNOCRYPT -c act_comm.c
In file included from act_comm.c:55:
merc.h:49: warning: ignoring #pragma warning
In file included from merc.h:66,
from act_comm.c:55:
str.h:43: error: conflicting types for 'strlwr'
/usr/include/string.h:71: error: previous declaration of 'strlwr'
comm.c: In function 'do_quit_org':
comm.c:1096: warning: suggest explicit braces to avoid ambiguous 'else'
make: *** [act_comm.o] Error 1.

Now (and sorry for the length), i tried to be clever and went into the makefile and changed it to look like this:

CC = gcc
LD = gcc
INCLUDES = -I . -I ../msgdb
PROF = -O -g
NOCRYPT = -DNOCRYPT

CFLAGS = -Wall $(PROF) $(NOCRYPT) -DOLD_RAND
#CFLAGS = -Wall -O $(INCLUDES)
LFLAGS =
LIBS =
INSTALL_PATH = ..

Still no luck. Any ideas, anyone? I am having nothing but trouble trying to compile ANYTHING on cygwin. smaug won't work, rom, anatolia, nothing. the only thing that has thus far compiled is the win32 version of rom2.4. I would LOVE to get iceydepths working (i have really enjoyed playing on an iceydepths mud).

Much appreciated. Peace, y'all!



Australia Forum Administrator #1
Sounds like some issue with using 'strlwr' before including a declaration for it.

Maybe the order things are included? Personally I have got SMAUG to compile perfectly under Cygwin, and, I think, ROM.

If you tell me exactly where you got the source I can try and see what happens.
USA #2
I too have had good luck getting various Smaug derivs to cooperate in Cygwin, and recently cooerced stock Rom2.4b6 to do the same. Although it really didn't take much cooersion :P

Anyway.....

Quote:

str.h:43: error: conflicting types for 'strlwr'
/usr/include/string.h:71: error: previous declaration of 'strlwr'


This is the problem right here. str.h which I assume comes with icydepths is defining a strlwr function or prototype which string.h already has. string.h is a system library, and usually I find it's best to defer to those to resolve issues like this.
#3
Thanks for the responses!

I downloaded the iceydepths code from game.org:

http://ftp.game.org/cgi-bin/directory?/pub/mud/diku/merc/rom/anatolia/iceydepths

I am, as stated, a complete neophyte when it comes to things like this, but i am learning. So, Samson, I understood the words of your post, but not their content :)

Practically speaking, what would i have to do to the code to get it to work?

Thanks!
Australia Forum Administrator #4
I have got it to compile OK - still some warnings but at least it got there. There were a few problems with conflicting declarations, and occasional lines where a string went over a line break. Here are my diffs:



Common subdirectories: src/CVS and src.new/CVS
diff -c src/act_info.c src.new/act_info.c
*** src/act_info.c	Mon Apr 19 10:33:56 1999
--- src.new/act_info.c	Wed Mar 10 07:36:06 2004
***************
*** 3975,3989 ****
  
      if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOGOSSIP))
      {
! 	send_to_char("But you have the gossip channel turned
! off!\n\r",ch);
  	return;
      }
  
      if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOCHANNELS))
      {
! 	send_to_char("The gods have revoked your channel
! priviliges.\n\r",ch);
  	return;
      }
  
--- 3975,3987 ----
  
      if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOGOSSIP))
      {
! 	send_to_char("But you have the gossip channel turned off!\n\r",ch);
  	return;
      }
  
      if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOCHANNELS))
      {
! 	send_to_char("The gods have revoked your channel priviliges.\n\r",ch);
  	return;
      }
  
diff -c src/act_wiz.c src.new/act_wiz.c
*** src/act_wiz.c	Wed Apr 14 10:56:46 1999
--- src.new/act_wiz.c	Wed Mar 10 07:40:01 2004
***************
*** 844,850 ****
  			char_puts("You are too pumped to pray now.\n", ch);
  			return;
  		}
! #ifdef 0
  		if (!IS_SET(ch->in_room->room_flags, ROOM_PEACE)) {
  			char_puts("You must be in a safe place in order "
  				  "to make a transportation.\n", ch);
--- 844,850 ----
  			char_puts("You are too pumped to pray now.\n", ch);
  			return;
  		}
! #if 0
  		if (!IS_SET(ch->in_room->room_flags, ROOM_PEACE)) {
  			char_puts("You must be in a safe place in order "
  				  "to make a transportation.\n", ch);
***************
*** 2963,2972 ****
  break;
                case CON_PICK_WEAPON:			 st = " Weapon ";
  break;
! 			  case CON_READ_IMOTD:			 st = "
! IMOTD  "; 	break;
! 			  case CON_BREAK_CONNECT:		 st =
! "LINKDEAD";	break;
                case CON_READ_MOTD:            st = "  MOTD  ";    break;
                default:                       st = "UNKNOWN!";    break;
             }           count++;           
--- 2963,2970 ----
  break;
                case CON_PICK_WEAPON:			 st = " Weapon ";
  break;
! 			  case CON_READ_IMOTD:			 st = " IMOTD  "; 	break;
! 			  case CON_BREAK_CONNECT:		 st = "LINKDEAD";	break;
                case CON_READ_MOTD:            st = "  MOTD  ";    break;
                default:                       st = "UNKNOWN!";    break;
             }           count++;           
Common subdirectories: src/comm and src.new/comm
Common subdirectories: src/compat and src.new/compat
Common subdirectories: src/db and src.new/db
diff -c src/db.c src.new/db.c
*** src/db.c	Sun Apr  4 11:15:19 1999
--- src.new/db.c	Wed Mar 10 07:43:37 2004
***************
*** 84,91 ****
  	int getpid();
  	time_t time(time_t *tloc);
  #elif defined(LINUX)
! 	long random();
! 	void srandom(unsigned int);
  	int getpid();
  	time_t time(time_t *tloc);
  #endif
--- 84,91 ----
  	int getpid();
  	time_t time(time_t *tloc);
  #elif defined(LINUX)
! //	long random(void);
! //	void srandom(unsigned int);
  	int getpid();
  	time_t time(time_t *tloc);
  #endif
diff -c src/merc.h src.new/merc.h
*** src/merc.h	Thu Apr 15 13:23:36 1999
--- src.new/merc.h	Wed Mar 10 07:41:05 2004
***************
*** 46,52 ****
  #if	defined (LINUX) || defined (WIN32)
  #	undef  NOCRYPT
  #	define NOCRYPT
! #	pragma warning (disable : 4244 4018 4761)
  #endif
  
  #include <limits.h>
--- 46,52 ----
  #if	defined (LINUX) || defined (WIN32)
  #	undef  NOCRYPT
  #	define NOCRYPT
! //#	pragma warning (disable : 4244 4018 4761)
  #endif
  
  #include <limits.h>
Only in src.new: muddy.exe
Common subdirectories: src/mudprogs and src.new/mudprogs
Common subdirectories: src/olc and src.new/olc
diff -c src/str.c src.new/str.c
*** src/str.c	Thu Nov 26 02:17:46 1998
--- src.new/str.c	Wed Mar 10 07:40:41 2004
***************
*** 249,255 ****
  	return dest;
  }
  
! char *strlwr(const char *s)
  {
  	static char buf[MAX_STRING_LENGTH];
  	char *p;
--- 249,255 ----
  	return dest;
  }
  
! char *strlwr(char *s)
  {
  	static char buf[MAX_STRING_LENGTH];
  	char *p;
diff -c src/str.h src.new/str.h
*** src/str.h	Mon Nov  2 16:28:31 1998
--- src.new/str.h	Wed Mar 10 07:35:08 2004
***************
*** 40,46 ****
  char *	strnzcat(char *dest, const char *src, size_t);
  char *	strnzncat(char *dest, const char *src, size_t len, size_t count);
  #if !defined (WIN32)
! char *	strlwr(const char *s);
  #endif
  
  int	str_cmp		(const char *astr, const char *bstr);
--- 40,46 ----
  char *	strnzcat(char *dest, const char *src, size_t);
  char *	strnzncat(char *dest, const char *src, size_t len, size_t count);
  #if !defined (WIN32)
! char *	strlwr(char *s);
  #endif
  
  int	str_cmp		(const char *astr, const char *bstr);



Tale the text between the lines and save as "fixups.diff" (or some file name) and then go into the "src" directory, and apply the patches like this:


$ patch < ../fixups.diff
patching file act_info.c
patching file act_wiz.c
patching file db.c
patching file merc.h
patching file str.c
patching file str.h


Your command may differ slightly depending on where you save the diffs file. That should patch the files mentioned, and then a "make" should work. There are a few warnings still that it might be worth getting rid of.
Amended on Tue 09 Mar 2004 08:53 PM by Nick Gammon
#5
Nick, as ever, you're a genius.

OK, so i patched the code, and it compiled. Viola! Wonderful!

Now, and i am having the good graces to blush, i cannot get it to run. I thought i was clever and went into the comm.c file and changed the ip binding to my pc's ip. I recompiled. Then, when i went to run it, i am typing:

./muddy

and i get:

lang.lst: no such file or directory.

OK. so i could be doing several things incorrectly. Is this the wrong executable to run? I could find no 'startup' file that exists in the ubiquitous directions for running these muds. Any help you could give to get this thing running would be great.

I promise to ease off the questions once i get this thing running. i swear!

peace!
USA #6
I spent the better part of 5 hours puzzling over why this would be, and eventually had to perform some uncool hackishness to get the thing to actually load. Now, these hacks were being done as a favor to someone who wanted the multilanguage support. So it's not something I'd be comfortable recommending for a production mud. Frankly, with all the problems this base had even AFTER fixing the compiler issues, I'd not recommend this base to anyone. You'd be better off with something of far better quality, such as Dawn of Time.
#7
So are you saying it is possible to get this mud running without the language support? I have been playing on this codebase on dungeons and dragons mud and have enjoyed it immensely. I would like to at least get it running for a small group of people.

On another note, is it possible to port the areas/classes/skills over to another codebase? Or is it totally incompatible? Say i wanted some of these areas in, say, the Smaug code. I can't imagine it's as easy as copying the .are files into the Smaug area folder, is it?

Anway, thanks to all for their help. Be well.
USA #8
Getting it to load without the language support would take even more poking since several parts of the game expect it to be there. What I did was perhaps one of the ugliest hackjobs I've ever needed to do, but since the person I did it for was only interested in seeing the language support in action, it was worth it.

In your case, if all you're looking to do is grab area files, you might give the Orb editor a shot. I understand it's capable of converting Rom zones to Smaug format. Not sure about Nick's editor, he can comment on that. Thing is, I'm not sure how "stock" the IceyDepths format is for Rom.
Australia Forum Administrator #9
If it's stock ROM, my editor will convert reasonably well, load as ROM, save as SMAUG. Just copying the area files will not work.

Make sure you have the flag meanings set up correctly (in the configuration file) otherwise various flags may switch meanings.

Failing that, you can hack out the "load area" code and make it re-save as SMAUG (or stock ROM or whatever).

One day I'm planning to do a generic area editor that can be customised to (virtually) any area file format, but it isn't started yet. :)
#10
I've done that patch.. And this is what I've got....
Can anyone help me?


$ make
gcc -Wall -O -I . -I ../msgdb -DLINUX -DNOCRYPT -c act_comm.c
In file included from act_comm.c:55:
merc.h:49: error: syntax error before '!' token
In file included from merc.h:67,
from act_comm.c:55:
str.h:43: error: syntax error before '!' token
act_comm.c: In function `do_quit_org':
act_comm.c:1096: warning: suggest explicit braces to avoid ambiguous `else'
make: *** [act_comm.o] Error 1

USA #11
Could you show the lines of code along with the surrounding lines? (Make sure you tell us which one has the error)
#12
I am also playing at dungeons and dragons mud , based on Icey Depths codebase :) I have decided to test my coding skills, as well as try to implement several ideas, so i downloaded it from http://ftp.game.org/cgi-bin/directory?/pub/mud/diku/merc/rom/anatolia/iceydepths
as well as Cygwin.
I have done that before i actually found this place (A Great one, i should admit), so i solved those problems with typos in the source, on my own and successfully compiled the code, receiving muddy.exe as the output.
But here i get the problem, not mentioned in this topic above - when i try to run this program, i get a message:
"init_socket: bind: Cannot assign requested address"
I have searched the net for such message, and as far as i understand it has smth to do with problems with networking, i tried to run it with port argument, but the error message is the same. I did that at work, where i have LAN and lots of programs installed, and thus using many ports, so i tried to take the source to home, where have less programs, that can prevent muddy.exe from using network, and besides that, i dont have LAN at home, but the problem was still the same.
Australia #13
I knew icey depths sounded familuar. Something about mudmagic that is good is the fact that we all can make reviews about code and codebases.
Quote:

Don't bother to download this, there has been many atempts to get this code base running. The error is with the lang.lst file not being found. I have see alot of coders try to fix this with out any sucess.

The fact that Samson can make some hack to get it to work says lots about his skill as a programer. Sometimes the best advice is to follow and beleive the review.

Peace.

Oh AreaEditor is great for converting Rom to Smaug, with some files you might need to change the #AREADATA section to be like the older #AREA area section, but aside from that, it rocks.
Amended on Tue 26 Apr 2005 10:52 AM by Robert Powell
#14
But i saw many muds running on this codebase and i dont have the problem with this lang.1st file. It compiles w/o errors, i think there should be just slight adjustment made somewhere.
#15
After further inspecting comm.c i have found that init_socket function that was giving that error "Cannot assign requested address" , and i have copy+pasted the one from SMAUG code. This problem was fixed and now i am at the same point with lang.lst absense problem. Does anyone know if i can get it somewhere, or at least in what format are there records in it, so that i can manually create it?
USA #16
I'm the head coder at Dungeons & Dragons Mud. We run a heavily modified Icey Depths codebase. Spear is a player on our mud, and told me about this thread. So, just for giggles, i decided to give it a whirl.

I DLed the distro from the link above. After correcting the source code formatting errors with the diff offered above, I compiled. make install.

muddy 4000
I got the binding error.

I changed the IP in comm.c

Now I got the lang.lst file error.
The lang.lst file is located in ./lang/ (go figure)

So now I the mud from . (the base directory)
./bin/muddy 4000

This time I got the gender.rus file error.
looking in ./lang/russian.lang I find
GendersFile genders.rus~
CasesFile cases.rus~

Not wanting to waste any time, and just to see if I can get this distro-codebase running, I just gave full pathnames for the files:

GendersFile /home/zsuzsu/muddy/lang/genders.rus~
CasesFile /home/zsuzsu/muddy/lang/cases.rus~

After that I ran the mud from the base directory, and those there are a lot of warnings in the logfile, it came up and I logged in with a first user.

I think this is a much easier way to go about things than the language hacks mentioned above. This way only took me about 30mins to figure out.

Obviously, this codebase needs a lot of work. I've spent a lot of time ridding this codebase of bugs -- not sure how many were made by the coders before I got on board with D&D.

Anyway, that should help you all get up and running with this codebase.

Zz
#17
Compiling Icey Depths on FreeBSD is what I started on. It worked fine. I then switched over to Red Hat Enterprise Linux 4 which required some fine tuning. But I have had Icey Depths codebase for the past 6.5 yrs up and running as a playable mud. And as far as compiling on Cygwin if you can get it to work more power too you. If not then buy the Norton Partition magic and partition your hdd give it atleast 10 gigs partition space for your linux distro. Then install Linux on the 10 gig partition and you now have dual booted windows/linux computer. I would reccomend Suse Linux 9 or Red Hat or Debian Sarge or FreeBSD or SlackWare. As far as compiling/running the codebase without the language support I am not sure that is possible without recoding the entire codebase. Icedepths was coded by a drunk russian I am assuming. We have done so much work to our distro that it does not even look like IceyDepths code anymore. We also have the startup file. If you need any of those Linux distro's let me know I can make ISO's of the CD's and put them on my ftp site for you to download. But if you would like to see a very good and very nice Icey Depths mud with Dual Language support for English and Russian then go here:

http://www.legendsandlore.org

or telnet too:

legendsandlore.org Port: 9999
#18
I recently downloaded this codebase and cygwin, and patched the files as per the diff, but I'm getting a similar error to the strlwr one lumpei got:

string_edit.c:462: error: conflicting types for 'getline'
/usr/include/sys/stdio.h:31: error: previous declaration of 'getline' was here


The offending lines...

in string_edit.c are:
const char *getline(const char *str, char *buf)

in /usr/icnlude/sys/stdio.h:
ssize_t _EXFUN(getline, (char **, size_t *, FILE *));


Apparently the sys/stdio.h is something that comes with cygwin...but I'm not sure what to do to fix this without busting something.
Amended on Wed 08 Feb 2006 03:11 AM by Primoperfect
USA #19
I suppose just comment out the getline in string_edit.c.
#20
sorry, I posted the code from string_edit.c twice. It's edited now.

Ah...I found out that the getline method defined in string_edit was just a local method, so I renamed it to getline_two and it compiles now.
Amended on Wed 08 Feb 2006 03:19 AM by Primoperfect
USA #21
What an annoying feature of C. C++ is smart enough to realize that the two functions are in fact different, because of their different arguments.
int foo() {                       
    return 0;
}       
        
void foo(int i) {               
    return;     
}               
                
                
int main() {               
    foo();      
    foo(2);
}
This compiles perfectly using g++, but gcc gives the same error you got.
#22
*sigh* Now I'm getting the init_socket error (it's like reliving what everyone else posted a year ago!) ... I changed the IP to my computer's IP on the line:

sa.sin_addr.s_addr = inet_addr( " <IP> " );

But I'm still getting the error.

Spear said he copied over the init_socket method from SMAUG, but Zsuzsu didn't mention it; anyone know how to fix the error?
USA #23
It could mean that the port is already in use for some reason. Try using a different port. Also make sure that you don't have software running that shuts down connection attempts it doesn't know about (although it should at least *ask* you...)