How to deploy a SFML game server to a Linux Server?-Collection of common programming errors
Linux systems search for shared libraries by utilizing the LD_LIBRARY_PATH
environment variable and they don’t automatically look for binary files next to the application, as it is the case on Windows. An very often used method of deploying with shared libraries, is to include them in an sub-directory or similar and instead of launching the application directly run a shell script that would add the directory with the libraries temporarily to ?LD_LIBRARY_PTH` and then start the application.
The other issue you’re having is related to dependencies.
For shared libraries you’d not only have to provide the shared SFML libraries, but also provide the shared libraries of the dependencies, unless you can 100% guarantee that the target system will have the equal library version.
If you just build static libraries of SFML, they’ll still point to shared runtime libraries and alike, thus if you don’t provide the matching version with the application, it will simply fail to start, since it can’t find the library. If you link statically against the runtime libraries you wouldn’t need to provide shared libraries for your application, but since the SFML libraries were still link dynamically against the runtime libraries, they request the shared libraries anyways.
So if you don’t want to any shared library files any more, you’ll need to link SFML statically against the runtime library (uncheck BUILD_SHARED_LIBS
and check SFML_USE_STATIC_STD_LIBS
).
Keep in mind that when linking statically, you’ll need to link statically against all dependencies – -static
might be useful.