Getting Angband from Github and compiling it
Collapse
This is a sticky topic.
X
X
-
To be clear, when you say "run the executable", are you double-clicking Angband.app? Or doing "open Angband.app" from the command line? There's an executable file buried within the program package, but I'm not sure it'd work properly if you tried to do "./angband" on the command line. -
OK, I'm on OSX. Looks like I built successfully with:
make -f Makefile.osx
But trying to run the executable errors out with this message:
2014-12-09 21:12:38.286 angband[5826:507] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exitingLeave a comment:
-
Missing menu solved!
I now have a menu on the main window!
The issue was the same as the window titles - it was passing the 1-byte char array "ANGBAND" but was interpreting it as wide chars. Passing L"ANGBAND" fixes the issue.
Font being used to show the map is still odd, probably also related, since the path seems to be lost when you try to choose a font.Leave a comment:
-
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.Leave a comment:
-
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.Leave a comment:
-
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 CambandLeave a comment:
-
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.Leave a comment:
-
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 };Leave a comment:
-
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);
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 *
Leave a comment:
-
If angband.ini already exists, it is used, but if it does not exist, defaults will be used and the file will be written.Leave a comment:
-
Thanks again Baron.
So....
the breakpoints were reached. The error occurs upon line 5308
Code:validate_dir(path);
Not sure quite where the strange behaviour starts, my guess is line 5260 when
Code:GetModuleFileName(hInstance, path, sizeof(path))
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)Leave a comment:
-
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?
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?Leave a comment:
- Try the same steps from fresh on my Laptop - Win Vista & VS2010 - help isolate the cause.
-
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?
Leave a comment:
- Try the same steps from fresh on my Laptop - Win Vista & VS2010 - help isolate the cause.
-
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.
If it helps answer questions/provide transparency, my zipped project folder is here:
Leave a comment:
-
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.
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.
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).Leave a comment:
Leave a comment: