Libraries for running old Loki games.

Alan Swanson
7 Feb 2012
Release 1.5

THE PROBLEM

Unknown changes in glibc 2.3 (and newer) cause problems for these old games resulting in a segmentation fault when trying to run them, the suspects are threading and C++ ABI incompatibility. Using the static binaries can be problematic as the libraries compiled into them are old and have bugs such as SDL using a low screen refresh rate with XFree 4.3 or newer.

Workarounds such as using LD_ASSUME_KERNEL and/or pre-loading a smpeg library compiled with an old GCC version only sometimes work and the movies may be blank or have to be disabled. In the future for glibc 2.4, LinuxThreads and the LD_ASSUME_KERNEL workaround are going away.

THE SOLUTION

The solution is to use an old version of glibc such as 2.2.5. However all the other libraries linked by the game must also be compiled against an equally old (or older) version of glibc.

The libraries used by the Loki games have been compiled and provided by me for others to run their old games too. Other than glibc 2.2.5 which was the last (security) release from Debian, all the libraries included in the tar are based on the Gentoo ebuilds available at the time. Further details on library versions at bottom.

loki_compat_libs-1.5.tar.bz2 7 February 2012 2.7Mb

To use the old glibc libraries set the LD_LIBRARY_PATH environment variable to the directory these libraries are located. Additionally prepend the game binary to run the game with the old ld-linux.so.2 dynamic linker/loader (as the one with glibc 2.3 does not include the GLIBC_2.2, GLIBC_2.2.1 or GLIBC_2.2.3 profiles used with glibc 2.2.5 for some reason).

THE GAMES

Assuming the games are patched to the latest available patches (and there are never going to be newer patches) then to run them use the following instructions. The dynamic binaries are used where available.

CIVILSATION: CALL TO POWER

Requires an old glibc so to run use the following command;

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/CivCTP/civctp.dynamic

DESCENT 3

Compatible with new glibc using smpeg library created with old compiler but needs an uppercased symbolic link for one file to be created;

$ cd /path/Descent3
$ ln -s ppics.hog PPics.Hog

Then to run use the following command;

$ LD_PRELOAD=/path/Loki_Compat/libstdc++-3-libc6.2-2-2.10.0.so:/path/Loki_Compat/libsmpeg-0.4.so.0.1.3 /path/Descent3/descent3.dynamic

HEAVY METAL: FAKK2

Compatible with newer glibc but requires old zlib version. It is also recommended to use the pak4.pk3 file provided by Chunky Kibbles to fix a crashing problem during the game.

$ cp pak4.pk3 /path/FAKK2/fakk/

Then to run use the following command;

$ LD_PRELOAD=/path/Loki_Compat/libz.so.1.1.4 /path/FAKK2/fakk2

HERETIC II

No workarounds are required as it is compatible with newer glibc.

HEROES OF MIGHT AND MAGIC 3

Requires an old glibc so to run use the following command;

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/Heroes3/heroes3.dynamic

KOHAN: IMMORTAL SOVEREIGNS

Requires an old glibc so to run use the following command;

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/Kohan/kohan.dynamic

MINDROVER

No workarounds are required as it is compatible with newer glibc.

MYTH 2: SOULBLIGHTER

Compatible with new glibc but needs meminfo compatibility fix.

$ LD_PRELOAD=/path/Loki_Compat/meminfo-compat.so /path/Myth2/myth2_x11.dynamic

Previous instructions to disable movies can be reverted;

$ cd /patch/Myth2
$ mv cutscenes.disabled cutscenes

SHOGO: MOBILE ARMOR DIVISION

No workarounds are required as it is compatible with newer glibc. However it may run too fast on modern computers. Add the following parameter to the autoexec.cfg configuration file located under ~/.hyperion/Shogo/.

"MaxFPS" "30"

SID MEIER'S ALPHA CENTAURI

Requires an old glibc so to run use the following command (note the smacpack command only runs the static binaries);

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/AlphaCentauri/smac.dynamic

To run the Alien Crossfire expansion use the following command;

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/AlphaCentauri/smacx.dynamic

SIMCITY 3000

Requires an old glibc so to run use the following command;

$ LD_LIBRARY_PATH=/path/Loki_Compat/ /path/Loki_Compat/ld-linux.so.2 /path/SimCity3000/sc3u.dynamic

SIN

Compatible with newer glibc using smpeg library created with old compiler but needs an old SDL library name in system. Create a symbolic link in the system from the old name to the new name;

$ cd /usr/lib
$ ln -s libSDL-1.2.so libSDL-1.1.so

Then change to your SiN install directory and run using the following commands;

$ cd /path/SiN
$ $ LD_PRELOAD=/path/Loki_Compat/libstdc++-3-libc6.2-2-2.10.0.so:/path/Loki_Compat/libsmpeg-0.4.so.0.1.3 ./sin.exe

SOLDIER OF FORTUNE

No workarounds are required as it is compatible with newer glibc.

UNREAL TOURNAMENT

No workarounds are required as it is compatible with newer glibc. However do ensure it uses the newer system SDL library. First either rename or delete the old library installed with the game;

$ cd /path/UnrealTournament/System
$ $ mv libSDL-1.1.so.0 libSDL-1.1.so.0.orig

Then create a symbolic link in the system from the old name to the new name;

$ cd /usr/lib
$ $ ln -s libSDL-1.2.so.0 libSDL-1.1.so.0

FURTHER PROBLEMS

If any game exits with an error similar to the following;

X Error of failed request: BadMatch (invalid parameter attributes)
for Major opcode of failed request: 142 (XVideo)

Then disable hardware YUV acceleration by prepending the following to the command that runs the game;

SDL_VIDEO_YUV_HWACCEL=0

OTHER GAMES

For any other old games, post the output of running the following command in the game directory to verify what additional libraries they may need. I'll compile the required libraries and add the instructions here.

$ scanelf -Rnq /path/game/binary

THE LIBRARIES

The libraries included were built in a chrooted Debian 3.0 Woody using GCC 2.95.4 with CFLAGS "-O2 -march=i686" as upgrading from Gentoo 1.2, which has glibc 2.2.5 and gcc 2.95.3, to the current portage is decidedly non-trivial.

GLIBC 2.2.5

From the last Debian Woody 3.0 glibc (security) release which was libc6_2.2.5-11.8_i386.deb. Only the files in the /lib directory are required.

ZLIB 1.1.4

From the last Debian Woody 3.0 zlib release which was zlib1g_1.1.4-1.0woody0_i386.deb.
libz.so.1.1.4

XORG 6.8.2

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo xorg-x11-6.8.2-r4 ebuild and patches.
libX11.so.6.2 libXext.so.6.4 libGL.so.1.2 libXrandr.so.2.0 libXrender.so.1.2.2 libXfixes.so.3.0 libXcursor.so.1.0.2

ALSA 1.0.25

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo alsa-lib-1.0.25 ebuild.
libasound.so.2.0.0 libaoss.so.0.0.0

SDL 1.2.15

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo libsdl-1.2.15 ebuild.
libSDL-1.2.so.0.11.4

SMPEG 0.4.4

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo smpeg-0.4.4-r9 ebuild and patches.
libsmpeg-0.4.so.0.1.3

SMJPEG 0.2.1

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo smjpeg-0.2.1-r2 ebuild.
libsmjpeg-0.2.so.0.0.1

SDL-MIXER 1.2.11

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo sdl-mixer-1.2.11 ebuild.
libSDL_mixer-1.2.so.0.12.0

SDL-TTF 2.0.11

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo sdl-ttf-2.0.11 ebuild.
libSDL_ttf-2.0.so.0.10.1

LIBOGG 1.3.0

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo libogg-1.3.0 ebuild.
libogg.so.0.8.0

LIBVORBIS 1.3.2

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -mcpu=i686" and based on the Gentoo libvorbis-1.3.2 ebuild.
libvorbis.so.0.4.5 libvorbisfile.so.3.3.4

FREETYPE 1.3.1

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo freetype-1.3.1-r4 ebuild.
libttf.so.2.2.0

FREETYPE 2.1.10

Built on Debian 3.0 using GCC 2.95.4 with CFLAGS "-O2 -march=i686" and based on the Gentoo freetype-2.1.10-r2 ebuild and patches but without the security patches as they caused text to disappear with SMAC.
libfreetype.so.6.3.8

OPENAL 0.0

Taken from Unreal Tournament patched to 436. Although the OpenAL CVS was tagged for 0.0 I do not know the status of it. The libopenal-0.0.so included with patch 1.06a for Soldier Of Fortune may possibly be newer with a fix for small wav files but the Unreal Tournament one works for my games.
libopenal-0.0.so

CHANGELOG

1.5 Add alsa-oss. Updated libsdl, sdl-mixer, sdl-ttf, libogg, libvorbis, alsa and smpeg.

1.4 Add meminfo compatibility [3], libogg, and libvorbis. Updated SDL, alsa SDL_mixer and SDL_ttf.

1.3 Add libXcursor, libXfixes and libXrender libraries and update SDL.

REFERENCES

Old Loki Games Under New(ish) Linux
Linux Gamers FAQ
Kohan: Immortal Sovereigns on Newer Linux Distributions
Myth 2 Meminfo Fix