Getting Angband from Github and compiling it

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts

  • ewert
    replied
    As a FYI, on Win11 I found it hard to get any cmd line ones working (not savvy enough to figure why the preset config stuff didn't work at all), but I got the Visual Studio way working for compiling quite easily.

    Leave a comment:


  • eastwind
    replied
    Certainly the routine could be rewritten much better, it's very 80's. But I wanted to suggest a minimal work-around that could be added to the source base with no drama.

    Leave a comment:


  • Pete Mack
    replied
    Instead of
    Code:
         if (no_error) {...}
    Use
    Code:
        if (info_ptr) {...}
    And get rid of silly redundant no_error flag.

    Leave a comment:


  • eastwind
    replied
    VS 2019, _UNICODE, etc

    Hi all.

    I'm building using VS 2019. The compiler calls out an error in scrnshot.c

    scrnshot.c(105): error C4703: potentially uninitialized local pointer variable 'info_ptr' used

    The code in question is this:

    Code:
    	/* Create the info structure */
    	if (noerror) {                                                               // line 93
    		info_ptr = png_create_info_struct(png_ptr);          // line 94
    		if (!info_ptr) {
    			png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
    			noerror = false;
    		}
    	}
    
    	if (noerror) {                                                               // line 101
    		/* Setup error handling for init */
    		png_init_io(png_ptr, fp);
    
    		png_set_IHDR(png_ptr, info_ptr, width, height,       // line 105
    The error is on the last line shown in the snippet, on the reference to info_ptr.

    It looks to me like the code is correct, because if line 105 is reached then
    noerror was true on line 101, and if noerror was true on line 101 then it was true on line 93 as well, and that means line 94 was reached and info_ptr
    *must* have been inited.

    However, I can understand how that logic might defeat the analysis of the compiler front end, causing it to throw up its hands and issue the error.

    An easy workaround is to modify the declaration of info_ptr to initialize it explicitly to NULL. I believe this is a totally safe workaround that will be
    ok for all other platforms.

    Code:
    	png_infop info_ptr;    // old line 40
    Code:
    	png_infop info_ptr = NULL;    // changed line 40
    It does make the error go away for VS2019, so I'm submitting this one-line change for consideration through this post because I haven't figured out the proper way to submit suggested changes.

    Leave a comment:


  • honnyman
    replied
    Good information. Thanks!

    Leave a comment:


  • malcontent
    replied
    FYI - I recently discovered that the Termux android app allows you to download/build/run angband directly on a chromebook without the need to use the dev channel or start a crosh shell etc.

    The sequence of commands after installing and starting termux look like this (selectively taken from my command history, hopefully I didn't miss anything):

    13 mkdir angband
    15 cd angband/
    16 wget https://rephial.org/downloads/4.2/angband-4.2.0.tar.gz
    19 gunzip angband-4.2.0.tar.gz
    21 tar xvf angband-4.2.0.tar
    23 cd angband-4.2.0
    32 pkg install automake
    33 ./autogen.sh
    39 pkg install clang
    40 ./configure --with-no-install
    45 make install
    47 ./angband

    Leave a comment:


  • takkaria
    replied
    libncursesw5-dev and libncursesw5-dev are the ones you want. Not sure about the rest.

    Leave a comment:


  • Pete Mack
    replied
    Compile errors on chromebook virtual machine (samsung chromebook+).
    I am trying to do a super bare bones (sort of MinGU--minimum gnu environment for unix) compile. I don't have autoconf (I even installed make separately.)
    Code:
    $ make -f Makefile.std
    <command-line>:0:20: error: expected expression before �/’ token
    init.c:344:32: note: in expansion of macro �PRIVATE_USER_PATH’
       path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
    I verified that UNIX is defined, so PRIVATE_USER_PATH should be "~/.angband". But when I modified init.c directly, it is compiling OK. Anyone have a clue of what is happening?

    I also see warnings for missing "static" modifiers for private functions in init.c (init_parse_world, etc.), and duplicate declaration for options_init_cheat in option.h.

    In fact, there are TONS of missing static modifiers, missing const, etc.

    Finally:
    ncurses is missing from the chromebook core install. Any idea which of the many debian packages to install?
    Code:
    $ apt list | grep ncurses
    ekg2-ui-ncurses/stable 1:0.4~pre+20120506.1-13 amd64
    fizmo-ncursesw/stable 0.7.10-2 amd64
    gambas3-gb-ncurses/stable 3.9.1-3 amd64
    lib32ncurses5/stable 6.0+20161126-1+deb9u2 amd64
    lib32ncurses5-dev/stable 6.0+20161126-1+deb9u2 amd64
    lib32ncursesw5/stable 6.0+20161126-1+deb9u2 amd64
    lib32ncursesw5-dev/stable 6.0+20161126-1+deb9u2 amd64
    libcunit1-ncurses/stable 2.1-3-dfsg-2 amd64
    libcunit1-ncurses-dev/stable 2.1-3-dfsg-2 amd64
    libghc-ncurses-dev/stable 0.2.15-3+b1 amd64
    libghc-ncurses-doc/stable 0.2.15-3 all
    libghc-ncurses-prof/stable 0.2.15-3+b1 amd64
    libncurses-gst/stable 3.2.5-1 all
    libncurses5/stable,now 6.0+20161126-1+deb9u2 amd64 [installed,automatic]
    libncurses5-dbg/stable 6.0+20161126-1+deb9u2 amd64
    libncurses5-dev/stable 6.0+20161126-1+deb9u2 amd64
    libncursesada-doc/stable 6.0.20150808-2 all
    libncursesada4/stable 6.0.20150808-2 amd64
    libncursesada4-dev/stable 6.0.20150808-2 amd64
    libncursesw5/stable,now 6.0+20161126-1+deb9u2 amd64 [installed]
    libncursesw5-dbg/stable 6.0+20161126-1+deb9u2 amd64
    libncursesw5-dev/stable 6.0+20161126-1+deb9u2 amd64
    ncurses-base/stable,now 6.0+20161126-1+deb9u2 all [installed]
    ncurses-bin/stable,now 6.0+20161126-1+deb9u2 amd64 [installed]
    ncurses-doc/stable 6.0+20161126-1+deb9u2 all
    ncurses-examples/stable 6.0+20161126-1+deb9u2 amd64
    ncurses-hexedit/stable 0.9.7-14.1+b1 amd64
    ncurses-term/stable,now 6.0+20161126-1+deb9u2 all [installed,automatic]
    ruby-ncurses/stable 1.4.9-1 amd64
    wordgrinder-ncurses/stable 0.6-3 amd64

    Edit:
    Got it. There is something very wrong with the private user data directory--had to hand code it and then create the directory ~/.angband/Angband

    The list of recent messages is causing full screen refresh, which is slow. So is running, even with zero movement delay.
    Last edited by Pete Mack; April 3, 2019, 00:48.

    Leave a comment:


  • aenea77
    replied
    Problem compiling angband with gcc 6

    Hi,
    two days ago I updated my Linux Debian home server from stable(Jessie) to testing (Stretch), the version of the compiler changed to 6.2.1 20161124 (Debian 6.2.1-5).

    After that I tried to compile the Angband source code taken from github and I obtained the following error:
    /usr/bin/ld: -r and -pie may not be used together

    The linker fails when it try to create angband.o, I'm not an expert on gcc but I did some research and it seems that the gcc included in the new Debian version is compiled with the option --enable-default-pie.
    With this configuration a program compiled (and linked) through gcc will be a "position independent executable", this is a security feature.
    Unfortunately ld can't be invoked with -r and -pie.
    A possible solution that I found is to disable the option by using -fno-pie in the compiling phase and -no-pie in the linking phase.
    I modified the Makefile under src directory and now the compiling process terminates correctly and I can play Angband again, for your reference I attach to my post the diff file.

    Regards
    Attached Files

    Leave a comment:


  • Ringil
    replied
    Hi,

    sorry, I'm still confused about where to get the latest version.

    When I compile the source-tarball on http://rephial.org/release/ and start Angband, I see:
    V 4.0.5

    But when I fetch <master> from Github, I see:
    4.0.3-340-<git-hash>

    Is it possible, that I can ignore the 3 in 4.0.3 ? (Don't say, never ignore the '3' in Angband

    Regards, Thanks,
    Ringil

    Leave a comment:


  • Elfin Jedi
    replied
    Um... that is a : and then (after a space) a ( in the error not a frowning face.

    Leave a comment:


  • Elfin Jedi
    replied
    I am trying to build Angband with Netbeans using mingw as compiler. But I am not a computer programmer, and I keep getting this error:

    Successfully compiled main.c.
    c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o).text.startup+0xa7): undefined reference to `WinMain@16'
    collect2.exe: error: ld returned 1 exit status
    make.exe[3]: *** [angband.exe] Error 1
    make.exe[2]: *** [all] Error 2
    make.exe[1]: *** [subdirs] Error 2
    make.exe": *** [all] Error 2

    I don't know what to do about it.
    Last edited by Elfin Jedi; May 24, 2015, 23:54.

    Leave a comment:


  • APWhite
    replied
    Originally posted by Mark
    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!
    Did you try to change the Configuration Properties->General->Character Set to NOT SET?

    Leave a comment:


  • EpicMan
    replied
    Originally posted by EpicMan
    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.
    By the way, the root cause of these character issues was that the Visual Studio project had a default characterset setting under project properties that had defaulted to wchar (or UTF-somewthing, I don't remember now). Changing the character set default to "unspecified" fixed all of the character display issues I had.

    Leave a comment:


  • shadow
    replied
    Originally posted by Derakon
    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, yeah, that would be the problem. Alright, I've got it working, thanks.

    I suppose I'm more or less on my own if I want to get this thing into an xcode project...

    Leave a comment:

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