Undefined references

Posted by Cyldor on Sat 25 May 2002 08:07 PM — 9 posts, 33,916 views.

USA #0
I just pulled the smaug src off this site, attempted to compile, and this is what is thrown at me.
Quote:

************** /cygdrive/c/smaug/src
$ make
make smaug
make[1]: Entering directory `/cygdrive/c/smaug/src'
gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG save.c
save.c: In function `save_char_obj':
save.c:191: warning: implicit declaration of function `RENAME'
save.c: In function `load_char_obj':
save.c:951: warning: suggest explicit braces to avoid ambiguous `else'
rm -f smaug
gcc -lcrypt -o smaug act_comm.o act_info.o act_move.o act_obj.o act_wiz.o bo
ards.o build.o clans.o comm.o comments.o const.o db.o deity.o fight.o handler.o
hashstr.o ibuild.o ident.o interp.o magic.o makeobjs.o mapout.o misc.o mpxset.o
mud_comm.o mud_prog.o player.o polymorph.o requests.o reset.o save.o shops.o ski
lls.o special.o tables.o track.o update.o grub.o stat_obj.o ban.o services.o pla
nes.o imm_host.o colorize.o
act_comm.o: In function `is_profane':
/cygdrive/c/smaug/src/act_comm.c:3347: undefined reference to `re_exec'
act_info.o: In function `do_hset':
/cygdrive/c/smaug/src/act_info.c:2041: undefined reference to `RENAME'
act_info.o: In function `do_password':
/cygdrive/c/smaug/src/act_info.c:3474: undefined reference to `crypt'
act_wiz.o: In function `do_balzhur':
/cygdrive/c/smaug/src/act_wiz.c:3258: undefined reference to `RENAME'
act_wiz.o: In function `do_mortalize':
/cygdrive/c/smaug/src/act_wiz.c:4880: undefined reference to `RENAME'
act_wiz.o: In function `do_form_password':
/cygdrive/c/smaug/src/act_wiz.c:5441: undefined reference to `crypt'
act_wiz.o: In function `do_destroy':
/cygdrive/c/smaug/src/act_wiz.c:5756: undefined reference to `RENAME'
/cygdrive/c/smaug/src/act_wiz.c:5784: undefined reference to `RENAME'
act_wiz.o: In function `do_pcrename':
/cygdrive/c/smaug/src/act_wiz.c:9922: undefined reference to `RENAME'
/cygdrive/c/smaug/src/act_wiz.c:9925: undefined reference to `RENAME'
build.o: In function `do_mset':
/cygdrive/c/smaug/src/build.c:1692: undefined reference to `crypt'
build.o: In function `fold_area':
/cygdrive/c/smaug/src/build.c:5889: undefined reference to `RENAME'
build.o: In function `do_installarea':
/cygdrive/c/smaug/src/build.c:6613: undefined reference to `RENAME'
comm.o: In function `nanny':
/cygdrive/c/smaug/src/comm.c:1663: undefined reference to `crypt'
/cygdrive/c/smaug/src/comm.c:1750: undefined reference to `crypt'
/cygdrive/c/smaug/src/comm.c:1771: undefined reference to `crypt'
save.o: In function `save_char_obj':
/cygdrive/c/smaug/src/save.c:191: undefined reference to `RENAME'
/cygdrive/c/smaug/src/save.c:258: undefined reference to `RENAME'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/cygdrive/c/smaug/src'
make: *** [all] Error 2


I noticed this was mentioned earler, but never was given a solution. Anybody have any clues on this? Also, I am not a coder...yet.
Australia Forum Administrator #1
Which source did you get - which filename exactly? The latest one doesn't seem to have any reference to RENAME in it.
USA #2
http://www.gammon.com.au/files/smaug/smaug1.4a.sce.zip - 814 Kb - Source (only) for SMAUG server v 1.4a for Win32

Straight out of your downloads section. And I got it out today.
Amended on Sun 26 May 2002 02:21 AM by Cyldor
USA #3
Took me a couple seconds of thinking, but I got it.

In the makefile, there are two lines commented.

#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 = -lcrypt

Uncomment them and its done. I belive crypt and rename are linked together. I got some more errors after this, but I post them tomorrow.
Amended on Sun 26 May 2002 05:46 AM by Cyldor
USA #4
ok, I lied. It came back when I compiled again....no other changes. Renames are gone, but crypt still stands.
Australia Forum Administrator #5
Crypt is used for password encryption. You can probably manage without it. Search for crypt on this forum, I'm sure we've been over this ground before. :)
USA #6
Nope, never have, but I fixed the error. heres the solution

Make a crypt.c in your src. In crypt.c add

char *crypt(const char *key, char *salt)
{
return (char*)key;
}

In your makefile, add crypt.c and crypt.o in the proper places. Also uncomment this line.

NEED_CRYPT = -lcrypt

For rename

In misc.h

// to emulate Unix rename - we must delete the newpath first
int RENAME (const char * oldpath, const char * newpath)
{
remove (newpath);
return rename (oldpath, newpath);
}

What you need to do is add this below it:

#else

int RENAME( const char *oldpath, const char *newpath )
{
return rename( oldpath, newpath );
}

that should fix the rname/crypt errors. Hope this pice of info helps some out
USA #7
I dunno... That *will* work, but it will also not encrypt the passwords in any way. I'd recommend download libcrypt, compiling it, and installing it on the system. That'd probably be a bit more secure. :)
USA #8
Blah, who cares? If it works, it works ;)