Author Topic: Trying to compile Advanced Rogue 5.8  (Read 8794 times)

Atreides

  • Newcomer
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Trying to compile Advanced Rogue 5.8
« on: April 30, 2014, 06:20:17 AM »
Source code from here:
http://rogue.rogueforge.net/advanced-rogue-5-8/

SVN page:
http://rogue.rogueforge.net/trac/browser/arogue5.8/trunk

Attempted compilation:
Code: [Select]
person@computer ~/Games/arogue5.8.2-src $ make
gcc -g   -c -o chase.o chase.c
gcc -g   -c -o command.o command.c
command.c: In function ‘command’:
command.c:251:4: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
    exit(0);
    ^
command.c: In function ‘quit’:
command.c:454:2: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
  exit(0);
  ^
command.c: In function ‘call’:
command.c:925:6: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
      free(guess[obj->o_which]);
      ^
command.c:926:2: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
  strcpy(prbuf, elsewise);
  ^
command.c:930:6: warning: incompatible implicit declaration of built-in function ‘strncpy’ [enabled by default]
      strncpy(obj->o_mark, prbuf, MARKLEN-1);
      ^
command.c:934:47: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
      guess[obj->o_which] = new((unsigned int) strlen(prbuf) + 1);
                                               ^
command.c:935:6: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
      strcpy(guess[obj->o_which], prbuf);
      ^
gcc -g   -c -o daemon.o daemon.c
gcc -g   -c -o daemons.o daemons.c
gcc -g   -c -o encumb.o encumb.c
gcc -g   -c -o fight.o fight.c
gcc -g   -c -o init.o init.c
init.c: In function ‘init_names’:
init.c:244:28: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
  s_names[i] = (char *) new(strlen(prbuf)+1);
                            ^
init.c:247:2: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
  strcpy(s_names[i], prbuf);
  ^
init.c: In function ‘init_player’:
init.c:302:6: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
      strcpy(pstats.s_dmg,"3d4");
      ^
init.c:353:6: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
      strcpy(pstats.s_dmg,"1d4");
      ^
gcc -g   -c -o io.o io.c
io.c: In function ‘endmsg’:
io.c:68:5: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
     strcpy(huh, msgbuf);
     ^
io.c: In function ‘doadd’:
io.c:90:14: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
     newpos = strlen(msgbuf);
              ^
io.c: In function ‘status’:
io.c:235:15: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
     pb = &buf[strlen(buf)];
               ^
gcc -g   -c -o list.o list.c
gcc -g   -c -o main.o main.c
main.c: In function ‘main’:
main.c:58:5: warning: incompatible implicit declaration of built-in function ‘strncpy’ [enabled by default]
     strncpy(home,md_gethomedir(),LINELEN);
     ^
main.c:61:5: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
     strcpy(file_name, home);
     ^
main.c:62:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [enabled by default]
     strcat(file_name, "arogue58.sav");
     ^
main.c:76:43: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
         strucpy(whoami, md_getusername(), strlen(md_getusername()));
                                           ^
main.c:90:2: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
  exit(0);
  ^
main.c:144:6: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
      exit(1);
      ^
main.c: In function ‘fatal’:
main.c:236:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
     exit(0);
     ^
gcc -g   -c -o maze.o maze.c
gcc -g   -c -o mdport.o mdport.c
mdport.c:59:26: fatal error: ncurses/term.h: No such file or directory
 #include <ncurses/term.h>
                          ^
compilation terminated.
make: *** [mdport.o] Error 1
[2]person@computer ~/Games/arogue5.8.2-src $

I'll look up these error messages in my free time.  Documenting here in case anyone is interested.

EDIT

It compiles if I change mdport.c
line 59 : #include <ncurses/term.h>
to
line 59 : #include <term.h>

This part goes over the character limit, so I moved it to pastebin.

Compilation:
http://pastebin.com/pibXnZN2
« Last Edit: April 30, 2014, 06:59:29 AM by Vimes »

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Trying to compile Advanced Rogue 5.8
« Reply #1 on: April 30, 2014, 08:13:15 AM »
I can't view the source code (no file view access), but I'm assuming that those warnings could be caused by missing or wrong #include for library functions. I vaguely remember that those functions were there without #include as a "standard library".

melville

  • Newcomer
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Trying to compile Advanced Rogue 5.8
« Reply #2 on: April 30, 2014, 04:11:54 PM »
For free() and exit() you need "#include <stdlib.h>", for str* family of functions you need "#include <string.h>". Those headers are pretty often missing from old code, but even without those compiled binary should work. Man pages are your friend, so something like "$ man strcpy" should give you information what headers you need in future
« Last Edit: April 30, 2014, 04:14:10 PM by melville »

Atreides

  • Newcomer
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Trying to compile Advanced Rogue 5.8
« Reply #3 on: May 01, 2014, 12:29:49 AM »
I added
#include <stdlib.h>
#include <string.h>
as appropriate per the compile-time error messages.  Down to 2 error messages, but it compiles and runs.

Now I'm going through command.c, commenting the controls for the game so I can reassign them to less-stupid keys.

Oh, one last thing - does anyone want the modified source code?  I could upload it to github, but bear in mind I'd need to learn how to use git!  I could compress it into a 7z or tar.gz and upload it here if anyone's interested.

EDIT

Took me a while to figure out how to escape single-quotes with grep.  Should have tried the obvious, a backslash.  Saving this for later perusal.

Code: [Select]
[2]person@computer ~/Games/arogue5.8.2-src $ grep \'h\' *.c *.h -n
command.c:132:     case 'h': case 'j': case 'k': case 'l':
command.c:148: case 'h': case 'j': case 'k': case 'l':
command.c:169: case 'h': case 'j': case 'k': case 'l':
command.c:184: when 'h' : do_move(0, -1);  // move 1 left was h
command.c:192: when 'H' : do_run('h'); // move
mdport.c:1066:                case   't': ch = 'h'; break;
mdport.c:1090:            case KEY_LEFT   : ch = 'h'; break;
mdport.c:1103:            case KEY_B1     : ch = 'h'; break;
move.c:33:    { 'h', '\0', 'l' },
move.c:833: case 'h':
rogue.c:421:    'h', " left",
rogue.c:574: 10, TRUE, TRUE, 'h', "8-10",
rogue.c:1014: 15, TRUE, TRUE, 'h', "5-7",
rogue.c:1266: 100, TRUE, FALSE, 'h', "16",
util.c:422:     case 'h': case'H': delta.y =  0; delta.x = -1;
util.c:504:    if (runch == 'h' || runch == 'l') horiz = TRUE;
util.c:653:     case 'h':
« Last Edit: May 02, 2014, 05:35:05 AM by Vimes »