Building on Linux with outdated SDL2 in repos

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
ErSidward
Posts: 3
Joined: March 12th, 2011, 3:37 am

Building on Linux with outdated SDL2 in repos

Post by ErSidward »

If you're trying to build Wesnoth, but SDL2 in your system is out of date (Debian Jessie, for example, only has 2.0.2 whereas freshest Wesnoth code off the repo requires 2.0.4), you need to download and build SDL2 yourself. Once you've finished that particular dance and installed your freshly built SDL2, you also need to export the SDL2DIR environment variable (set to wherever you installed your fresh SDL2 build, /usr/local is the default), clear the CMake cache (if you've tried to build it before), and THEN configure & build Wesnoth; otherwise, it'll still keep trying to use the outdated system library. I just spent an hour or so trying to get it to build, and happened upon the FindSDL2.cmake file which guided me onto the right path quick enough... I thought I might as well write this down somewhere at least for my benefit because there is a good chance I will forget.
User avatar
singalen
iOS Port Maintainer
Posts: 314
Joined: January 3rd, 2007, 10:18 am
Location: bay

Re: Building on Linux with outdated SDL2 in repos

Post by singalen »

Wesnoth has a "compiling" page with system-dependent instructions, this is worth adding to a wiki: https://wiki.wesnoth.org/CompilingWesno ... quirements

On the other hand, this looks like a common knowledge to operate CMake:
* when having multiple versions of the same library on a system, one needs some way to resolve the ambiguity. Environment variables and cmake command-line arguments are the usual way to go. BTW, you could try uninstalling libsd-dev package from your system.
* you are definitely required to wipe all CMake files generated for an outdated dependency.
Post Reply