Compiling Z+Angband under Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Altefcat
    Rookie
    • Sep 2008
    • 11

    Compiling Z+Angband under Windows

    Hello,

    Before I start to scratch my hair off my head, I thought I would better ask here first if anyone wise geek could give me clues for compiling Z+Angband under Windows.

    Especially, what compilator and what makefile file should do the best work ?

    I've tried using gnuwin with makefile.std (following some Andrew Doull advices), but with no success.

    Edit: thanks to Mango Juice, here is the howto.
    1. Install lcc from there: http://www.q-software-solutions.de/downloaders
    2. Get Z+Angband source files from there: http://tinyurl.com/5pq2bd and extract them to a folder
    3. Copy the file lua.h from the src\lua folder to the src folder
    4. Extract the file make.bat.txt attached to this post to the src folder and rename it to make.bat
    5. Launch a command prompt, move to the src folder and run make.bat
    Attached Files
    Last edited by Altefcat; December 11, 2008, 09:56.
  • Mangojuice
    Z+Angband Maintainer
    • Jun 2008
    • 318

    #2
    Originally posted by Altefcat
    Hello,

    Before I start to scratch my hair off my head, I thought I would better ask here first if anyone wise geek could give me clues for compiling Z+Angband under Windows.

    Especially, what compilator and what makefile file should do the best work ?

    I've tried using gnuwin with makefile.std (following some Andrew Doull advices), but with no success.
    I myself use lcc; in the source package, in the \src directory, is a Makefile; that is the one to use. Unfortunately, there's one thing it doesn't do for you: the lua .c files (like l-player.c) have to be made from the .pkg files, using the "tolua" program which also has to be compiled. I'm attaching a .bat file to make the tolua program, which assumes you are using lcc and that it is installed in C:\lcc. Run that from the \src directory (enter "tolua_make" at a command prompt). After that you have to do (from the \src directory)

    lua\tolua.exe -o l-spell.c l-spell.pkg

    Do this for each .pkg file. You can then do "make install_game" in the \src directory to make the executable. Hopefully that will work for you.
    -----------------------------------------
    Z+Angband: A Zangband evolution
    http://tinyurl.com/5pq2bd

    Comment

    • Mangojuice
      Z+Angband Maintainer
      • Jun 2008
      • 318

      #3
      Oops, forgot to attach the file. Here it is. Download it to your \src directory and then do

      Code:
      move tolua_make.txt tolua_make.bat
      tolua_make
      (I had to upload it as a .txt file because of the forum rules.)
      Attached Files
      -----------------------------------------
      Z+Angband: A Zangband evolution
      http://tinyurl.com/5pq2bd

      Comment

      • Altefcat
        Rookie
        • Sep 2008
        • 11

        #4
        Ok thank you for your reply. The tolua_make.bat file was already in the lua folder. But that's not working; first I get some warnings with tolua_make.bat, I don't know if that matters a lot:

        Code:
        Warning lapi.c: 115  Statement has no effect
        0 errors, 1 warning
        Warning liolib.c: 313  indexing array 122[512] out of bounds (512)
        0 errors, 1 warning
        Error lobject.c: 21  compiler error in defconst--Constant not recognized of type Value
        Warning lparser.c: 399  Statement has no effect
        0 errors, 1 warning
        Warning lstrlib.c: 56  indexing array 32[512] out of bounds (512)
        Warning lstrlib.c: 69  indexing array 45[512] out of bounds (512)
        Warning lstrlib.c: 105  indexing array 78[512] out of bounds (512)
        Warning lstrlib.c: 497  indexing array 432[512] out of bounds (512)
        Warning lstrlib.c: 540  indexing array 486[512] out of bounds (512)
        Warning lstrlib.c: 542  indexing array 492[512] out of bounds (512)
        0 errors, 6 warnings
        Warning lzio.c: 21  Statement has no effect
        0 errors, 1 warning
        Warning tolualua.c: 16  Statement has no effect
        Warning tolualua.c: 2976  Statement has no effect
        0 errors, 2 warnings
        Warning tolua_bd.c: 24  Statement has no effect
        0 errors, 1 warning
        Warning tolua_gp.c: 107  Statement has no effect
        0 errors, 1 warning
        Then when running the make command, I have this:

        Code:
            C:\lcc\bin\lcc.exe -O -g l-monst.c
        cpp: c:\jeux\zplusangband_031beta_src\src\lua\tolua.h:28 l-monst.c:6 Could not find include file "lua.h"
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 32  syntax error; found `*' expecting ')'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 32  skipping `*' `L'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 32  extraneous old-style parameter list
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 33  syntax error; found `*' expecting ')'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 33  skipping `*' `L' `,'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 33  Syntax error; missing semicolon before  `)'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 33  skipping `)'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  syntax error; found `*' expecting ')'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  skipping `*' `L' `,'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  extraneous old-style parameter list
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  Syntax error; missing semicolon before  `int'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  missing identifier
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  Syntax error; missing semicolon before  `int'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  Syntax error; missing semicolon before  `)'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 34  skipping `)'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  syntax error; found `*' expecting ')'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  skipping `*' `L' `,'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  extraneous old-style parameter list
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  Syntax error; missing semicolon before  `int'
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  missing identifier
        Error c:\jeux\zplusangband_031beta_src\src\l-monst.c: lua\tolua.h: 35  too many errors
        make.exe: Error code 1
        I can modify l-monst.c to include properly lua.h, but then I get some other errors. Do you have an idea what I've done wrong?

        Please find attached a batch file I've done to try to automize the whole make process.

        By the way I've installed lcc from the first link of that page.
        Attached Files

        Comment

        • Mangojuice
          Z+Angband Maintainer
          • Jun 2008
          • 318

          #5
          Originally posted by Altefcat
          Ok thank you for your reply. The tolua_make.bat file was already in the lua folder. But that's not working; first I get some warnings with tolua_make.bat, I don't know if that matters a lot:
          That's probably okay.

          Then when running the make command, I have this:

          I can modify l-monst.c to include properly lua.h, but then I get some other errors. Do you have an idea what I've done wrong?
          My instinct is that lcc is somehow not looking in the right place for the .h file. It probably expects the lua.h file to be in your src directory, so maybe copy it into there. Then you won't have to repeat this fix for all the lua wrapper files. But let me know if you get other problems.
          -----------------------------------------
          Z+Angband: A Zangband evolution
          http://tinyurl.com/5pq2bd

          Comment

          • Altefcat
            Rookie
            • Sep 2008
            • 11

            #6
            Copying lua.h to the source dir solved the first error, but then I got:

            Code:
                C:\lcc\bin\lcc.exe -O -g l-monst.c
            Error l-monst.c: 9  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 9  unrecognized declaration
            Warning l-monst.c: 9  no type specified. Defaulting to int
            Error l-monst.c: 10  redefinition of 'tolua_l'
            Error l-monst.c: 9  Previous definition of 'tolua_l' here
            Error l-monst.c: 10  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 10  unrecognized declaration
            Warning l-monst.c: 10  no type specified. Defaulting to int
            Warning l-monst.c: 17  Statement has no effect
            Error l-monst.c: 22  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 22  unrecognized declaration
            Warning l-monst.c: 22  no type specified. Defaulting to int
            Error l-monst.c: 32  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 32  unrecognized declaration
            Warning l-monst.c: 32  no type specified. Defaulting to int
            Error l-monst.c: 33  redefinition of function 'monst_monster_race_flags'
            Error l-monst.c: 22  Previous definition of 'monst_monster_race_flags' here
            Error l-monst.c: 42  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 42  unrecognized declaration
            Warning l-monst.c: 42  no type specified. Defaulting to int
            Error l-monst.c: 50  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 50  unrecognized declaration
            Warning l-monst.c: 50  no type specified. Defaulting to int
            Error l-monst.c: 51  redefinition of function 'monst_monster_race_d_char'
            Error l-monst.c: 42  Previous definition of 'monst_monster_race_d_char' here
            Error l-monst.c: 60  Syntax error; missing semicolon before  `-'
            Error l-monst.c: 60  unrecognized declaration
            Warning l-monst.c: 60  no type specified. Defaulting to int
            Error l-monst.c: 68  too many errors
            c:\lcc\bin\make.exe: Error code 1
            Even after copying every lua\*.h to the src dir, I get the same error.

            Maybe it's because of a different lcc version?

            I have:

            Code:
            C:\Jeux\ZPlusAngband_031beta_src\src>lcc.exe -v
            Logiciels/Informatique lcc-win32 version 3.8. Compilation date: Dec  2 2008 14:31:08
            which is rather young...

            Comment

            • Mangojuice
              Z+Angband Maintainer
              • Jun 2008
              • 318

              #7
              Originally posted by Altefcat
              Copying lua.h to the source dir solved the first error, but then I got:

              Code:
                  C:\lcc\bin\lcc.exe -O -g l-monst.c
              Error l-monst.c: 9  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 9  unrecognized declaration
              Warning l-monst.c: 9  no type specified. Defaulting to int
              Error l-monst.c: 10  redefinition of 'tolua_l'
              Error l-monst.c: 9  Previous definition of 'tolua_l' here
              Error l-monst.c: 10  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 10  unrecognized declaration
              Warning l-monst.c: 10  no type specified. Defaulting to int
              Warning l-monst.c: 17  Statement has no effect
              Error l-monst.c: 22  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 22  unrecognized declaration
              Warning l-monst.c: 22  no type specified. Defaulting to int
              Error l-monst.c: 32  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 32  unrecognized declaration
              Warning l-monst.c: 32  no type specified. Defaulting to int
              Error l-monst.c: 33  redefinition of function 'monst_monster_race_flags'
              Error l-monst.c: 22  Previous definition of 'monst_monster_race_flags' here
              Error l-monst.c: 42  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 42  unrecognized declaration
              Warning l-monst.c: 42  no type specified. Defaulting to int
              Error l-monst.c: 50  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 50  unrecognized declaration
              Warning l-monst.c: 50  no type specified. Defaulting to int
              Error l-monst.c: 51  redefinition of function 'monst_monster_race_d_char'
              Error l-monst.c: 42  Previous definition of 'monst_monster_race_d_char' here
              Error l-monst.c: 60  Syntax error; missing semicolon before  `-'
              Error l-monst.c: 60  unrecognized declaration
              Warning l-monst.c: 60  no type specified. Defaulting to int
              Error l-monst.c: 68  too many errors
              c:\lcc\bin\make.exe: Error code 1
              Even after copying every lua\*.h to the src dir, I get the same error.

              Maybe it's because of a different lcc version?

              I have:

              Code:
              C:\Jeux\ZPlusAngband_031beta_src\src>lcc.exe -v
              Logiciels/Informatique lcc-win32 version 3.8. Compilation date: Dec  2 2008 14:31:08
              which is rather young...
              I think I've got it. I had the wrong instructions before: do

              "lua\tolua.exe -n monst -o l-monst.c l-monst.pkg"

              to make l-monst.c; the "-n monst" makes the base name for all the functions "monst" instead of "l-monst", which confuses the compiler badly because it thinks the '-' is subtraction.
              -----------------------------------------
              Z+Angband: A Zangband evolution
              http://tinyurl.com/5pq2bd

              Comment

              • Altefcat
                Rookie
                • Sep 2008
                • 11

                #8
                Originally posted by Mangojuice
                I think I've got it. I had the wrong instructions before: do

                "lua\tolua.exe -n monst -o l-monst.c l-monst.pkg"

                to make l-monst.c; the "-n monst" makes the base name for all the functions "monst" instead of "l-monst", which confuses the compiler badly because it thinks the '-' is subtraction.
                That made it, thank you very much!

                I've updated the first post to give the full procedure. Is it possible to remove the '?' in the title?

                Comment

                • pav
                  Administrator
                  • Apr 2007
                  • 793

                  #9
                  Originally posted by Altefcat
                  I've updated the first post to give the full procedure. Is it possible to remove the '?' in the title?
                  Sure, done.
                  See the elves and everything! http://angband.oook.cz

                  Comment

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