That is, in my PC the game runs because the libraries are installed, but I don’t want the user needs to install additional libraries to run the game, I want the libraries goes together with the game. How can I do it?
I was reading about static libraries but, until then, I think I was using it on that command I wrote. It would be like a .dll arquives on Windows. Would this be the solution?
There are several solutions. Some that come to my mind:
Package your game in proper packages, i.e. rpm and deb respectively.
In that package you can list your games dependencies and the package
manager will install them when needed and uninstall them when no longer
needed. This has the advantage that you will be using the OS version of
the package with the most recent security updates. It has the
disadvantage that you are not guaranteed a specific version which can
be a problem with libraries that like to introduce incompatible
changes. But SDL should be fine in that regard.
Install a copy of the library in question together with your game
and start your game via a shell script that uses LD_LIBRARY_PATH. To
see what that looks like, check out the official Ubuntu packages of
Google Chrome (https://www.google.com/chrome/). The starter script
is /opt/google/chrome/google-chrome. BTW, “/opt/something” is also the
place where your installer should install your game if it is not
properly packaged according to 1.
static libraries
static linking can be a bit hairy and is rarely a good choice, so I’m
not describing how to do it here. The other 2 options are simply
superior in all but the most exceptional cases.