Build Efforts

Help
Matt Brock
2007-02-23
2013-06-04
  • Matt Brock
    Matt Brock
    2007-02-23

    Hi,

    I ended up having to do a lot funny steps to get Kyra built.  I figured I would document them just in case they would help anybody.  Not all of the problems are related to Kyra.

    Build Environment:
    SUSE 10.1 x86
    GCC 4.1.1
    Autoconf 2.59
    Automake 1.9.6
    SDL_image-1.2.5
    SDL-1.2.11

    1) There was no configure file, so I ran

    aclocal -I .
    autoconf
    libtoolize --force
    automake -a

    I wasn't sure if I was having problems with autogen or not, but I quit using it after a few failed build attempts.

    2) After running "./configure", I get the build errors from "make"

    encoder.h:151: error: extra qualification 'KrEncoder::' on member 'Save'
    imagetree.h:193: error: extra qualification 'KrImageTree::' on member 'HitTestRec'
    progress.h:51: error: extra qualification 'KrProgress::' on member 'KrProgress'
    progress.h:58: error: extra qualification 'KrProgress::' on member 'KrProgress'

    The solution?: Remove the extra qualifiers from the member declarations.

    3) Another build error encountered was

    namefield.h:94: error: expected `)' before '*' token
    namefield.h:117: error: ISO C++ forbids declaration of 'SDL_RWops' with no type
    namefield.h:117: error: expected ';' before '*' token
    namefield.cpp: In member function 'void KrCachedWrite::Write(const std::string&)':
    namefield.cpp:169: error: 'stream' was not declared in this scope
    namefield.cpp:169: error: 'SDL_RWtell' was not declared in this scope
    namefield.cpp:174: error: 'SDL_WriteLE32' was not declared in this scope
    namefield.cpp: In member function 'void KrCachedWrite::Flush()':
    namefield.cpp:196: error: 'stream' was not declared in this scope
    namefield.cpp:196: error: 'SDL_RWseek' was not declared in this scope
    namefield.cpp:197: error: 'SDL_WriteLE32' was not declared in this scope

    Some of the SDL data structures weren't getting included into the build, so I added the line:

    #include "SDL.h"

    into the set of include statements at the beginning of the file.

    4) For some reason, the SDL_image RPM wasn't properly installing "libSDL_image.so", so I had to build it from source.

    5) Another build error occured relating to tinyxml:

    make[1]: Entering directory `/home/matt/Documents/Downloads/test/kyra/tinyxml'
    make[1]: *** No rule to make target `tinyxml.cpp', needed by `tinyxml.lo'.  Stop.

    There weren't any source files in the tinyxml directory inside the kyra directory.  So I downloaded the tinyxml package seperately, and copied all of the files (except for the Makefile) into the tinyxml directory.  There is another tinyxml directory on the same level as the "kyra" and "grinliz" directories.  I replaced it by unpacking the tinyxml tarball over it.

    6) Another build error:

    ../engine/.libs/libengine.so: undefined reference to `grinliz::GL_LoadLibrary(char const*)'
    ../engine/.libs/libengine.so: undefined reference to `grinliz::GL_LoadFunction(void*, char const*)'

    Both of these functions are defined in grinliz/gldynamic.cpp.  In kyra/engine/Makefile.am, add "../../grinliz/gldynamic.cpp" to "libengine_la_SOURCES".

    Then from the "kyra" directory, run:

    automake -a
    ./configure

    This will add the gldynamic.cpp file to the list of sources for the engine library.

    7) The include files installed to /usr/local/include/Kyra reference header files from the grinliz and tinyxml libraries:

    #include "../../grinliz/gldebug.h"
    #include "../../grinliz/gltypes.h"
    ...
    #include "../../tinyxml/tinyxml.h"

    So I created two directories /usr/local/include/grinliz and /usr/local/include/tinyxml and placed the header files from each of these packages into those directories.

    I'm not sure how much I was doing wrong in the install, I sometimes skip over the instructions, but hopefully this will save someone the two or three hours.  The demo runs great!  I'm going to attempt a small MMORPG using Kyra for the client (I just need to give it a shot so I can fail and the idea will never pop up in my head again).  I'll definitely be giving Kyra some props if things go well.

    Matt

     
    • Thanks for posting all of those steps in one place, Matt!  We have had a few posts recently about individual issues, and you seem to have run into all of them at once. B-)

      As for the autotools, it seems that later builds of Kyra broke them.  That is, your problems with using autogen and automake and such didn't work because so many changes were made that they no longer were expected to work. 

      Am I to understand that you actually got them to work after you made the changes you made?  That is, did you manage to build Kyra into a dynamic library?  Since the autotools build was broken, only static linking as been possible, which isn't great for people who don't want to license their game code under an LGPL-compatible license. 

      I tried to read up on what is needed for the autotools to work, but I was spending more time fighting with it than getting a game finished so I stopped.  I was comparing the difference between Kyra 2.0.7 and Kyra 2.1.3.  The former worked with autobuild while the latter did not. I found the differences that you mentioned, such as tinyxml being in a different directory and such.  I guess I just tried to change the autotool files to match the directory structure rather than change the directory structure to match the autotool files.

      Good luck with your MMO. Where are you going to get the servers?

       
    • Matt Brock
      Matt Brock
      2007-02-27

      Hey Gianfranco,

      Ah, so there were problems with autogen.  The command sequence of:

      aclocal -I .
      autoconf
      libtoolize --force
      automake -a

      Seemed to do the trick.

      And yes, everything worked after the above described issues were taken care of.  The tests built using libkyra.so.  Glad to help!  I'll keep posting issues as they come up.  Let me know if you still can't get things working.  I have my own version of Kyra that I zipped up and put in my gmail account.  If you want me to send it to you let me know.

      As for MMO servers, I figured I'd just host off of my cable connection until I see some popularity starting to generate (I.e. my cable connection can't handle the users).  Right now I'm researching some simple load balancing techniques (I'm planning for expansion whether it happens or not :)) and looking into some formal verification methods for client/server interactions.  So I have a ways to go.  I have a high-level model worked out and all the technology I'll be using planned (Kyra for graphics, RakNet for network, MySQL DBMS for distributed database, and Python for various scripting).  I'm becoming a little less naive as I go along with respect to accomplishing a MMO all on my own, but I figure if I get a simple setup going, then some people will want to help.  For now I'm just in the design phase--don't plan on doing anything in stone for at least a few more months!

       
    • I just tried to get a shared library out of Kyra, followed your steps, and got it to compile.

      The hard part was getting my binary to use it correctly. I ended up copying the files in kyra/kyra/.lib/ and kyra/kyra/engine/.lib into a bin directory along with my binary, and then I create a script that simply sets an environment variable to let the system know to look in the bin directory before cd-ing into that directory and running the binary.

      I'm not sure if it is the best way, but at least I know I just need that bin directory and my resources directory to run my game.

      My project is called Killer Kittens from Katis Minor, and this is the script I use (modified from someone else's game I had on my hard drive):

      ***************************
      #!/bin/sh

      KKFKM_HOME="."

      if test "x$LD_LIBRARY_PATH" = "x"; then
              LD_LIBRARY_PATH="../lib"
      else
              LD_LIBRARY_PATH="../lib:$LD_LIBRARY_PATH"
      fi

      export LD_LIBRARY_PATH
      echo ${LD_LIBRARY_PATH}

      CURRENT_DIR=`pwd`
      cd bin
      "./killerkittens.bin"
      cd $CURRENT_DIR
      ***************************

      I plan to also compile custom versions of libsdl, libsdl-image, and libsdl-mixer and throw the results in my bin directory as well. I want to be able to throw a tar file at someone and have them playing as soon as they extract the files.

       
    • Actually, I've run into a problem.

      As I said above, I am trying to create custom versions of my libraries. I have custom versions of libsdl and libsdl-image, and when I try  to build kyra, it creates two libraries.  One is libkyra.so, the other is libengine.so. 

      If I run objdump -x libkyra.so| grep NEEDED, I get:

        NEEDED      libpng12.so.0
        NEEDED      libz.so.1
        NEEDED      libengine.so.0
        NEEDED      libSDL-1.2.so.0
        NEEDED      libpthread.so.0
        NEEDED      libSDL_image-1.2.so.0
        NEEDED      libgcc_s.so.1
        NEEDED      libc.so.6

      If I run ldd libkyra.so, I learn that it is looking for libpng12.so, libengine.so, libSDL-1.2.so, and libSDL_image-1.2.so all in my custom lib directory.

      However, if I do the same with libengine.so, I get:
      NEEDED      libSDL-1.2.so.0
        NEEDED      libpthread.so.0
        NEEDED      libSDL_image-1.2.so.0
        NEEDED      libstdc++.so.6
        NEEDED      libm.so.6
        NEEDED      libc.so.6
        NEEDED      libgcc_s.so.1

      ldd libengine.so does not show any of the custom lib paths.  I am not familiar enough with autotools, but I imagine it is a problem with how it is initially setup. Any ideas?

       
    • Oh, I should mention that ldd libengine.so does also show other dependencies:

      $ ldd libengine.so
              linux-gate.so.1 =>  (0xffffe000)
              libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7e79000)
              libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7e67000)
              libSDL_image-1.2.so.0 => /usr/lib/libSDL_image-1.2.so.0 (0xb7e4c000)
              libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7d67000)
              libm.so.6 => /lib/tls/libm.so.6 (0xb7d41000)
              libc.so.6 => /lib/tls/libc.so.6 (0xb7c0f000)
              libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7c04000)
              libasound.so.2 => /usr/lib/libasound.so.2 (0xb7b43000)
              libdl.so.2 => /lib/tls/libdl.so.2 (0xb7b3f000)
              libdirectfb-0.9.so.25 => /usr/lib/libdirectfb-0.9.so.25 (0xb7ae8000)
              libfusion-0.9.so.25 => /usr/lib/libfusion-0.9.so.25 (0xb7ae1000)
              libdirect-0.9.so.25 => /usr/lib/libdirect-0.9.so.25 (0xb7ad2000)
              libvga.so.1 => /usr/lib/libvga.so.1 (0xb7a72000)
              /lib/ld-linux.so.2 (0x80000000)
              libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7a4f000)
              libz.so.1 => /usr/lib/libz.so.1 (0xb7a3b000)

      As you can see, libdirectfb is also listed, which probably wouldn't be if it was using my custom SDL libraries.

       
    • I've encountered some problems trying to build Kyra as before once I upgraded autotools. Here are the fixes (using aclocal v1.10):
      In kyra/kyra.m4, you need to change the following line from:

      AC_DEFUN(AM_PATH_KYRA,
      to
      AC_DEFUN([AM_PATH_KYRA],

      I found a similar problem with /usr/share/aclocal/smpeg.m4

      Once you make these changes, it should work without a hitch.

       
    • Good to have the steps listed here, I know I had problems too when I built the last time. But is this project maintained, I mean will fixes to the build procedure be commited to CVS ?

       
    • By the way I got an error not mentioned here (between step 5 and 6):

      make[1]: *** Ingen regel för att skapa målet "../tinyxml/libtinyxml.la", som behövs till "krencoder".  Stannar.
      make[1]: Leaving directory `/home/danielb/download/kyra/encoder'
      make: *** [all-recursive] Fel 1

      (Sorry, it's in swedish but it's the standard 'No rule to create target' error.)

      I just ran 'libtool --mode=link gcc -g -O -o libtinyxml.la *.o' manually in the tinyxml directory to get pass that.

       
    • If you would like a version of Kyra that actually builds properly, please download:

      http://gbgames.com/downloads/libraries/kyra2_1_3.tar.gz

      You can even run configure && make && make install with this version. While it has some flaws in its build script, it should work well for most purposes.

       
    • Nice, I tried this file and it worked fine. ( Well using --prefix to configure did not work during make install. )

      Could this file replace the official release so you do not have to look here in the forums for it ?

       
  • Wesley Johnson
    Wesley Johnson
    2010-05-17

    5/17/2010  compiling  kyra_2_1_3, still getting the same errors your mentioned.
    Errors that I had to fix on kyra_2_1_3:
    Compile on Linux 2.4.31, with GCC 3.3.6, SDL 1.2.

    The unzip of the zip file into "/usr/local/src/kyra", and it created the sub-directories
    tinyxml =>  "/usr/local/src/kyra/tinyxml"
    grinliz =>  "/usr/local/src/kyra/grinliz"
    kyra    =>  "/usr/local/src/kyra/kyra"

    1>
    There are no instructions on why there are three independent
    directories in kyra.

    The tinyxml directory has its own makefile.
    The grinliz directory has no instructions and no makefile.
    The program seems to be in the kyra sub-directory.

    2>
    INSTALL Instructions say to run ./configure
    Configure file is missing.
    Ran autogen a couple of times and it finally will generate configure.

    3>
    Libtool keeps complaining that the libSDL.la has been moved.
    It is in /usr/lib with the rest of the libSDL-1.2 libs.

    Traced to bad install of SDL.  The file /usr/lib/libSDL.la indicated
    that it was installed in /usr/local/lib.
    The error message was not very clear about what it was detecting.
    The message could say "according to libSDL.la the library has been moved".
    I only discovered this by grep of everything to find some clue as to
    where the /usr/local idea was coming from.

    4>
    Fatal error in namefield.cpp, cannot resolve  SDL_RWops
    added to engine/namefield.h
      #include "SDL_rwops.h"

    5>
    Fatal error, no rule to make required file tinyxml.cpp.
    The tinyxml directory was unzipped to a separate directory, tinyxml.
    Copied the contents of tinyxml directory to kyra/tinyxml where it
    apparantly belongs (thus overwriting the makefile made by configure).
    Ran ./configure again, and ran make again, which appears to work.

    6>
    Fatal error, grinliz libraries are missing.
    The grinliz directory is there, but there is no makefile to create the
    library.
    << From Kyra BUG listing
    Because it's missing

    ../../grinliz/gldynamic.cpp

    at the end of engine/Makefile.am

    After that you need to run autogen or autoreconf again so Makefile.in gets
    generated.
    >>

    I will copy your posts, and some info, from other bug reports.   Thank you for your posts.
    We can hope the someone from the Kyra team wakes up one of these years and fixes some of this.