Configuring Rom2.4 Makefile to Compile on Linux[Debian]

Posted by Erythnul on Fri 26 Jan 2007 09:22 PM — 33 posts, 125,404 views.

#0
Dear Forum,

I'm having some difficulties configuring my Rom2.4[Heavily Modified] codebase to start on a Linux[Debian] OS. I've been, over the past week, reading separate forums regarding this problem. From what I collected, It states that I need to add -lcrypt to the linker lines in the makefile itself.

Currently the Mud is running on a FreeBSD server just fine. I understand that FreeBSD is more of a Linux/Unix OS and from what I gather, my makefile has all the settings set so it can run via Unix just fine.

Here is the makefile I have edited to run via Linux even though it still isn't compiling properly.

CC = gcc
PROF = -O -g
NOCRYPT =
C_FLAGS = -Wall $(PROF) $(NOCRYPT)
L_FLAGS = $(PROF)
LIBS = -lcrypt

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 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 remort.o bank.o board.o auction.o quest.o \
games.o kit.o freeze.o gods.o

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

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

At the bottom of the makefile via ".c.o: merc.h" I removed -Dunix -DNOCRYPT. I imagine those two statements themselves allowed my mud to compile fine on my FreeBSD server. Even with leaving those there...and also removing them. It still didn't compile. Now mind you, when I compile on FreeBSD, the errors I'm about to present to you do not show, but when I compile on Debian, this is what it says:
#1
jungle@peach:~/thejunglemud/src$ make
gcc -c -Wall -O -g act_comm.c
In file included from act_comm.c:39:
interp.h:613:33: warning: no newline at end of file
In file included from act_comm.c:41:
tables.h:29: error: array type has incomplete element type
tables.h:30: error: array type has incomplete element type
tables.h:31: error: array type has incomplete element type
tables.h:32: error: array type has incomplete element type
tables.h:35: error: array type has incomplete element type
tables.h:36: error: array type has incomplete element type
tables.h:37: error: array type has incomplete element type
tables.h:38: error: array type has incomplete element type
tables.h:39: error: array type has incomplete element type
tables.h:40: error: array type has incomplete element type
tables.h:41: error: array type has incomplete element type
tables.h:42: error: array type has incomplete element type
tables.h:43: error: array type has incomplete element type
tables.h:44: error: array type has incomplete element type
tables.h:45: error: array type has incomplete element type
tables.h:46: error: array type has incomplete element type
tables.h:47: error: array type has incomplete element type
tables.h:48: error: array type has incomplete element type
tables.h:49: error: array type has incomplete element type
tables.h:50: error: array type has incomplete element type
tables.h:51: error: array type has incomplete element type
tables.h:52: error: array type has incomplete element type
tables.h:53: error: array type has incomplete element type
tables.h:54: error: array type has incomplete element type
tables.h:55: error: array type has incomplete element type
tables.h:56: error: array type has incomplete element type
tables.h:57: error: array type has incomplete element type
tables.h:58: error: array type has incomplete element type
tables.h:59: error: array type has incomplete element type
tables.h:60: error: array type has incomplete element type
tables.h:61: error: array type has incomplete element type
tables.h:62: error: array type has incomplete element type
tables.h:63: error: array type has incomplete element type
tables.h:64: error: array type has incomplete element type
tables.h:65: error: array type has incomplete element type
tables.h:66: error: array type has incomplete element type
tables.h:67: error: array type has incomplete element type
tables.h:68: error: array type has incomplete element type
tables.h:69: error: array type has incomplete element type
tables.h:70: error: array type has incomplete element type
act_comm.c: In function 'makedrunk':
act_comm.c:120: warning: implicit declaration of function 'toupper'
act_comm.c: In function 'do_war':
act_comm.c:804: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_roleplay':
act_comm.c:1142: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_grats':
act_comm.c:1327: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_quote':
act_comm.c:1505: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_question':
act_comm.c:1657: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_ooc':
act_comm.c:1809: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_music':
act_comm.c:1965: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_hero':
act_comm.c:2447: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_clocial':
act_comm.c:2555: warning: implicit declaration of function 'check_social'
act_comm.c: In function 'do_say':
act_comm.c:3505: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_shout':
act_comm.c:3689: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_tocial':
act_comm.c:3756: warning: unused variable 'count'
act_comm.c:3755: warning: unused variable 'counter'
act_comm.c:3753: warning: unused variable 'd'
act_comm.c: In function 'do_yell':
act_comm.c:4453: warning: passing argument 2 of 'bug' makes integer from pointer without a cast
act_comm.c: In function 'do_quit':
act_comm.c:5284: warning: implicit declaration of function 'talk_news'
act_comm.c: In function 'nuke_pets':
act_comm.c:5470: warning: implicit declaration of function 'raw_kill'
make: *** [act_comm.o] Error 1
jungle@peach:~/thejunglemud/src$

Any help on this subject would be greatly appreciated. My head is beginning to hurt from working on this. Thanks again for being available, I typically don't use forums.

Erythnul
USA #2
Can you show us some of those lines in tables.h? Everything else is just a warning.
Amended on Fri 26 Jan 2007 10:29 PM by Zeno
USA #3
Debian is in fact just as much of a "Linux/Unix OS" as FreeBSD is; it's just a different distribution.

On your FreeBSD machine, type gcc --version
then do the same on your Debian machine.

What you are likely to see is that Debian is using a much more recent version of gcc, maybe even version 4, which is much, much stricter about sloppiness. It doesn't let you do things that older versions let you get away with.

Really, the newer version is helping you; the kind of errors it catches, if due to sloppiness, are often an indication of not understanding really what is going on. Or, it is also often an indication that you might have made a mistake you didn't mean to make, and it's helping you find it.

Zeno is right, though; you should post some of those lines from tables.h to see what the problem is.

By the way, the crypt library has nothing to do with the problem so far. You are failing to compile and haven't gotten to the link stage yet; linking is where crypt comes into play. (Linking is when you group everything together: the files you just compiled and the external libraries they use.)
#4
Sure thing! Wow, I'm really impressed by the fast replies. Here is the lines directly taken from tables.h:

/* game tables */
extern const struct clan_type clan_table[MAX_CLAN];
extern const struct position_type position_table[];
extern const struct sex_type sex_table[];
extern const struct size_type size_table[];

/* flag tables */
extern const struct flag_type act_flags[];
extern const struct flag_type plr_flags[];
extern const struct flag_type affect_flags[];
extern const struct flag_type off_flags[];
extern const struct flag_type imm_flags[];
extern const struct flag_type form_flags[];
extern const struct flag_type part_flags[];
extern const struct flag_type comm_flags[];
extern const struct flag_type extra_flags[];
extern const struct flag_type wear_flags[];
extern const struct flag_type weapon_flags[];
extern const struct flag_type container_flags[];
extern const struct flag_type portal_flags[];
extern const struct flag_type room_flags[];
extern const struct flag_type exit_flags[];
extern const struct flag_type mprog_flags[];
extern const struct flag_type area_flags[];
extern const struct flag_type sector_flags[];
extern const struct flag_type door_resets[];
extern const struct flag_type wear_loc_strings[];
extern const struct flag_type wear_loc_flags[];
extern const struct flag_type res_flags[];
extern const struct flag_type imm_flags[];
extern const struct flag_type vuln_flags[];
extern const struct flag_type type_flags[];
extern const struct flag_type apply_flags[];
extern const struct flag_type sex_flags[];
extern const struct flag_type furniture_flags[];
extern const struct flag_type weapon_class[];
extern const struct flag_type apply_types[];
extern const struct flag_type weapon_type2[];
extern const struct flag_type apply_types[];
extern const struct flag_type size_flags[];
extern const struct flag_type position_flags[];
extern const struct flag_type ac_type[];
extern const struct bit_type bitvector_type[];

Here is the gcc version of my new Debian Server:

jungle@peach:~/thejunglemud/src$ gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Copyright (C) 2006 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.

Here is the gcc version of my FreeBSD Server:

-bash-2.05b$ gcc --version
gcc (GCC) 3.4.2 [FreeBSD] 20040728
Copyright (C) 2004 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.
USA #5
I assume something like this:
extern const struct flag_type apply_types[];

Should be:
extern const struct flag_type * apply_types;


Google the error message for more details.
#6
Thank you. I was able to get tables.h to work perfectly with it. Now I'm having a few awkward errors with act_comm.c. Now I'm sure this isn't that last of them, but at least I'll be able to start going through the source code and fixing them. Here is the error:

act_comm.c:2085: error: request for member 'independent' in something not a structure or union
act_comm.c: In function 'do_clantalk':
act_comm.c:2202: error: request for member 'independent' in something not a structure or union
act_comm.c:2302: error: request for member 'name' in something not a structure or union
act_comm.c:2311: error: request for member 'hall' in something not a structure or union

What exactly does that mean? An example of the code from act_comm.c:2085: is:

if (!is_clan(ch) || clan_table[ch->clan].independent)

How do I fix these errors? Again, I really appreciate all the help. Was quite overwhelming.

Ery
USA #7
You didn't change this line, did you?
extern const struct clan_type clan_table[MAX_CLAN];


You shouldn't have.
#8
Ahh.. I did, but see if I don't, the tables.h error shows up again only for that line. Hrmm, any ideas?
USA #9
In act_comm.c, does tables.h get included before or after mud.h? (Or: does mud.h include tables.h at the very beginning? Or before the structure clan_type is defined?)


EDIT: also, try putting the single line:
struct clan_type;
above the clantype array declaration.
Amended on Sat 27 Jan 2007 12:30 AM by David Haley
#10
These are the included' files atop act_comm.c:

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"

There is no mud.h in my source code. Rom2.4. Perhaps you meant merc.h? If so, there is no include headers in that file.

Thanks for this help, I know it's a bit time-consuming.

Ery

USA #11
Oh yeah, I forgot this was ROM-based, not SMAUG-based... anyhow.

Well, so much for the include idea... one more thing about that though. Could you find where struct clan_type is defined?

Also, did you try the line of code I mentioned?
#12
Looks' like it's defined within tables.c:

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <time.h>
#include "merc.h"
#include "tables.h"

/* for clans */
const struct clan_type clan_table[MAX_CLAN] =
{
/* name, who entry, death-transfer room, independent */
/* independent should be FALSE if is a real clan */
{ "", "", ROOM_VNUM_ALTAR, TRUE },
{ "loner", "[ {RL{ro{wn{De{rr{Rs{x ] ", 3007, TRUE },
{ "Jungle", "[ {GJu{gng{Gle{x ] ", 1213, FALSE },
{ "Forester", "[{gF{Goreste{gr{x] ", 7000, FALSE },
{ "Ningyo", "[ {DN{Wi{wng{Wy{Do{x ] ", 7200, FALSE },
{ "United", "[ {WU{cn{Bi{wt{Ce{bd{x ] ", 7400, FALSE },
{ "Ksatria", "[{RK{rsatria{x ] ", 7600, FALSE },
{ "Chemists", "[{@C{@h{@e{@m{@i{@s{@t{@s{x] ", 20000, FALSE },
{ "Paradise", "[{BP{car{Gad{cis{Be{x] ", 20200, FALSE },
{ "Avatar", "[ {CAv{cat{Car{x ] ", 20200, FALSE },
{ "Bloodlust", "[ {rV{wvv{rV{x ] ", 30802, FALSE },
};

p.s. - Where should I place that tag again?
USA #13
Oh, that's the array itself that's defined; I meant the type. Somewhere there should something like like:
typedef struct CLAN_TYPE { // or something
  // some data members
} clan_type;

It'll probably be in a .h file.

As for the line, put it right above the line
extern const struct clan_type clan_table[MAX_CLAN];
#14
Nope, that didn't work sadly. Ok, only things I can find while searching for clan_type is this which is located right under the array types in tables.h:

extern const struct flag_type * position_flags[];
extern const struct flag_type * ac_type[];
extern const struct bit_type * bitvector_type[];

struct flag_type
{
char *name;
int bit;
bool settable;
};

struct clan_type
{
char *name;
char *who_name;
sh_int hall;
bool independent; /* true for loners */
};

struct position_type
{
char *name;
char *short_name;
};

struct sex_type
{
char *name;
};

struct size_type
{
char *name;
};

struct bit_type
{
const struct flag_type * table;
char * help;
};

Perhaps this is where it's stuffing up?
USA #15
OK. Move the structure definitions to above the externs. (I have no idea why they're declaring externs before even having the structure around...)

Even if this doesn't fix your problem, it's much better to have it that way.
USA #16
This looks an awful lot like: http://forums.mudplanet.net/index.php?a=topic&t=991

The explanation has already been done to death, but the link should be all the solution you need.
#17
That's all I needed! Compiled perfectly. Thank you all for the help. I'll definitely use this forum for future needs.

Erythnul
#18
Wait ...One last quick question/problem. Looks like it's masking the pfile's passwords now. So as I compiled the mud, and booted her up. The original pfiles passwords don't work now. So I created a new character with the password 12345. Saved it and logged off, looked at the pfile and it masked the pword Ksfdh.Jry. How do I fix this so all my original pfiles passwords work correctly?

Ery
USA #19
That shouldn't be masking, it's encrypting. Does the password not work after you create a new char, and relog?
#20
The 12345 password works just fine... but my character nor anyone' elses existing pfile characters work. It asks for our password, and I put it in, and it states "wrong password" even though we know its the right one. I imagine it has something to do with the new compile??
USA #21
So existing characters don't work, but new characters do?

How was this MUD transferred? From one server to another?
Amended on Sat 27 Jan 2007 03:43 AM by Zeno
USA #22
What's probably happening is that it reads in old characters as having encrypted passwords, and then writes them back out with encryption, which is why they get messed up. Depending on how many pfiles you have, you could manually set the passwords to the correct encrypted versions; I think you can get the encrypted version of a password with a built-in game command, but that might be SMAUG-only.
#23
Old characters dont work, new characters I make do. The old characters passwords show up normal in the pfiles themselves but when I make a new character it encrypts the passwords. Sooooo it looks like its using the original passwords to the old characters as encryptions so the pwords are ALL different to 100+ pfiles.
USA #24
Sounds like passwords weren't encrypted before this. The fix you made so it would compile shouldn't have changed it to encrypt passwords.
#25
Oh and yes it was transfered from one server to another. Sorry about that, just noticed the second question.
#26
In the original makefile before I added -lcrypt it had this:

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

And I removed -Dunix -DNOCRYPT to make it look like this:

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

Is that what happened?
USA #27
Yes, crypt is to encrypt passwords. Did you add that because it wasn't compiling?
#28
Ohhh no... earlier today before I found this forum I was reading old forums with similar questions and it told me I needed to add -lcrypt to my linker line in order for the makefile to compile under linux. So it should work without the -lcrypt?
USA #29
Yes, it should work without the crypt library. I'm a little surprised that not having crypt would break something. Well, in any case, it's generally better to have the passwords crypted; see my previous post for a quick discussion how.
#30
Guys, again. Thanks so very much for all the help. I got her running just fine. The transition went perfectly and there are no more errors. I really appreciate everything. You shouldn't hear from me for a while now ;)

Thanks,
Erythnul
-----------
Noah Dillon
noah.dillon@yahoo.com
#31
"This looks an awful lot like: http://forums.mudplanet.net/index.php?a=topic&t=991"

Sorry for reviving this thread, I think I'm currently in this situation.

But the link above referring about doesn't seem to exist anymore. Can anybody walk me tru it?

TIA.
Australia Forum Administrator #32
Samson hangs around at:

http://www.smaugmuds.org/

Try asking there.