Looking for help to install new SDL2 version on Ubuntu

I’m currently developping SDL2 application on Ubuntu 18.04.
This distribution provides SDL2 2.0.8 and I’d like to upgrade it to 2.0.10.

I tried to build SDL2 from sources in the past. I think I successfully got it but I ran in a nightmare at the time to make install it because it’s in fact not as simple as it appears because of default libraries path that the system is looking for when it launches an application.
Something related to ldconfig AFAIR.
I’m really not really aware about such kind of things so I’d be very pleased to find someone that could explain me how to install it and getting it working to build and execute a SDL2 based application.

Do I have to remove existing SDL2 2.0.8 package?
Do I have to change the default /usr/local target path in configure?
What to tell to ldconfig?

Or more simple, can I find a Ubuntu SDL 2.0.10 package I could install on Ubuntu 18.04??

Kind regards,

You can modify things such as the LD_LIBRARY_PATH env variable to make it search in different places for sdl first, there even is a variable to override that activly for any sdl application ( the SDL_DYNAMIC_API variable, just set it to a newer libsdl2.0.something.so).
During compilation of your own program, you just need to make sure that your compiler is pointed at the new headers and library.

If you just wanna build and update your systems global sdl2, it is probably better if you remove the SDL 2.0.8 package from your distro first.
You can also let make install overwrite things, but do that at your own risk. apt might complain during later updates! Note that if you have stuff installed that depends on sdl2, that might be your only option.

Anyway, for the install prefix:
If you are using ./configure, you can simply do something like

./configure --prefix=/some/other/place

to change the install prefix.
I think, but don’t yell at me if im wrong, on ubuntu you would do

./configure --prefix=/usr/

You can also do ./configure --help to let the script tell you all its options!

If you use cmake, the syntax is
cmake -DCMAKE_INSTALL_PREFIX=/some/place path/to/SDL/

Have a nice Week!

Admittedly this was some time ago, but I’ve successfully built and installed SDL2 on my machine in the past using the expected sequence:

./configure --prefix=/usr/local
sudo make install

This mostly works fine. However, if you haven’t removed the existing SDL 2.0.8, you have to explicitly call /usr/local/bin/sdl2-config instead of just sdl2-config in your makefiles. I would probably just uninstall 2.0.8 to avoid that issue – it’s cheap to install it back again later if your situation changes.

Ok thanks to all of you.
I’m going to try it.