The International Simutrans Forum

Development => Technical Documentation => Topic started by: Matthew on May 27, 2022, 06:54:33 AM

Title: Compiling Simutrans on recent Debian-based distros may need extra packages
Post by: Matthew on May 27, 2022, 06:54:33 AM
Today I tried to compile Simutrans-Extended on Kubuntu 22.04 Jammy Jellyfish for the first time. It initially failed because the linker couldn't find certain files.

The fix is to install the libdrm-dev, libgbm-dev, and libdecor-0-dev packages.

I think this is a bug with Ubuntu (and actually everything downstream of Debian), not Simutrans, so I have started a discussion in a more appropriate forum (https://askubuntu.com/questions/1410876/is-ubuntus-libsdl2-dev-package-missing-dependencies-or-have-i-made-a-mistake). But if anyone thinks it's a Simutrans issue (or can see that I've just made a newbie error, which is very possible!) then please do speak up.
Title: Re: Compiling Simutrans on recent Debian-based distros may need extra packages
Post by: Roboron on May 27, 2022, 03:32:16 PM
Yes, it looks like bug with Ubuntu's libsdl2-dev package.
Title: Re: Compiling Simutrans on recent Debian-based distros may need extra packages
Post by: Matthew on May 30, 2022, 01:12:29 PM
Quote from: Roboron on May 27, 2022, 03:32:16 PMYes, it looks like bug with Ubuntu's libsdl2-dev package.

Thank you. With this encouragement, I reported it to Ubuntu and Debian and the SDL2 maintainer confirmed that it's a packaging bug that will be corrected.

However, he also asked,

QuoteIs this software linking to SDL statically? As far as I can see from the
pkg-config file, these are going to be required for static linking but not
for the more typical dynamic linking to shared libraries.

This output of readelf -d seems to indicate that it is dynamically linked:
0x0000000000000001 (NEEDED)             Shared library: [libSDL2-2.0.so.0]
The output of ldd --dyn-syms also has many SDL functions.

So I think this evidence proves that my Sim-Ex executable is dynamically linked to SDL2, but I am open to correction.

However, in pondering this, I also noticed that my config.default file (attached) has STATIC = 1. According to the comment, this means "use static linking (to be at least somewhat portable)". I tried compiling with this parameter set to 0 and 1, and I get the same readelf output and file size in both cases.
I also noticed that libpthreads is not dynamically linked even though MULTI_THREAD = 1 and BUNDLE_PTHREADGC2 = 0.

So it seems as though config.default is either ignored or I have made a mistake somewhere.

If it's the first case, then I will open a bug report in the Extended subforum, but if anyone can see or suggest something that I might have done wrong, then I would be grateful.
Title: Re: Compiling Simutrans on recent Debian-based distros may need extra packages
Post by: Roboron on May 30, 2022, 02:46:55 PM
Setting STATIC=1 is in fact ignored on linux. Prissi made some changes to Standard some months ago that "fixed" this, but even then, I was not able to compile on my system. Static linking is strongly discouraged on linux, so you are better forgetting about it.

More information on the relevant thread: https://forum.simutrans.com/index.php/topic,21324.msg198980.html