[ToME 2] Getting serious about the SDL interface (again)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Therem Harth
    Knight
    • Jan 2008
    • 856

    #16
    Originally posted by AnonymousHero
    Did you run it exactly like this?

    $ cmake -G "MinGW Makefiles"
    $ mingw32-make
    No, I must have forgotten about that. Thanks, I'll see what I can do.

    I have considered "waf" recently while experimenting a little bit with D (which was a pain in CMake), but that requires Python -- though it's less dependent on the user actually having anything else installed.

    Suggestions for build systems are most welcome.
    I'll be on the lookout for possibly better ones. Alas this is not something I'm very familiar with.

    Comment

    • Therem Harth
      Knight
      • Jan 2008
      • 856

      #17
      Aha... It had to be

      Code:
      cmake -G "MSYS Makefiles"
      Anyway the unlua branch is not compiling. I get

      Code:
      [ 99%] Building C object src/CMakeFiles/tome.dir/main-win.c.obj
      d:/Projects/tome2/src/main-win.c:663: warning: 'extract_file_name' defined but not used
      [100%] Building C object src/CMakeFiles/tome.dir/readdib.c.obj
      d:/Projects/tome2/src/readdib.c: In function 'ReadDIB':
      d:/Projects/tome2/src/readdib.c:319: warning: passing argument 3 of 'MakeBitmapAndPalette' from incompatible pointer type
      d:/Projects/tome2/src/readdib.c:138: note: expected 'struct HPALETTE__ **' but argument is of type 'void **'
      d:/Projects/tome2/src/readdib.c:319: warning: passing argument 4 of 'MakeBitmapAndPalette' from incompatible pointer type
      d:/Projects/tome2/src/readdib.c:138: note: expected 'struct HBITMAP__ **' but argument is of type 'void **'
      Linking C executable tome.exe
      CMakeFiles/tome.dir/objects.a(modules.c.obj):modules.c:(.text+0x68): undefined reference to `private_check_user_directory'
      collect2: ld returned 1 exit status
      mingw32-make[2]: *** [src/tome.exe] Error 1
      mingw32-make[1]: *** [src/CMakeFiles/tome.dir/all] Error 2
      mingw32-make: *** [all] Error 2
      Also, there's a warning about a Varda spell:

      Code:
      d:/Projects/tome2/src/spells3.c: In function 'varda_light_of_valinor_info':
      d:/Projects/tome2/src/spells3.c:4755: warning: format '%ld' expects type 'long int', but argument 4 has type 'int'

      Comment

      • AnonymousHero
        Veteran
        • Jun 2007
        • 1322

        #18
        This is the "unlua" branch? If so, I'll just say right now that not necessarily in a very usable state at any given time -- I pretty much only do minimal checking before committing (sometimes not even that unless I'm doing something could result in hard-to-find errors). Testing is appreciated, though!

        The error about private_check_user_directory() seems to be since the preprocessor symbol "WINDOWS" is defined -- this means that private_check_user_directory() from main.c doesn't get compiled. This is the case all the way back to 2.3.5.

        But I see that the call to private_check_user_directory() from src/modules.c was surrounded with an '#ifdef PRIVATE_USER_PATH' / #end pair prior to git commit c70d7a8c ...

        Perhaps this was necessary after all for Windows. Can you please try switching to master and doing a "git revert c70d7a8c" to see if that fixes compilation?

        EDIT: Format string warning fixed; I'm not quite ready to push that (I have a few queued up bits that aren't quite finished.)

        Comment

        • Therem Harth
          Knight
          • Jan 2008
          • 856

          #19
          Git refuses to revert c70d7a8c, it looks like that change hasn't been made in master (yet?). I think.

          Anyway attempting to compile master spits out another pile of errors.

          Code:
          d:/Projects/tome2/src/main.c:308: error: expected identifier or '(' before '>>' token
          d:/Projects/tome2/src/main.c:313: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&&' token
          d:/Projects/tome2/src/main.c:313: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
          d:/Projects/tome2/src/main.c:540: error: expected identifier or '(' before 'if'
          d:/Projects/tome2/src/main.c:548: error: expected declaration specifiers or '...' before numeric constant
          d:/Projects/tome2/src/main.c:548: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:548: warning: type defaults to 'int' in declaration of 'process_player_name'
          d:/Projects/tome2/src/main.c:548: error: conflicting types for 'process_player_name'
          d:/Projects/tome2/src/externs.h:890: note: previous declaration of 'process_player_name' was here
          d:/Projects/tome2/src/main.c:552: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:552: warning: type defaults to 'int' in declaration of 'quit_aux'
          d:/Projects/tome2/src/main.c:552: error: conflicting types for 'quit_aux'
          d:/Projects/tome2/src/z-util.h:51: note: previous declaration of 'quit_aux' was here
          d:/Projects/tome2/src/main.c:552: error: 'quit_hook' undeclared here (not in a function)
          d:/Projects/tome2/src/main.c:675: error: expected identifier or '(' before 'if'
          d:/Projects/tome2/src/main.c:679: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:679: warning: type defaults to 'int' in declaration of 'signals_init'
          d:/Projects/tome2/src/main.c:679: error: conflicting types for 'signals_init'
          d:/Projects/tome2/src/externs.h:901: note: previous declaration of 'signals_init' was here
          d:/Projects/tome2/src/main.c:682: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:682: warning: type defaults to 'int' in declaration of 'init_angband'
          d:/Projects/tome2/src/main.c:682: error: conflicting types for 'init_angband'
          d:/Projects/tome2/src/externs.h:972: note: previous declaration of 'init_angband' was here
          d:/Projects/tome2/src/main.c:685: error: expected identifier or '(' before 'if'
          d:/Projects/tome2/src/main.c:688: error: expected declaration specifiers or '...' before numeric constant
          d:/Projects/tome2/src/main.c:688: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:688: warning: type defaults to 'int' in declaration of 'pause_line'
          d:/Projects/tome2/src/main.c:688: error: conflicting types for 'pause_line'
          d:/Projects/tome2/src/externs.h:1491: note: previous declaration of 'pause_line' was here
          d:/Projects/tome2/src/main.c:691: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:691: warning: type defaults to 'int' in declaration of 'play_game'
          d:/Projects/tome2/src/main.c:691: warning: parameter names (without types) in function declaration
          d:/Projects/tome2/src/main.c:691: error: conflicting types for 'play_game'
          d:/Projects/tome2/src/externs.h:871: note: previous declaration of 'play_game' was here
          d:/Projects/tome2/src/main.c:698: error: expected declaration specifiers or '...' before '(' token
          d:/Projects/tome2/src/main.c:698: warning: data definition has no type or storage class
          d:/Projects/tome2/src/main.c:698: warning: type defaults to 'int' in declaration of 'quit'
          d:/Projects/tome2/src/main.c:698: error: conflicting types for 'quit'
          d:/Projects/tome2/src/z-util.h:80: note: previous declaration of 'quit' was here
          d:/Projects/tome2/src/main.c:701: error: expected identifier or '(' before 'return'
          d:/Projects/tome2/src/main.c:702: error: expected identifier or '(' before '}' token
          d:/Projects/tome2/src/main.c:704:2: error: #endif without #if
          make[2]: *** [src/CMakeFiles/tome.dir/main.c.obj] Error 1
          make[2]: *** Waiting for unfinished jobs....
          make[1]: *** [src/CMakeFiles/tome.dir/all] Error 2
          make: *** [all] Error 2
          And sorry about breaking the formatting, the stupid Windows terminal doesn't know where to put line breaks.

          Edit: I should also note that making CMake notice SDL is harder than it looks. In theory all you should have to do is open an MSYS window, untar the SDL package, and run "make native", but in practice CMake can't seem to figure out where it is.

          Comment

          • AnonymousHero
            Veteran
            • Jun 2007
            • 1322

            #20
            The full SHA1 is

            c70d7a8c1fdf97aecc1e2a3a182fa1f3c091520a

            and it definitely is on master. Maybe you need to pull?

            Please try with a fresh clone -- you can clone directly from git@gitorious.org:tome2/tome2.git to your local machine. (I.e. you don't need to make a clone on Gitorious.)

            EDIT: Oh, and the error message is for a completely innocuous line in main.c (as of HEAD in master) -- I think you may have a merge conflict there (which git should have told you about).

            Comment

            • Therem Harth
              Knight
              • Jan 2008
              • 856

              #21
              After spending way too much time on this, I managed to get it compiling by couching the offending line in if 0/endif. Unfortunately the executable now borks because it can't find the normal save directory used on UNIX, which does not and cannot exist on Windows.

              (So far I haven't even come close to getting SDL working on Windows.)

              Comment

              • AnonymousHero
                Veteran
                • Jun 2007
                • 1322

                #22
                Did you do a clean clone + revert that single commit?

                Btw, you could also try the one tagged v2.3.9-ah just to see if you can get it up and running.

                Comment

                • Therem Harth
                  Knight
                  • Jan 2008
                  • 856

                  #23
                  Yes. Umm, looks like that gave an error.

                  Code:
                  error: could not revert c70d7a8... Remove conditional compilation based on PRIVATE_USER_PATH. It is always set.
                  Oddly, trying that again (which I did for who knows what reason) results in a different error:

                  Code:
                  error: 'revert' is not possible because you have unmerged files.
                  I really have no idea what's going on... But anyway, doing a reset to the commit just before c70d7a8 fails to make it compile - I get an error about an undefined reference to private_check_user_directory in modules.c.

                  2.3.9-ah compiles fine on Windows, though.

                  Comment

                  • Therem Harth
                    Knight
                    • Jan 2008
                    • 856

                    #24
                    BTW, I must mention something: the Win32 interface is slow. Slower than Chengband's, slower than SDL, so slow that you can see the screen rerender from top to bottom every time you move into a new wilderness square. Even dragging the window around shows visible lag... With Aero and all compositing effects turned off.

                    Anyway I'm going to try one more time to get SDL working on Windows. No idea why it didn't work the first time...

                    Comment

                    • AnonymousHero
                      Veteran
                      • Jun 2007
                      • 1322

                      #25
                      Originally posted by Therem Harth
                      Yes. Umm, looks like that gave an error.

                      Code:
                      error: could not revert c70d7a8... Remove conditional compilation based on PRIVATE_USER_PATH. It is always set.
                      Oddly, trying that again (which I did for who knows what reason) results in a different error:

                      Code:
                      error: 'revert' is not possible because you have unmerged files.
                      I really have no idea what's going on...
                      The first revert fails (there's probably some later commit which interferes) and leaves various files lying around in the working directory. The second message is saying that you can't attempt a revert while you have such files lying around since it might overwrite some of your hard work.


                      But anyway, doing a reset to the commit just before c70d7a8 fails to make it compile - I get an error about an undefined reference to private_check_user_directory in modules.c.

                      2.3.9-ah compiles fine on Windows, though.
                      Ok, this is good in that we should be able to narrow this down to a specific commit using git "bisect" if you're interested in helping. You'll need to do a few test compiles (roughly 6 compiles) along the way. If you're willing to help please say so and I'll try to give instructions -- git bisect can be a little intimidating to get started for newcomers. Once we your bisect started it should be a doddle .

                      Comment

                      • Therem Harth
                        Knight
                        • Jan 2008
                        • 856

                        #26
                        I'm quite willing to help, but Windows 7 isn't. This OS and its annoying quirks have been fighting me every step of the way... I'll see what can be done though.

                        Comment

                        • AnonymousHero
                          Veteran
                          • Jun 2007
                          • 1322

                          #27
                          Cool. Here are the steps you need to get started:
                          1. Make a fresh clone of the gitorious repo somewhere.
                          2. Change direcory into the clone and make sure it is set up to use the 'master' branch (you can use e.g. "git branch" with no arguments and note the star).
                          3. Type in "git bisect start HEAD v2.3.9-ah"


                          This last line tells git you want to track down a problem in a commit somewhere between v2.3.9-ah and HEAD.

                          From here on you just repeat the following steps until git tells you precisely which commit is the first bad one:
                          1. Delete CMakeCache.txt (if present)
                          2. Run CMake with the arguments you're normally using. If this step fails, type in "git bisect skip" and restart from step 1.
                          3. Compile
                          4. If the compile fails with an error, type in "git bisect bad". If the compile succeeds, type in "git bisect good".


                          Hopefully that should be enough to let you pinpoint the first proplematic commit. At every step in the process git will let you know how many steps it thinks are left, but beware that it may sometimes say "0 steps left" even though you aren't quite done (probably rounding or something). When you're done it will specifically say something like "First bad commit is <SHA hash here>".

                          Comment

                          • Therem Harth
                            Knight
                            • Jan 2008
                            • 856

                            #28
                            BTW, I should mention that tome2 cannot be compiled on Windows inside of a directory with spaces in it. This makes windres bork. I know using spaces in directory names is stupid anyway, but Windows does this by default with e.g. Program Files, My Documents, Documents and Settings...

                            (And annoyingly, I just wasted half an hour trying to compile in a Win2k VM and wondering why all my builds were failing. Grr.)

                            Edit: On Windows 2000 and XP, tome2 has to be compiled in the root directory. I'd say this is a bug.
                            Last edited by Therem Harth; May 25, 2012, 03:09.

                            Comment

                            • AnonymousHero
                              Veteran
                              • Jun 2007
                              • 1322

                              #29
                              Originally posted by Therem Harth
                              BTW, I should mention that tome2 cannot be compiled on Windows inside of a directory with spaces in it. This makes windres bork. I know using spaces in directory names is stupid anyway, but Windows does this by default with e.g. Program Files, My Documents, Documents and Settings...

                              (And annoyingly, I just wasted half an hour trying to compile in a Win2k VM and wondering why all my builds were failing. Grr.)
                              I believe they at least changed "Program Files" to "Programs" in more recent Windows editions.

                              But, yeah, it's annoying. Without error messages it's going to be difficult to do anything about this -- even then it's probably not trivial to fix.

                              I've added a note to the README about this.

                              Originally posted by Therem Harth
                              Edit: On Windows 2000 and XP, tome2 has to be compiled in the root directory. I'd say this is a bug.
                              Really? This is the first I've heard of such a thing. What error messages do you get? (Hopefully nobody's still using Windows 2000, but I guess XP still refuses to die.)

                              You can perhaps work around this by creating a "virtual drive" using
                              Code:
                              subst T: "C:\Wherever You\Unpacked\The\Source"
                              and then compiling on T:

                              Comment

                              • Therem Harth
                                Knight
                                • Jan 2008
                                • 856

                                #30
                                First, something else noteworthy: revision c06c5c1 somehow causes MinGW's linker to hang forever.

                                Originally posted by AnonymousHero
                                Really? This is the first I've heard of such a thing. What error messages do you get? (Hopefully nobody's still using Windows 2000, but I guess XP still refuses to die.)
                                The error, verbatim:

                                Code:
                                gcc: error: and\: No such file or directory
                                gcc: error: Settings/Administrator/My\: No such file or directory
                                gcc: error: Documents/Downloads/tome2-tome2/src: No such file or directory
                                C:\MinGW\bin\windres.exe: preprocessing failed.
                                mingw32-make[2]: *** [src/angband_rc.o] Error 1
                                mingw32-make[1]: *** [src/CMakeFiles/tome.dir/all] Error 2
                                mingw32-make: *** [all] Error 2
                                You can perhaps work around this by creating a "virtual drive" using
                                Code:
                                subst T: "C:\Wherever You\Unpacked\The\Source"
                                and then compiling on T:
                                Thank you, I had no idea such a command existed on Windows.

                                Comment

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