OpenSUSE Tumbleweed compling issues with SDL2 TTF

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ViViVi
    Rookie
    • Apr 2024
    • 2

    OpenSUSE Tumbleweed compling issues with SDL2 TTF

    Hi, I'm trying to get Angband to compile with the SDL2 front end on OpenSuse Tumbleweed Linux distro, following the cmake compling instructions for Angband. The specific error comes from SDL_ttf, which I've compiled and installed version 2.22.x from source. Angband runs under terminal and x11 modes without issues. At this point I'm at a loss on how to get it working and I am new to Linux and compling in general.

    The error during compiling as as follows:
    Code:
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_RWread@SUSE_2.0.10'
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_RWtell@SUSE_2.0.10'
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_CreateRGBSurfaceWithFormatFrom@SUSE_2.0.5'
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_RWsize@SUSE_2.0.10'
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_RWclose@SUSE_2.0.10'
    /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libSDL2_ttf.so: undefined reference to `SDL_RWseek@SUSE_2.0.10'
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/OurExecutable.dir/build.make:587: Angband] Error 1
    make[1]: *** [CMakeFiles/Makefile2:280: CMakeFiles/OurExecutable.dir/all] Error 2
    make: *** [Makefile:136: all] Error 2[/FONT]
    Thanks for the help in advance.
  • backwardsEric
    Knight
    • Aug 2019
    • 527

    #2
    There is a problem with Angband's src/cmake/macros/SDL2_Frontend.cmake that may cause what you see. To see if that is the cause, I would recommend changing that file (a corrected version is at https://github.com/backwardsEric/ang...Frontend.cmake ; or you could use a text editor to change line 15 in that file from

    Code:
    TARGET_LINK_OPTIONS(${_NAME_TARGET} PRIVATE ${SDL2_LDFLAGS} ${SDL2_TTF_CFLAGS} ${SDL2_IMAGE_CFLAGS})
    to

    Code:
    TARGET_LINK_OPTIONS(${_NAME_TARGET} PRIVATE ${SDL2_LDFLAGS} ${SDL2_TTF_LDFLAGS} ${SDL2_IMAGE_LDFLAGS})
    ), removing the directory where you were building Angband with CMake, and then restarting the steps for building with CMake (from the top-level of the Angband distribution, "mkdir build && cd build; cmake -DSUPPORT_SDL2_FRONTEND=ON ..; make).

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9638

      #3
      That change is in the latest code at https://github.com/angband/angband/releases now.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • ViViVi
        Rookie
        • Apr 2024
        • 2

        #4
        Unfortunately it didn't work. I pulled the latest version from git, checked that the file was indeed changed and followed the cmake compiling instructions again. Only to have the same error occur when linking. The native also does not work though the configure command does not give an error beyond missing libraries.

        I did get a c script working to check if SDL2_ttf is working by calling TTF_Init() function and it works. the include for it had to be
        Code:
        #include <SDL2/SDL_ttf.h>
        and when compiling with gcc I had to add
        Code:
        -lSDL2_ttf
        Last edited by ViViVi; April 17, 2024, 02:04.

        Comment

        • backwardsEric
          Knight
          • Aug 2019
          • 527

          #5
          You said you built SDL2_ttf from source. Is /usr/local/lib64/libSDL2_ttf.so the library built from source or is that from a prepackaged version of SDL2_ttf installed on the system? Are you using prepackaged versions of the base SDL2 library and SDL2_image or have those been compiled from source as well? The missing symbols in your original post should be satisfied by the base SDL2 library. Since they're not being found, the linker flags used by CMake are either not pulling in the base SDL2 library or are pulling one in that is not compatible with /usr/local/lib64/libSDL2_ttf.so.

          With CMake, Angband uses the results reported by pkg-config (via CMake's FindPkgConfig() and pkg_search_module()) for how to compile with and link to the SDL2 libraries. With configure, Angband uses the results reported by sdl2-config. Running

          Code:
          pkg-config --libs SDL2_ttf
          would show you what linker flags that pkg-config says are necessary to link with SDL2_ttf (replace SDL2_ttf with sdl2 to get the linker flags for the base SDL2 library). The flags that CMake got will be remembered in CMakeCache.txt in the build directory.

          Comment

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