Compiling under terminal OS X lion Fail

Posted by Lukem on Thu 06 Oct 2011 02:53 AM — 13 posts, 47,605 views.

#0
cc -c -DMCCP -O -g3 -Wall -Wuninitialized -DSMAUG -DTIMEFORMAT act_comm.c
In file included from act_comm.c:32:
mud.h:98: error: two or more data types in declaration specifiers
mud.h:98: warning: useless type name in empty declaration
make: *** [act_comm.o] Error 1

Anyone know why this error is accuring?
Australia Forum Administrator #1
What version of Smaug, exactly, did you attempt to compile?

Using this file:

http://www.smaugmuds.org/index.php?a=files&s=download&cid=9&fid=165

... under Lion, I got this:


iMac5:src nick$ make
make -s smaug
  Compiling o/imc.o....
  Compiling o/act_comm.o....
  Compiling o/act_info.o....
  Compiling o/act_move.o....
  Compiling o/act_obj.o....
  Compiling o/act_wiz.o....
  Compiling o/ban.o....
  Compiling o/boards.o....
  Compiling o/build.o....
  Compiling o/calendar.o....
  Compiling o/chess.o....
  Compiling o/clans.o....
  Compiling o/color.o....
  Compiling o/comm.o....
  Compiling o/comments.o....
  Compiling o/const.o....
  Compiling o/db.o....
  Compiling o/deity.o....
  Compiling o/dns.o....
  Compiling o/fight.o....
  Compiling o/handler.o....
  Compiling o/hashstr.o....
  Compiling o/hint.o....
  Compiling o/hotboot.o....
  Compiling o/imm_host.o....
  Compiling o/interp.o....
cc1plus: warnings being treated as errors
interp.c: In function ‘void interpret(CHAR_DATA*, char*)’:
interp.c:564: warning: format ‘%06ld’ expects type ‘long int’, but argument 9 has type ‘__darwin_suseconds_t’
interp.c: In function ‘void do_timecmd(CHAR_DATA*, const char*)’:
interp.c:955: warning: format ‘%06ld’ expects type ‘long int’, but argument 4 has type ‘__darwin_suseconds_t’
interp.c: In function ‘void send_timer(timerset*, CHAR_DATA*)’:
interp.c:1004: warning: format ‘%06ld’ expects type ‘long int’, but argument 4 has type ‘__darwin_suseconds_t’
interp.c:1004: warning: format ‘%06ld’ expects type ‘long int’, but argument 6 has type ‘__darwin_suseconds_t’
interp.c:1004: warning: format ‘%06ld’ expects type ‘long int’, but argument 8 has type ‘__darwin_suseconds_t’
make[1]: *** [o/interp.o] Error 1
make: *** [all] Error 2


There were errors (warnings), but not the ones you got.

Basically I edited interp.c and cast a few arguments (as in the line numbers above) to be (long) where appropriate.

Then I got this:


iMac5:src nick$ make
make -s smaug
  Compiling o/interp.o....
  Compiling o/liquids.o....
  Compiling o/magic.o....
  Compiling o/makeobjs.o....
  Compiling o/mapout.o....
  Compiling o/mapper.o....
  Compiling o/mccp.o....
  Compiling o/misc.o....
  Compiling o/mpxset.o....
  Compiling o/mssp.o....
  Compiling o/mud_comm.o....
  Compiling o/mud_prog.o....
  Compiling o/news.o....
  Compiling o/planes.o....
  Compiling o/player.o....
  Compiling o/polymorph.o....
  Compiling o/renumber.o....
  Compiling o/reset.o....
  Compiling o/save.o....
  Compiling o/services.o....
  Compiling o/sha256.o....
sha256.c:35:20: error: endian.h: No such file or directory
make[1]: *** [o/sha256.o] Error 1


I edited sha256.c and changed the start to read:



#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#if !defined(WIN32)
#include <sys/cdefs.h>
#if defined(__FreeBSD__)
#include <sys/endian.h>
#else
#include <machine/endian.h>
#endif
#endif
#include "sha256.h"



(line in bold changed).

Then I got this:


iMac5:src nick$ make
make -s smaug
  Compiling o/sha256.o....
  Compiling o/shops.o....
  Compiling o/skills.o....
  Compiling o/special.o....
  Compiling o/tables.o....
  Compiling o/track.o....
  Compiling o/update.o....
  Compiling o/variables.o....
  Compiling o/weather.o....
ld: unknown option: -export-dynamic
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1


I edited Makefile and changed as follows:


#Some systems need this for dynamic linking to work.
#EXPORT_SYMBOLS = -export-dynamic


That is, comment out that line.

Also change:


smaug: $(O_FILES)
        rm -f smaug
        $(CC) -export-dynamic -o smaug $(O_FILES) $(L_FLAGS)


to be:


smaug: $(O_FILES)
        rm -f smaug
        $(CC) $(EXPORT_SYMBOLS) -o smaug $(O_FILES) $(L_FLAGS)


Then it worked:


make -s smaug
Generating dependency file ...
Done compiling mud.
make -s dns
Done compiling DNS resolver.
iMac5:src nick$ cd ../area
iMac5:area nick$ ../src/smaug
Thu Oct  6 15:10:23 2011 :: Booting Database
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Thu Oct  6 15:10:23 2011 :: [*****] BOOT: ---------------------[ Boot Log ]--------------------
Thu Oct  6 15:10:23 2011 :: Initializing libdl support...
Thu Oct  6 15:10:23 2011 :: Loading commands...
Thu Oct  6 15:10:23 2011 :: Loading spec_funs...
Thu Oct  6 15:10:23 2011 :: Loading sysdata configuration...
Thu Oct  6 15:10:23 2011 :: Loading socials
Thu Oct  6 15:10:23 2011 :: Loading skill table
Thu Oct  6 15:10:23 2011 :: Sorting skill table...
Thu Oct  6 15:10:23 2011 :: Creating skill table sorted by type...
Thu Oct  6 15:10:23 2011 :: Remapping slots to sns
Thu Oct  6 15:10:23 2011 :: Loading classes
Thu Oct  6 15:10:23 2011 :: Loading races
Thu Oct  6 15:10:23 2011 :: Loading news data
Thu Oct  6 15:10:23 2011 :: Loading liquids
Thu Oct  6 15:10:23 2011 :: Loading mixtures
Thu Oct  6 15:10:23 2011 :: Loading herb table
Thu Oct  6 15:10:23 2011 :: Loading tongues
Thu Oct  6 15:10:23 2011 :: Making wizlist
Thu Oct  6 15:10:23 2011 :: Loading MSSP Data...
Thu Oct  6 15:10:23 2011 :: Initializing random number generator
Thu Oct  6 15:10:23 2011 :: Setting time and weather.
Thu Oct  6 15:10:23 2011 :: Loading holiday chart...
Thu Oct  6 15:10:23 2011 :: Loading DNS cache...
Thu Oct  6 15:10:23 2011 :: Assigning gsn's
... blah blah

Amended on Thu 06 Oct 2011 04:18 AM by Nick Gammon
#2
Hey Nick,

Thanks for all that info! To answer your questions it is the dbsc2.5.2. Just as a note It compiles just fine under ubuntu gnome terminal.


The makefile looks like this..


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

#Uncomment if you wish to enable the Mud Client Compression Protocol
#Comment it out it if you are compiling with Cygwin
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 skills_genie.o \
          space.o special.o stat_obj.o tables.o track.o update.o dns.o new_auth.o \
          md5.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 skills_genie.c \
          new_auth.c md5.c

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

all:
	make dbs

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)

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

clean:
	rm -f *.o dbsaga *~
Australia Forum Administrator #3
Lukem said:

cc -c -DMCCP -O -g3 -Wall -Wuninitialized -DSMAUG -DTIMEFORMAT act_comm.c
In file included from act_comm.c:32:
mud.h:98: error: two or more data types in declaration specifiers
mud.h:98: warning: useless type name in empty declaration
make: *** [act_comm.o] Error 1

Anyone know why this error is accuring?


At the line in question in mud.h change:


typedef unsigned char			bool;


to:



//typedef unsigned char			bool;



Then you get heaps of warnings, and finally:


comm.c:29:19: error: crypt.h: No such file or directory


This is looking a little less well-maintained than SmaugFUSS, because of all the warnings.

If it compiles under Ubuntu, try finding the crypt.h you have on the Ubuntu PC, and making a copy for the Mac. Don't know if that will work or not.
#4
So I did some research and found that crypt.h is a library libcrypto that has been deprecated in lion.

http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion

So now I've just got to find how to install this libcrypto or alter the code in a way to use something else...
Australia Forum Administrator #5
Try commenting out the line:


#include <crypt.h>


like this:


//#include <crypt.h>

#6
Then I get this error:
gcc -DMCCP    -lm -lz  -o dbsaga 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 skills_genie.o space.o special.o stat_obj.o tables.o track.o update.o dns.o new_auth.o md5.o -lcrypt
ld: library not found for -lcrypt
collect2: ld returned 1 exit status
make: *** [dbs] Error 1


I am however going to try your way of compiling smaugFUSS too.
#7
Also, for smaugFUSS what integer variable(s) did you change to long ints exactly?
#8
Lukem said:

Also, for smaugFUSS what integer variable(s) did you change to long ints exactly?


In interp.c that is.
Australia Forum Administrator #9
Well for a message like this:


interp.c: In function ‘void interpret(CHAR_DATA*, char*)’:
interp.c:564: warning: format ‘%06ld’ expects type ‘long int’, but argument 9 has type ‘__darwin_suseconds_t’


I get to line 564, count my way to the 9th argument, and cast it to long.
#10
Nick Gammon said:

Well for a message like this:


interp.c: In function ‘void interpret(CHAR_DATA*, char*)’:
interp.c:564: warning: format ‘%06ld’ expects type ‘long int’, but argument 9 has type ‘__darwin_suseconds_t’


I get to line 564, count my way to the 9th argument, and cast it to long.


Ok, I've spent some time trying to figure this out. I've looked at how to cast a struct as a long and have yet to get any valid information. What I see at 564 as the 9th argument is.. time_used.tv_usec And it setup as a struct.. sort of. struct timeval time_used; Is this correct how I'm following the code? If so how do I set this to long? I did struct timeval{ long time_used;}; and didn't get very far, tried a few other tries and needless to say, didn't have much luck.
#11
So I revisited this issue, just for fun and happy to say I was able to get this working.

1.
mud.h line 98 comment out
//typedef unsigned char bool;

2.
comm.c line 29 change
#include <crypt.h>
to
#include <unistd.h>

3.
In Makefile on line 79 you have to remove the -lcrypt from the string
$(CC) $(L_FLAGS) $(USE_IMC) -o dbsaga $(O_FILES) -lcrypt

Not sure who this will help or how relevant this is anymore, just thought I'd post this since there might be a case someone has a mac they wants to test dbsc2.5.2.

Now to see what I should start coding with first, maybe I'll try making a new race or something.
Australia Forum Administrator #12
Thanks for the update.