Compiling Rom2.4 on Linux

Posted by Krono on Wed 23 Jul 2003 08:24 PM — 6 posts, 21,498 views.

#0
I am having a problem compiling Rom2.4 on linux but I got the same thing running on cygwin fine. Here is what I encounter:

gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_comm.c
act_comm.c: In function `do_push_drag':
act_comm.c:2099: warning: implicit declaration of function `do_look'
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_enter.c
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_info.c
act_info.c: In function `do_look':
act_info.c:1168: warning: suggest explicit braces to avoid ambiguous `else'
act_info.c:1177: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_move.c
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_obj.c
act_obj.c: In function `get_cost':
act_obj.c:2717: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT act_wiz.c
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT alias.c
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT ban.c
gcc -c -Wall -O -ggdb -Dunix -DOLD_RAND -DNOCRYPT comm.c
comm.c:176: conflicting types for `getpeername'
/usr/include/sys/socket.h:127: previous declaration of `getpeername'
comm.c:177: conflicting types for `getsockname'
/usr/include/sys/socket.h:115: previous declaration of `getsockname'
comm.c: In function `process_output':
comm.c:1254: warning: suggest explicit braces to avoid ambiguous `else'
make: *** [comm.o] Error 1

This is my makefile:

CC = gcc
PROF = -O -ggdb
NOCRYPT =
C_FLAGS = -Wall $(PROF) $(NOCRYPT)
L_FLAGS = $(PROF)

O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \
alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \
handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \
music.o recycle.o save.o scan.o skills.o special.o tables.o \
update.o mob_cmds.o mob_prog.o olc.o olc_act.o olc_save.o bit.o \
mem.o string.o olc_mpcode.o

rom: $(O_FILES)
rm -f rom
$(CC) $(L_FLAGS) -o rom $(O_FILES)

.c.o: merc.h
$(CC) -c $(C_FLAGS) -Dunix -DOLD_RAND -DNOCRYPT $<

I don't know what i need to do cause it compiles fine on windows using cygwin =/ Thanks for helping =)
Australia Forum Administrator #1
I compiled that file OK. Exactly which version of ROM do you have? Where did you download it from? Which Linux are you using?


...
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix act_wiz.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix alias.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix ban.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix comm.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix const.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix db.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix db2.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix effects.c
gcc -c -Wall -O -g -DNOCRYPT -DOLD_RAND -Dunix fight.c

...

$ gcc --version

gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


dmesg | less 

Linux version 2.4.20-13.9 (bhcompile@porky.devel.redhat.com) (gcc version 3.2.2
20030222 (Red Hat Linux 3.2.2-5)) #1 Mon May 12 10:55:37 EDT 2003


#2
http://www.zone.ee/brigadir/rom2.4/rom2.4b4a(OLC1.71+coloUr1.2).zip

this is the one i got and i been working with it(adding push/drag, races, classes, etc..) a bit on windows with cygwin and i decided to upload it to a free mud host place at www.iflipout.com. And i did a rm *.o and make with cygwin just to make sure it still works and then i uploaded it to the linux mud server. and i got that error message =x even now on windows it runs perfectly fine =) maybe the one i downloaded was meant for windows only? anyways thanks for responding =)
#3
Oh ya and this is what im using:

gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Linux version 2.4.20-9 (bhcompile@stripples.devel.redhat.com) (gcc version 3.2.2
20030313 (Red Hat Linux 3.2.2-10)) #1 Wed Apr 2 13:42:50 EST 2003


hehe sorry i forgot to add that last post =)
Australia Forum Administrator #4
Near the start of comm.c, add a line:


#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>  // add this line


A bit further down (line 168) comment out all of the definitions, like this:


#if     defined(linux)
/*
    Linux shouldn't need these. If you have a problem compiling, try
    uncommenting accept and bind.
int     accept          args( ( int s, struct sockaddr *addr, int *addrlen ) );
int     bind            args( ( int s, struct sockaddr *name, int namelen ) );

int     close           args( ( int fd ) );
int     getpeername     args( ( int s, struct sockaddr *name, int *namelen ) );
int     getsockname     args( ( int s, struct sockaddr *name, int *namelen ) );
int     gettimeofday    args( ( struct timeval *tp, struct timezone *tzp ) );
int     listen          args( ( int s, int backlog ) );
int     read            args( ( int fd, char *buf, int nbyte ) );
int     select          args( ( int width, fd_set *readfds, fd_set *writefds,
                            fd_set *exceptfds, struct timeval *timeout ) );
int     socket          args( ( int domain, int type, int protocol ) );
int     write           args( ( int fd, char *buf, int nbyte ) );
*/  // <---- move closing comment to here   
#endif


Then it will compile OK.
#5
Thanks Nick =) worked perfectly!!! =D hehe wow much love haha