Compiling Hellband: makefile.cyg:79 error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smbhax
    Swordsman
    • Oct 2021
    • 354

    Compiling Hellband: makefile.cyg:79 error

    When attempting to compile Hellband in Cygwin, using the code and instructions here https://github.com/NickMcConnell/Ang.../tree/Hellband , I get an error message:

    ~~~~~~~~~~~~

    smbhax@DESKTOP-64GQN1N ~/hellband/src
    $ make -fmakefile.cyg
    gcc -o hellband angband.res z-util.o z-virt.o z-form.o z-rand.o z-term.o variable.o tables.o util.o cave.o object1.o object2.o monster1.o monster2.o xtra1.o xtra2.o spells1.o spells2.o melee1.o melee2.o save.o files.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o store.o birth.o load.o wizard1.o wizard2.o generate.o dungeon.o init1.o init2.o main-win.o readdib.o quest.o -s -mwindows -lwinmm
    /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: files.o:files.c.bss+0xc): multiple definition of `player_uid'; variable.o:variable.c.bss+0x3d90): first defined here
    /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: files.o:files.c.bss+0x8): multiple definition of `player_egid'; variable.o:variable.c.bss+0x3d88): first defined here
    collect2: error: ld returned 1 exit status
    make: *** [makefile.cyg:79: hellband] Error 1

    ~~~~~~~~~~

    That was after swapping to gcc for the compiler (makefile.cyg line 43). When I tried with mingw64 instead, I got a very similar error:

    ~~~~~~~~~~~~

    smbhax@DESKTOP-64GQN1N ~/hellband/src
    $ make -fmakefile.cyg
    x86_64-w64-mingw32-gcc -o hellband angband.res z-util.o z-virt.o z-form.o z-rand.o z-term.o variable.o tables.o util.o cave.o object1.o object2.o monster1.o monster2.o xtra1.o xtra2.o spells1.o spells2.o melee1.o melee2.o save.o files.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o store.o birth.o load.o wizard1.o wizard2.o generate.o dungeon.o init1.o init2.o main-win.o readdib.o quest.o -s -mwindows -lwinmm
    /usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: files.o:files.c.bss+0xc): multiple definition of `player_uid'; variable.o:variable.c.bss+0x3cb0): first defined here
    /usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: files.o:files.c.bss+0x8): multiple definition of `player_egid'; variable.o:variable.c.bss+0x3ca8): first defined here
    collect2: error: ld returned 1 exit status
    make: *** [makefile.cyg:79: hellband] Error 1

    ~~~~~~~~~~~

    Could this be some other package I'm missing?

    Sorry for the horrible noob questions!
    Last edited by smbhax; January 9, 2022, 03:12.
    My Angband videos
  • backwardsEric
    Knight
    • Aug 2019
    • 522

    #2
    Commenting out lines 69 and 70 of files.c (extra definitions of player_uid and player_egid that duplicate ones in variable.c) should fix that linker error.

    For posterity, you might edit the link in the original post so it points to Hellband 's source code at https://github.com/NickMcConnell/Ang...e/Hellband/src rather than Hengband's source code.

    Comment

    • smbhax
      Swordsman
      • Oct 2021
      • 354

      #3
      Originally posted by backwardsEric
      Commenting out lines 69 and 70 of files.c (extra definitions of player_uid and player_egid that duplicate ones in variable.c) should fix that linker error.

      For posterity, you might edit the link in the original post so it points to Hellband 's source code at https://github.com/NickMcConnell/Ang...e/Hellband/src rather than Hengband's source code.
      Let posterity record that I am a noob who can't handle trying to compile multiple 'bands at once! Link corrected. : ) And that files.c fix did the trick!

      That got me far enough to realize makefile.cyg was for compiling a Windows graphics build, and I should be using an option in makefile.org instead if I wanted a Linux/Cygwin ASCII build. And ah yes there were two 'SPECIAL_BSD" ("moves curses") sections of code in main-gcu.c that didn't want to compile either; I commented them out, which let the game compile, and *seems* to work okay in the game itself, although I don't really know what they did.



      But I did eventually compile a seemingly working ASCII version of Hellband for Cygwin in Windows by doing the following, all told:

      - Download the source: https://github.com/NickMcConnell/Ang...s/Hellband.zip from https://github.com/NickMcConnell/Ang.../tree/Hellband
      - Extract it somewhere; these steps assume that you extract it to a new directory under your Cygwin '~' called 'hellband,' in such a way that you end up with Hellband's root directory (ie where 'hellband.cfg' is) as Cygwin's /home/[username]/hellband/

      - In /src/files.c, comment out lines 69 and 70 (thanks backwardsEric!)
      - In /src/main-gcu.c, comment out the 'SPECIAL_BSD' sections, ie lines 465-471 and lines 542-548 (these are 'ifdef' statements, and as backwardsEric showed here http://angband.oook.cz/forum/showthr...900#post156900 , you can comment ifdefs out by surrounding them in a null 'if' statement, with '#if 0' in the line above their '#if," and '#endif' in the line below their '#endif')
      (^ I don't know how critical those SPECIAL_BSD statements were; with them gone, the game compiles, and *seems* to run okay, although when having the game quit abruptly on me due to trying different compile options at one point, I did find myself with a frozen cursor in Cygwin; I wonder if that's the kind of thing they were meant to fix. There's almost certainly a better fix for them not compiling than just commenting them out.)

      - In /src/makefile.org:
      -- In the '## Variation -- Only support "main-gcu.c" (not "main-x11.c")' section:
      --- Uncomment lines 138 and 139, 'CFLAGS' and 'LIBS'
      --- Delete '-ltermcap' from LIBS (line 139)
      -- Completely comment out the '## Variation -- compfile for Ternux' section (lines 173-177)

      - Create a /lib/dump directory (avoids crash using "~" "Display current knowledge" menu)

      - Run Cygwin and enter:
      cd hellband/src
      make -fmakefile.org

      Then from Cygwin's '~' home (ie 'cd ../..' from the 'src' directory) you can run

      ./hellband/hellband

      Game notes:
      - No subwindow support
      - ESC is a bit laggy; '`' ('~' 'tilde' key, directly under the ESC key on most keyboards) works better (Possible fix: http://angband.oook.cz/forum/showpos...46&postcount=8 )
      - Can't use SHIFT+[arrow key] to run; can use '.' then [arrow key], or SHIFT+[VI key] ('Rogue-like commands' interface option)
      Last edited by smbhax; February 6, 2022, 11:06.
      My Angband videos

      Comment

      • smbhax
        Swordsman
        • Oct 2021
        • 354

        #4
        A few reproducible crashes or problems running Hellband locally in Cygwin:


        - Selecting an option in the "Display current knowledge" menu results either in a "cannot open" error being printed, such as "Cannot open './hellband/lib/dump/cmd_a.tmp'. -more-" when trying option 1, or in the Cygwin terminal prompt abruptly appearing halfway down the screen, and no further input printing (can type "exit" to log out of Cygwin, but progress since the last Hellband save will have been lost)

        ^This is fixed by manually creating a "/lib/dump/" directory.


        - Trying to launch the game ("./hellband/hellband") while in a terminal window smaller than 80x24 prints a warning ("Angband [sic] needs an 80x24 'curses' screen") and then further input typed into the terminal does not print
        Last edited by smbhax; February 6, 2022, 10:54.
        My Angband videos

        Comment

        Working...
        😀
        😂
        🥰
        😘
        🤢
        😎
        😞
        😡
        👍
        👎