Getting Angband from Github and compiling it

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fizzix
    Prophet
    • Aug 2009
    • 3025

    #76
    Mikko is correct. To compile with Mingw you need to add the bin to path manually. For some reason, mingw doesn't do that. Here are some instructions for xp.

    After that, the command to build is "mingw32-make -f Makefile.win MINGW=YES" you have to tell it to build from the Makefile.win file and not the generic makefile. I've never built with VS, but I think you need to configure first and then build.

    I've still had problems with the .dlls not being copied correctly into the src directory for some reason (and the .exe). So you may need to manually copy the .dll files and the .exe file from the src/ directory. I'll load up IRC at work today if you have any more questions.

    Comment

    • TJS
      Swordsman
      • May 2008
      • 473

      #77
      Hey thanks for the help, but I'm still having problems.

      I've already set the path for the MinGW, but I don't understand what I'm supposed to type the command "mingw32-make -f Makefile.win MINGW=YES" into.

      Is it the normal command prompt? If so it still doesn't recognise the mingw32-make command.

      I've now installed MSYS, but I don't really know what it is or what it does.

      Comment

      • Mikko Lehtinen
        Veteran
        • Sep 2010
        • 1246

        #78
        Originally posted by TJS
        I've already set the path for the MinGW, but I don't understand what I'm supposed to type the command "mingw32-make -f Makefile.win MINGW=YES" into.

        Is it the normal command prompt? If so it still doesn't recognise the mingw32-make command.
        Yes, the normal Windows command prompt. (And in the angband/src directory.) You need to open a new command prompt window after setting the PATH.

        Check your mingw/bin folder: does it have the file mingw32-make.exe?

        Comment

        • TJS
          Swordsman
          • May 2008
          • 473

          #79
          Originally posted by Mikko Lehtinen
          Yes, the normal Windows command prompt. (And in the angband/src directory.) You need to open a new command prompt window after setting the PATH.

          Check your mingw/bin folder: does it have the file mingw32-make.exe?
          Yes it has the mingw32-make.exe file (along with a load of other ones).

          When I installed MSYS it said I needed to rename the make.exe as the mingw32-make.exe, but when I looked in the bin folder there was no make.exe and the mingw32-make.exe was already there.

          Is it possible to point directly to the mingw32-make.exe somehow in the command line?

          Comment

          • Mikko Lehtinen
            Veteran
            • Sep 2010
            • 1246

            #80
            Originally posted by TJS
            Is it possible to point directly to the mingw32-make.exe somehow in the command line?
            Yes.

            Code:
            C:\path\to\mingw\bin\mingw32-make -f Makefile.win MINGW=YES

            Comment

            • TJS
              Swordsman
              • May 2008
              • 473

              #81
              Well that worked a treat thanks!

              I should have figured that out ages ago.

              Comment

              • Zireael
                Adept
                • Jul 2011
                • 204

                #82
                What are the dependencies for Angband? (I'm on Win7)

                Comment

                • TricksterWolf
                  Scout
                  • Sep 2012
                  • 43

                  #83
                  I'm back.

                  Trying to compile fresh again. I have angband set up through NetBeans, cloned from a fork of the recent master branch. Clean worked, compile didn't.

                  Turns out all I needed to do to get compiling to work was to change the make command from:

                  ${MAKE} -f Makefile

                  ...to:

                  ${MAKE} MINGW=yes -f Makefile.win

                  However, I still have one fatal error:

                  z-file.c:25:21: fatal error: direct.h: No such file or directory

                  That's pretty close to the end of the object files so I'm fairly confident I'll get there eventually; but what is this "direct.h"? It's not part of the INCLUDED_ANGBAND_H list, and it's not in the main directory either.

                  Kinda stumped here.

                  Comment

                  • TricksterWolf
                    Scout
                    • Sep 2012
                    • 43

                    #84
                    BUCK YES

                    I did it. It actually compiles.

                    Here's what I had to change (in z-file.c), apart from what I mentioned earlier wrt the make command.

                    1) Commented out the <direct.h> include.

                    2) Changed the definition of my_mkdir in WINDOWS to make it identical to the definition used in HAVE_MKDIR || MACH_O_CARBON. In other words, it now calls mkdir(path, perms) instead of mkdir(path) even though WINDOWS is defined.

                    This is using NetBeans over Cygwin on Windows 7, for those curious.

                    (Now I have to figure out how to run the damn thing, as it is demanding dll's it isn't finding.)

                    Comment

                    • TricksterWolf
                      Scout
                      • Sep 2012
                      • 43

                      #85
                      I changed the main directory to be src, but now it's complaining it can't find lib (it's looking for something in lib/apex so I know it's not win/lib). I may need to compare this to my separate ang game that I play to see what is missing.

                      Any clues would be handy, if you have them. Thanks!

                      UPDATE: If I try to run angband.exe from the directory it's in, it complains about needing a cygwin1.dll. I want this to run through Windows, not Cygwin; I'm only using Cygwin to compile the damned thing. Am I going about this all wrong?

                      UPDATE MOAR: I'm starting to suspect that the problem is mkdir related, in which case my workaround for z-file.c was not correct... But again, any advice would be appreciated.
                      Last edited by TricksterWolf; June 23, 2013, 22:00.

                      Comment

                      • TricksterWolf
                        Scout
                        • Sep 2012
                        • 43

                        #86
                        FINALLY!

                        I had to re-import the project. The problem was that I had the src folder listed as the project folder, and I needed to be one level up. Mostly my fault but still a bit of a stumbler given my lack of knowledge of all the details to the folder structure.

                        Everything works now. For the record, I had to change the make command and I had to edit z-file.c as described before.

                        However, I can run the program from within NetBeans, but not outside it. From outside my IDE it demands cygwin1.dll, which suggests to me that I'm not compiling this properly so it will run under Windows without Cygwin installed.


                        UPDATE: The issue seems to be that I'm not using a cross-compiler properly. I'll do some research on the Web until I find the answer. So close and yet so far...

                        Comment

                        • Mark
                          Adept
                          • Oct 2007
                          • 130

                          #87
                          Trying to compile in VS2013, Windows 7

                          Hi Guys,

                          I'm trying to compile the latest version from github in VS2013, on Windows 7 (SP1, 64-bit).

                          I'm trying to follow the steps found in
                          \src\win\angband_visual_studio_step_by_step.txt (attached)

                          1) It mentions nothing about Makefile. I know nothing about Makefile either, so I'm hoping the talk of Makefile on this thread doesn't apply to Win7/VS2013

                          2) I've done all the steps, but step 6 is unclear to me, perhaps terminology has changed in VS since the steps were written. Step 6 says:

                          6. In the project settings, in the Link tab, in the Object/library modules
                          line, add: "src\win\zlib1.lib src\win\libpng.lib msimg32.lib winmm.lib "
                          to the front of the line.
                          I'm not sure if I've entered "src\win\zlib1.lib src\win\libpng.lib msimg32.lib winmm.lib " in the correct place, so I ended up entering it in multiple places, see screenshot attached.

                          When I compile, I get these errors:

                          Code:
                          1>------ Build started: Project: Angband15MG, Configuration: Debug Win32 ------
                          1>  z-set.c
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(53): error C2065: 'ssize_t' : undeclared identifier
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(53): error C2146: syntax error : missing ';' before identifier 'i'
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(53): error C2065: 'i' : undeclared identifier
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(56): error C2065: 'i' : undeclared identifier
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(57): error C2065: 'i' : undeclared identifier
                          1>d:\users\mark\documents\github\angband\build\src\z-set.c(61): error C2065: 'i' : undeclared identifier
                          1>  mon-lore.c
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1531): error C2057: expected constant expression
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1531): error C2466: cannot allocate an array of constant size 0
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1531): error C2133: 'name_list' : unknown size
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1532): error C2057: expected constant expression
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1532): error C2466: cannot allocate an array of constant size 0
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1532): error C2133: 'color_list' : unknown size
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1533): error C2057: expected constant expression
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1533): error C2466: cannot allocate an array of constant size 0
                          1>d:\users\mark\documents\github\angband\build\src\monster\mon-lore.c(1533): error C2133: 'damage_list' : unknown size
                          1>  Generating Code...
                          ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
                          Can anyone offer me any help? Much appreciated if so!
                          Attached Files

                          Comment

                          • Blue Baron
                            Adept
                            • Apr 2011
                            • 103

                            #88
                            Originally posted by Mark
                            1) It mentions nothing about Makefile. I know nothing about Makefile either, so I'm hoping the talk of Makefile on this thread doesn't apply to Win7/VS2013
                            yeah, the makefile is typically used when cross compiling on Linux, or when using Cygwin or MSYS.

                            Originally posted by Mark
                            2) I've done all the steps, but step 6 is unclear to me, perhaps terminology has changed in VS since the steps were written. Step 6 says:

                            I'm not sure if I've entered "src\win\zlib1.lib src\win\libpng.lib msimg32.lib winmm.lib " in the correct place, so I ended up entering it in multiple places, see screenshot attached.
                            The image is difficult to read, but it looks like the first line of the first image is "additional dependencies", and the last item on that line is "kernel{32 or 64}.lib". If so, that would be the correct line.


                            Originally posted by Mark
                            When I compile, I get these errors:
                            for the first error group (in z-set.c) the compiler is not finding a definition of "ssize_t". I'm not sure where it might be defined, but you should be able to be replace it with "int" on line 53, as that is the return value of the function _set_find.

                            for the second group (in monster/mon-lore.c), visual studio does not see list_size as a constant for the array initializations. you should be able to replace "list_size" with "64" on lines 1531, 1532,and 1533, to get it to compile.

                            I have not tried it, so I'm not sure if the above is correct, but the above replacements might get it to compile for you.

                            Comment

                            • Mark
                              Adept
                              • Oct 2007
                              • 130

                              #89
                              Thanks for your help Blue Baron.

                              I made the replacements you suggested and the errors stopped. Weird that the const declaration one line above didn't seem to prevent it anyway

                              Code:
                              	static const int list_size = 64;
                              sits right above
                              Code:
                              	const char *initial_pronoun;
                              	const char *name_list[64];
                              	int color_list[64];
                              	int damage_list[64];
                              (the above snippet already has "list_size" swapped for "64")

                              Then I ran into Linker errors, apparently the path and file names I put in the additional dependancies were incorrect. (I put "\src\win\" but needed "\src\win\lib" and I refered to "zlib1.lib", whereas it needed to be "zlib.lib"). Perhaps the Visual Studio help file can be updated. (If I were more confident in my github usage and that these are indeed corrections not artifacts of something I'm doing wrong, I'd make the change myself).

                              However (!) I now get new errors:

                              Code:
                              1>------ Build started: Project: Angband15MG, Configuration: Debug Win32 ------
                              1>cmd-misc.obj : error LNK2019: unresolved external symbol _do_cmd_borg referenced in function _do_cmd_try_borg
                              1>dungeon.obj : error LNK2001: unresolved external symbol _borg_active
                              1>D:\Users\mark\Documents\GitHub\angband\build\Debug\Angband15MG.exe : fatal error LNK1120: 2 unresolved externals
                              ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
                              Any ideas how to fix them or if I'm doing something fundamentally wrong in the first instance?

                              Something Borgish not updated/supported in the latest win libs?

                              Comment

                              • Nick
                                Vanilla maintainer
                                • Apr 2007
                                • 9647

                                #90
                                OK, I don't really know what I'm doing here, but I'll have a guess.

                                It looks like the instructions don't include compiling the borg in. So your options to me look like:
                                1. Don't include the borg. To do this, I think just commenting out (or deleting) the line
                                  Code:
                                  #define ALLOW_BORG
                                  in src\config.h should work;
                                2. Compile the borg in. I suspect adding all the .c and .h files in the src\borg directory (as you did for the src\player etc directories) will do the trick, or at least give a different error.
                                One for the Dark Lord on his dark throne
                                In the Land of Mordor where the Shadows lie.

                                Comment

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