Hello,
I wrote a Lutris installer to install Diablo Gog version with DevilutionX 64 bits. I tried to make the build the more static possible:
DevilutionX https://github.com/diasurgical/devilutionX
git commit c52464d
compiled on Ubuntu 19.04 15 september 2019
compile options:
ASAN ON
BINARY_RELEASE ON
CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /usr/local
DEBUG ON
DIST OFF
FASTER ON
NIGHTLY_BUILD OFF
SDL2_DIR /usr/lib/x86_64-linux-gnu/cmake/SDL2
pkgcfg_lib_SDL2PC_SDL2 /usr/lib/x86_64-linux-gnu/libSDL2.so
pkgcfg_lib_SDL2_mixerPC_SDL2 /usr/lib/x86_64-linux-gnu/libSDL2.so
pkgcfg_lib_SDL2_mixerPC_SDL2_m /usr/lib/x86_64-linux-gnu/libSDL2_mixer.so
pkgcfg_lib_SDL2_ttfPC_SDL2 /usr/lib/x86_64-linux-gnu/libSDL2.so
pkgcfg_lib_SDL2_ttfPC_SDL2_ttf /usr/lib/x86_64-linux-gnu/libSDL2_ttf.so
pkgcfg_lib_sodium_PKG_sodium /usr/lib/x86_64-linux-gnu/libsodium.so
sodium_USE_STATIC_LIBS ON
dependencies:
$ objdump -p devilutionx | grep NEEDED
NEEDED libSDL2_ttf-2.0.so.0
NEEDED libSDL2_mixer-2.0.so.0
NEEDED libSDL2-2.0.so.0
NEEDED libm.so.6
NEEDED libpthread.so.0
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2
But finally, a user can not launch my build on Ubuntu 18.04, he obtained this error message:
./devilutionx: /lib/x86_64-linux-gnu/libm.so.6: versionGLIBC_2.29' not found (required by ./devilutionx)`
Is there a way to compile a DevilutionX build more portable between Ubuntu 18.04 (glibc 2.27) and Ubuntu 19.04 (glibc 2.29)?
Thank you for your help.
the thread on GOL: https://www.gamingonlinux.com/forum/topic/3806/page=5
DIST should be ON for a release build since you intend to distribute it, it is intended for dealing with exactly the problem you are having.
ASAN should be OFF, it's huge, for debugging errors in memory access, and it can stop the game from running if it finds and error.
DEBUG should be OFF, it's for debugging.
FASTER should be OFF, is for skipping parts of the animation to make it faster to debug other things.
It looks to me like you are compiling on a system with a very recent version of libc. There is no way to statically link libc. Instead you should try to target a conservative version that doesn't have features not available in distros that are still supported. When I build releases I use Debian 9 as it has a good combination of packages for this purpose.
Finally please takes support questions like this on the chat as it's not really an issue with the code, but more of a question/how-to. Maybe it would be relevant to request that parts of the documentation should be improved, if possible it would be helpful if you can make a PR to do this as you figure out how the parts work.
I will follow your advices, thank you!
No worries, feel free to contact me directly if you have more questions like this.
@legluondunet In cases like this, where you are looking for as wide an audience as possible, it might be a good idea to build the executable on CentOS 6. That version has rather old libraries but is still a supported release. If you don't want to go back just that far, CentOS 7 might also be a good candidate. When it comes to glibc, any executable built against it on CentOS 6 should run on just about any Ubuntu that people still run.
And if you really mean it, you could try to use a different libc. There's e.g. musl which is a very POSIXy implementation of a standard C library aiming to be extremely small. It's also meant to allow static linking. The downside of it is that lots of code out there just takes all the features (and quirks) of GNU libc for granted and thus might not compile with a libc that is strictly adherent to POSIX. Has anybody tried to run DevilutionX on Alpine Linux or the like? If it works there, then it works with musl and that might be just what you're actually after - a statically linked version of the game.
Thank you @kraileth for this precious and complementaries infos, I stored them in case my actual build is not enough "portable" for gamers that use my Lutris installer.