Getting Angband from Github and compiling it

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark
    Adept
    • Oct 2007
    • 130

    #91
    Thanks Nick,

    I took the second option you suggested and the errors are gone. Trying to compile gives a new Windows error. "The program can't start because libpng12.dll is missing from your computer. Try reinstalling the program to fix this problem." (image attached)

    The output window contains:

    Code:
    'Angband15MG.exe' (Win32): Loaded 'D:\Users\mark\Documents\GitHub\angband\build\Debug\Angband15MG.exe'. Symbols loaded.
    'Angband15MG.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
    'Angband15MG.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
    'Angband15MG.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
    The program '[3840] Angband15MG.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.

    I found libpng12.dll in src\win\dll - not being quite sure what to do I put copies in \src and \src\win. This didn't help. Given the output window referenced other dll's in "C:\windows\SysWOW64" I copied libpng12.dll there too - and this just gave a strange error instead (perhaps the same error but in foreign characters). See attached.

    Any ideas? And thanks to everyone helping get this far!
    Attached Files

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9647

      #92
      Originally posted by Mark
      I found libpng12.dll in src\win\dll - not being quite sure what to do I put copies in \src and \src\win. This didn't help. Given the output window referenced other dll's in "C:\windows\SysWOW64" I copied libpng12.dll there too - and this just gave a strange error instead (perhaps the same error but in foreign characters). See attached.

      Any ideas? And thanks to everyone helping get this far!
      I believe you need to copy libpng12.dll and zlib1.dll to the top directory, the one with angband.exe in it.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • Mark
        Adept
        • Oct 2007
        • 130

        #93
        Hmm....

        ...actually I already had them in the root folder of the project too, I forgot to mention that.

        However, I do have my exe being created in \Debug. I copy the two dll's there - and I get the same forign-character error as when I copy them to SysWOW64, and if I delete them from there, I get the regular english error message.

        Comment

        • Blue Baron
          Adept
          • Apr 2011
          • 103

          #94
          Originally posted by Mark
          Hmm....

          ...actually I already had them in the root folder of the project too, I forgot to mention that.

          However, I do have my exe being created in \Debug. I copy the two dll's there - and I get the same forign-character error as when I copy them to SysWOW64, and if I delete them from there, I get the regular english error message.
          Is angband.exe in the root of the project as well? The foreign language error could be an error that the exe could not find the lib directory (it could be in the other language due to something relating to UTF-8).

          In your case, is the project directory "D:\Users\mark\Documents\GitHub\angband\build" ?

          if so, is the src directory "D:\Users\mark\Documents\GitHub\angband\build\ src" and the game library directory "D:\Users\mark\Documents\GitHub\angband\build\lib" ?

          Well, in any case, the angband.exe and the two DLLs should be in the directory above the lib (game library) directory.

          Originally posted by Mark
          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).
          These are indeed corrections that should be made.

          Comment

          • Mark
            Adept
            • Oct 2007
            • 130

            #95
            All the changes and assumptions I've made trying to get this to work have caused doubts that I had introduced some confounding error, so I started over - just to ensure I hadn't done something strange.

            I also documented what I did carefully, against the original instructions, and if I get to the point where I can actually run the game, these could serve as an updated 'how to'. The document is linked as pdf (wonky fonts) and Word file. (Couldn't attach as they are over the small kb limit allowed for attachments)

            Word fie:


            PDF file:


            But to relate the final outcome of trying again to the previous posts,
            • angband.exe is in the root of the project
            • "lib" directory was not in the root of the project (but I since added this)
            • the dll's in question were in the project folder.


            I still get the pop-up with the strange language. The warnings that VS logs may or may not be relevant?

            Code:
            'AngbandBuild.exe' (Win32): Loaded 'D:\Users\mark\Documents\GitHub\AngbandBuild\libpng12.dll'. Module was built without symbols.
            'AngbandBuild.exe' (Win32): Loaded 'D:\Users\mark\Documents\GitHub\AngbandBuild\zlib1.dll'. Module was built without symbols.
            Of the ~30 dll's that were loaded, only these two had "Module was built without symbols."

            If it helps answer questions/provide transparency, my zipped project folder is here:

            Comment

            • Mark
              Adept
              • Oct 2007
              • 130

              #96
              Short of specific ideas to resolve this, my next steps will be
              • Try the same steps from fresh on my Laptop - Win Vista & VS2010 - help isolate the cause.
              • Try getting an earlier version of the Angband repo - perhaps the dll's or something else have changed sub-optimally of late?

              Comment

              • Blue Baron
                Adept
                • Apr 2011
                • 103

                #97
                Originally posted by Mark
                Short of specific ideas to resolve this, my next steps will be
                • Try the same steps from fresh on my Laptop - Win Vista & VS2010 - help isolate the cause.
                • Try getting an earlier version of the Angband repo - perhaps the dll's or something else have changed sub-optimally of late?
                At this point I am just guessing, but you can try setting a breakpoint at the beginning of WinMain in main-win.c (perhaps line 5361 or 5408). If the error message comes up before the breakpoint, then the problem is probably with your computer. If the breakpoint is reached before the error message comes up, then you can step through the program to see where the message appears.

                Also, those dll warnings should just be that the dlls were not built with debug information. The same dlls have been used for the last couple of years.

                And, only the output directory should use the solution directory, the intermediate directory should be left at the configuration directory.

                Lastly, from other threads it sounds like you are playing with the pre-built binaries? If so, what happens if you copy the pre-built binary to your project directory or the binary that you compile to the pre-built directory?

                Comment

                • Mark
                  Adept
                  • Oct 2007
                  • 130

                  #98
                  Thanks again Baron.

                  So....

                  the breakpoints were reached. The error occurs upon line 5308

                  Code:
                  validate_dir(path);
                  where "path" has a value of "Ilib\\"

                  Not sure quite where the strange behaviour starts, my guess is line 5260 when
                  Code:
                  GetModuleFileName(hInstance, path, sizeof(path))
                  sets "path" to be "D". That's the drive letter of my project path, but the entire path should be:


                  Code:
                  D:\Users\mark\Documents\GitHub\AngbandBuild

                  I found an option in VS2013 Porejct Properties -> C/C+ -> All Options "Use Full Paths" - it was set to No, but changing to Yes made no difference. Probably wild goose chasing a red herring!

                  Also, "Documents" is a Windows 7 'library' or 'collection' - but I doubt that is throwing out GetModuleFileName

                  If I copy 'my' binary into the pre-built directory, I get the same error.

                  If I copy the pre-built binary into my project directory, I get the game booting (at least further than with my binary) and a different error: "bad f2-flag: SEASONAL" (see attached image).


                  A question - should I have in my project directory an angband.ini file, or does that get written by the program (assuming it doesn't crash like mine)?

                  (Also I set the Intermediate Directory back to "$(Configuration)\", as you say)
                  Attached Files

                  Comment

                  • Blue Baron
                    Adept
                    • Apr 2011
                    • 103

                    #99
                    Originally posted by Mark
                    Not sure quite where the strange behaviour starts, my guess is line 5260 when
                    Code:
                    GetModuleFileName(hInstance, path, sizeof(path))
                    sets "path" to be "D". That's the drive letter of my project path, but the entire path should be:
                    ahh the compiler is probably picking the wide character version of GetModuleFileName. Since the string functions use 8-bit characters, you can try to change it to "GetModuleFileNameA" for the 8-bit character version. (The 0 bytes in a wide character string would be the end of an 8-bit character string.) If this works, this sort of error may also appear in other places with system functions.

                    Originally posted by Mark
                    I found an option in VS2013 Porejct Properties -> C/C+ -> All Options "Use Full Paths" - it was set to No, but changing to Yes made no difference. Probably wild goose chasing a red herring!
                    This option is probably how file paths are stored in solution/project files.

                    Originally posted by Mark
                    If I copy the pre-built binary into my project directory, I get the game booting (at least further than with my binary) and a different error: "bad f2-flag: SEASONAL" (see attached image).
                    I'm guessing again, but probably the lib/edit files on github were updated and have a flag that the pre-built doesn't understand.

                    Originally posted by Mark
                    A question - should I have in my project directory an angband.ini file, or does that get written by the program (assuming it doesn't crash like mine)?
                    If angband.ini already exists, it is used, but if it does not exist, defaults will be used and the file will be written.

                    Comment

                    • Mark
                      Adept
                      • Oct 2007
                      • 130

                      Definite progress is being made.

                      Changing "GetModuleFileName" to "GetModuleFileNameA" produced the full path name

                      I was also required to change "GetFileAttributes" to "GetFileAttributesA" in the "check_dir" method. After that the error was no longer thrown by "validate_dir".

                      As is the way, some new problems/oddities exist:
                      • The game boots, but there are no title bar options like "File", "Window", "Options", I was able to start a new character with Ctrl-N. (See attached)
                      • The Window title is still in foreign characters. (See attached)
                      • Text is weirdly rendered (bad cropping/kerning/something?). (See attached)
                      • I could progress through all the character creation flow (with weird rendered text) but got an endless series of exceptions when I tried to start the game proper. (See attached for exception)


                      Using my binary in the pre-built directory produced an "AngbandBuild.exe has stopped working" Windows error message. (this also happened if I ran my binary in my project folder not launched from visual studio).

                      Digging into when the exception is triggered, it appears to be premultiplying 64x64.png in the graf folder.

                      Line 1244 on main.win.c calls "ReadDIB2_PNG" in readpng.c, which throws the exception on line 102

                      Code:
                      	png_read_info(png_ptr, info_ptr);
                      values:
                      Code:
                      info_ptr	0x00b57a70 {width=0 height=0 valid=0 ...}	png_info_struct *
                      png_ptr	0x00b53270 {jmpbuf=0x00b53270 {6942000, 11874928, 6942000, 6941276, 6941080, 1824862439, 6945828, 0, ...} ...}	png_struct_def *
                      Attached Files

                      Comment

                      • EpicMan
                        Swordsman
                        • Dec 2009
                        • 455

                        I am trying to build Angband 3.5-release (https://github.com/angband/angband/tree/3.5-release) with Visual Studio 2013 using Blue Baron's guide and Mark's comments.

                        When I compile I am getting a syntax error on these foo_make_module declarations, i.e.
                        struct init_module generate_module = {
                        .name = "generate",
                        .init = run_room_parser,
                        .cleanup = NULL
                        };

                        The error is C2509: syntax error '.'

                        Any ideas?

                        EDIT: Turns out MS's compiler doesn't support this syntax, at least in my version of VS2013. I was able to get around it by using this syntax:
                        struct init_module generate_module = { "generate", run_room_parser, NULL };
                        Last edited by EpicMan; April 8, 2014, 20:39. Reason: Fixed

                        Comment

                        • EpicMan
                          Swordsman
                          • Dec 2009
                          • 455

                          Linker also couldn't handle lines 2853-2855 in init.c, where the declarations said they were external:
                          extern struct init_module mon_make_module;

                          Copying the lines into externs.h and removing the extern modifier from the lines fixed the issue.

                          I also have gotten a bunch of linker errors for readpng.obj and scrnshot.obj. I'll post my fixes for those when I find them.

                          Comment

                          • EpicMan
                            Swordsman
                            • Dec 2009
                            • 455

                            Strange. I had not added png.h and pngconf.h, but even after adding them to the project I am still getting 28 unresolved external symbols:

                            Error 312 error LNK2019: unresolved external symbol _png_set_sig_bytes referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 313 error LNK2019: unresolved external symbol _png_sig_cmp referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 314 error LNK2019: unresolved external symbol _png_create_read_struct referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 315 error LNK2019: unresolved external symbol _png_create_info_struct referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 317 error LNK2019: unresolved external symbol _png_read_info referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 318 error LNK2019: unresolved external symbol _png_set_palette_to_rgb referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 319 error LNK2019: unresolved external symbol _png_set_tRNS_to_alpha referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 320 error LNK2019: unresolved external symbol _png_set_bgr referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 321 error LNK2019: unresolved external symbol _png_set_gray_to_rgb referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 322 error LNK2019: unresolved external symbol _png_set_interlace_handling referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 323 error LNK2019: unresolved external symbol _png_set_strip_16 referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 324 error LNK2019: unresolved external symbol _png_read_update_info referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 325 error LNK2019: unresolved external symbol _png_read_image referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 326 error LNK2019: unresolved external symbol _png_destroy_read_struct referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 327 error LNK2019: unresolved external symbol _png_init_io referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 329 error LNK2019: unresolved external symbol _png_get_valid referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 330 error LNK2019: unresolved external symbol _png_get_rowbytes referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 331 error LNK2019: unresolved external symbol _png_get_image_width referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 332 error LNK2019: unresolved external symbol _png_get_image_height referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 333 error LNK2019: unresolved external symbol _png_get_bit_depth referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 334 error LNK2019: unresolved external symbol _png_get_color_type referenced in function _ReadDIB2_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\readpng.obj Camband
                            Error 316 error LNK2001: unresolved external symbol _png_create_info_struct c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 328 error LNK2001: unresolved external symbol _png_init_io c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 335 error LNK2019: unresolved external symbol _png_create_write_struct referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 336 error LNK2019: unresolved external symbol _png_write_info referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 337 error LNK2019: unresolved external symbol _png_set_packing referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 338 error LNK2019: unresolved external symbol _png_write_image referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 339 error LNK2019: unresolved external symbol _png_write_end referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 340 error LNK2019: unresolved external symbol _png_destroy_write_struct referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband
                            Error 341 error LNK2019: unresolved external symbol _png_set_IHDR referenced in function _SaveWindow_PNG c:\Users\a0866523\documents\visual studio 2012\Projects\Camband\Camband\scrnshot.obj Camband

                            Comment

                            • EpicMan
                              Swordsman
                              • Dec 2009
                              • 455

                              OK, after copying the dlls to the executable directory I could get a window running, but with the same issues as Mark is having - Title is (3 Asian characters)d, ASCII art looks wonky, and no menu, though the .rc file is included in the project and looks OK when I open it in Visual Studio.

                              I notice that win-layout.c has a reference to Angband.h that is commented out, and un-commenting it causes a bunch of compile-time errors. Maybe the reference is needed for the menu to work; I'll see if I can fix the errors and keep the reference on.

                              Nope, externs.h blows up if I do that, so go back.

                              Changing AddFontResourceEx to AddFontResourceExA on line 1420 of main-win.c causes the title screen to look good. Menu still missing and window titles are still not displaying correctly, even though debugging shows the data being passed around looks normal.
                              Last edited by EpicMan; April 9, 2014, 00:32.

                              Comment

                              • EpicMan
                                Swordsman
                                • Dec 2009
                                • 455

                                The strange characters in the window titles is because the widechar version of CreateWindowEx() is being called in main-win.c:init_windows(), but the titles are string literals (i.e. 1-byte chars). In this case I cannot simply call CreateWindowExA() (it causes a crash).

                                I fixed this by changing angband_term_name[]'s type to wchar_t. This required prepending an 'L' in front of the string literals, i.e. "term-1" becomes L"term-1".

                                I can start the game using control-N but the main view's font size is massive and unplayable. If I could get the menu working I could change it.

                                Comment

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