3.5-nightly-compile/link error. (Linux)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Spacebux
    Adept
    • Apr 2009
    • 231

    3.5-nightly-compile/link error. (Linux)

    Anyone able to point me and my compiler in the correct direction?

    [mark@mb1 angband-b1011f7cb2d409b7581ab6ad7fede9bfeb70ff77]$ make
    Entering directory src.
    cat: ../version: No such file or directory
    cat: ../version: No such file or directory

    Entering directory monster.
    Leaving directory monster.
    Entering directory object.
    Leaving directory object.
    Entering directory player.
    Leaving directory player.
    cat: ../version: No such file or directory
    cat: ../version: No such file or directory

    main.c:43: warning: ISO C forbids empty initializer braces
    main.c:42: error: zero or negative size array ‘modules’

    Failed to compile main.c!
    make[3]: *** [main.o] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [subdirs] Error 2
    make: *** [all] Error 2

    I'm not an expert at linker stuff. Where / how do I go about diagnosing this, please?

    Linux mb1 2.6.32-358.el6.i686 #1 SMP Thu Feb 21 21:50:49 UTC 2013 i686 i686 i386 GNU/Linux

    Thanks.
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    #2
    Sounds like someone has broken the automated version-generation script. This is pretty arcane, and well beyond me. I will see if noz is around to take a look. If I'm right then master should be broken for everyone on Linux? (I'm not sure if the script is used in the Windows builds.)

    But in fact b1101f7 built correctly under the autobuilders, so it looks like it's just you. Do you have git installed? If you just d/l'd the source that might be the problem. I think ./version is generated by a call to git. Odd that you don't get an error message about that though.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • Derakon
      Prophet
      • Dec 2009
      • 9022

      #3
      My best guess is that you used the wrong makefile. The file the error occurred in defines a "modules" list that depends on which of certain constants has been defined; the compiler is complaining that the list is empty (i.e. none of the constants exists). Try doing e.g. "make -f Makefile.std".

      Comment

      • Spacebux
        Adept
        • Apr 2009
        • 231

        #4
        makefile

        Thank you Magnate, Derekon for responding so quickly.

        I have no Makefile.std file, however.

        Yes, Magnate, I just d/l'd the source. I'll re-try with git this time.

        Are there any options I should know about when using git?

        Comment

        • Spacebux
          Adept
          • Apr 2009
          • 231

          #5
          ok - I don't even know how to use git.


          git clone git://github.com/angband/angband.git /tmp/angband/angband-dev

          that got me something, not sure which version it is, but the 3.4 code I had earlier compiled without issue... so, I think this is the latest 3.5-dev branch.
          Last edited by Spacebux; June 27, 2013, 22:01.

          Comment

          • Spacebux
            Adept
            • Apr 2009
            • 231

            #6
            ok, I got something.. not sure which version it is yet..


            ...

            and, it failed with nearly the same error.

            [root@mb1 angband-dev]# make
            Entering directory src.
            Entering directory monster.
            Leaving directory monster.
            Entering directory object.
            Leaving directory object.
            Entering directory player.
            Leaving directory player.
            main.c:43: warning: ISO C forbids empty initializer braces
            main.c:42: error: zero or negative size array ‘modules’
            Failed to compile main.c!
            make[3]: *** [main.o] Error 1
            make[2]: *** [all] Error 2
            make[1]: *** [subdirs] Error 2
            make: *** [all] Error 2
            [root@mb1 angband-dev]#

            the error seems to have been in the LINK angband.o statement.

            Comment

            • Derakon
              Prophet
              • Dec 2009
              • 9022

              #7
              Where did you download the source from? This page is the official source; I wouldn't be surprised if there are other, less-official places you could get older versions from. Install Git, then do "git clone https://github.com/angband/angband.git", and you should get a proper copy.

              Comment

              • Spacebux
                Adept
                • Apr 2009
                • 231

                #8
                Originally posted by Derakon
                Where did you download the source from? This page is the official source; I wouldn't be surprised if there are other, less-official places you could get older versions from. Install Git, then do "git clone https://github.com/angband/angband.git", and you should get a proper copy.
                Yeah, sorry, I edited my earlier post - that's the command I used, except I specified a target location.

                Comment

                • Spacebux
                  Adept
                  • Apr 2009
                  • 231

                  #9
                  [root@mb1 angband-dev]# gcc --version
                  gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

                  [root@mb1 angband-dev]# make --version
                  GNU Make 3.81

                  This program built for i386-redhat-linux-gnu

                  [root@mb1 angband-dev]# ln --version
                  ln (GNU coreutils) 8.4

                  Comment

                  • Derakon
                    Prophet
                    • Dec 2009
                    • 9022

                    #10
                    Originally posted by Spacebux
                    Yeah, sorry, I edited my earlier post - that's the command I used, except I specified a target location.
                    Right, that should get you the latest 3.5 development version, as you say.

                    The compiler output you pasted earlier indicates a problem with compiling main.c, not a problem with the linker. Hence why I suggested making certain that you were using the correct Makefile; it seemed like whatever you were using was failing to define at least one important constant. I don't know if Makefile.std is necessarily the one to use, but the comments at the top indicate it's the right one for Linux. You'd use Makefile.osx for Macs, of course, and Makefile.win for Windows (dunno if that's cygwin/mingw or Visual Studio or what).

                    Comment

                    • Spacebux
                      Adept
                      • Apr 2009
                      • 231

                      #11
                      Originally posted by Derakon
                      I suggested making certain that you were using the correct Makefile; it seemed like whatever you were using was failing to define at least one important constant. I don't know if Makefile.std is necessarily the one to use, but the comments at the top indicate it's the right one for Linux. You'd use Makefile.osx for Macs, of course, and Makefile.win for Windows (dunno if that's cygwin/mingw or Visual Studio or what).
                      I gave Makefile.std a whirl - crash & burn... worse than the first one.


                      Guess I have to keep playing on Windoze for the meantime...

                      Comment

                      • Spacebux
                        Adept
                        • Apr 2009
                        • 231

                        #12
                        Success.

                        ok, to resolve, I simply added in a number to the empty array in main.c.


                        Old main.c:42: static const struct module modules[] =


                        New main.c:42: static const struct module modules[8] =


                        I still have the warning about line 43, ISO C forbids empty initializer braces
                        but, compiled all the way through. Yay.

                        Comment

                        • Spacebux
                          Adept
                          • Apr 2009
                          • 231

                          #13
                          ... almost.

                          ... and, then, make install tripped up in the documentation phase. (I guess I'm the only one still grappling with Linux thesedays.)

                          make install ...
                          .
                          .
                          .
                          Entering directory doc.
                          /bin/sh: rst2html: command not found
                          Failed to compile ../lib/help/index.txt!

                          --- Installed python-docutils package ---

                          Much better. Might want to have "Need python-docutils package installed" listed somewhere in the compile.txt file.

                          Comment

                          • Spacebux
                            Adept
                            • Apr 2009
                            • 231

                            #14
                            Woohoo!

                            Seg fault.

                            Maybe the ISO C warning is more than just a warning....

                            Comment

                            • Derakon
                              Prophet
                              • Dec 2009
                              • 9022

                              #15
                              Yeah, I think that patching that modules list by just inserting a dummy variable wasn't the right idea. Sure it makes the compile error go away, but it doesn't fix the underlying problem that that error was telling you about. You really need to have at least one of USE_X11, USE_SDL, or USE_GCU defined or else the game won't know how to run.

                              Comment

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