Skip to content

RedHat 7.x and Steam

stanislawbartkowski edited this page Oct 29, 2019 · 6 revisions

Introduction

steam video game platform is available also for RedHat/CentOs although the officially supported distribution is Ubuntu. The steam can be installed using nux-desktop repository. More details: https://developpaper.com/how-to-install-nux-dextop-repository-on-centos/
Also, Linux games should work on RedHat/Centos, particularly games supported on older, 16.04 Ubuntu distribution.

Problem

Unfortunately, sometimes Linux games cannot launch. The unpleasant message comes up.

cd ~/.steam/steam/steamapps/common/Crusader Kings II
./ck2

./ck2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./ck2)
./ck2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./ck2)

The reason is an old version of libstdc++.so.6 library provided with the RedHat/CentOs platform, the game obviously was compiled using more current c++ compiler.

ll /usr/lib64/libstdc++.so.6

lrwxrwxrwx. 1 root root 19 10-29 00:48 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.19

Solution

The solution is to install locally appropriate gcc and rewire the game to use newer libraries.

Download and unpack GNU CCC package

https://gcc.gnu.org/wiki/InstallingGCC

wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz
tar xvfz gcc-5.1.0.tar.gz
cd gcc-5.1.0
./contrib/download_prerequisites

Compile GNU GCC

cd ..
mkdir gcc-5.1.0-build
cd gcc-5.1.0-build
../gcc-5.1.0/configure --enable-languages=c,c++ --disable-multilib
make

Warning: it can take several hours until completed.

ll x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/<br<

 compatibility-atomic-c++0x.o
 compatibility-c++0x.o
 compatibility-chrono.o
 compatibility-condvar.o
 compatibility-debug_list-2.o
 compatibility-debug_list.o
 compatibility.o
 compatibility-thread-c++0x.o
 libstdc++.a
 libstdc++convenience.a
 libstdc++convenience.la -> ../libstdc++convenience.la
 libstdc++.la -> ../libstdc++.la
 libstdc++.lai
 libstdc++.so -> libstdc++.so.6.0.21
 libstdc++.so.6 -> libstdc++.so.6.0.21
 libstdc++.so.6.0.21

Test the game with new libraries

Navigate to the game directory (here Crusaders King 2).

cd ~/.steam/steam/steamapps/common/Crusader Kings II
export LD_LIBRARY_PATH=/home/sbartkowski/x/gcc-5.1.0-build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
ldd ck2

 linux-vdso.so.1 =>  (0x00007ffd634fc000)
 libdl.so.2 => /lib64/libdl.so.2 (0x00007fba313e4000)
 libm.so.6 => /lib64/libm.so.6 (0x00007fba310e2000)
 PDXBrowser_IPC.so => /home/sbartkowski/.local/share/Steam/steamapps/common/Crusader Kings II/./PDXBrowser_IPC.so (0x00007fba30eaa000)
 libGLU.so.1 => /lib64/libGLU.so.1 (0x00007fba30c2a000)
 libGL.so.1 => /lib64/libGL.so.1 (0x00007fba3099e000)
 libtbb.so.2 => /lib64/libtbb.so.2 (0x00007fba30769000)
.............

If error is still reported, it means that something went wrong. One reason is that GNU GCC make* was not completed succesfully.

/ck2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./ck2)
./ck2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./ck2)
	linux-vdso.so.1 =>  (0x00007ffebb59a000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f23e9d57000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f23e9a55000)

Launch the game, the game should be up and running.

./ck2

Make the fix pernament

Navigate to GNU GCC build and install it.

cd ~/gcc-5.1.0-build
sudo make install

The GNU GCC is installed is /usr/local directory, the libraries can be found in /usr/local/lib64.
Replacing system /lib64/libstdc++.so.6 with newly installed GNU GCC is risky because it can corrupt other software dependent on this library. The safer method is to fix steam launching script.

~/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh

Modify the line where steam_runtime_library_paths is set by adding /usr/local/lib64 path at the beginning. This way new libraries take precedence over the old ones.

#steam_runtime_library_paths="$host_library_paths$STEAM_RUNTIME/i386/lib/i386-linux-gnu:$STEAM_RUNTIME/i386/lib:$STEAM_RUNTIME/i386/usr/lib/i386-linux-gnu:$STEAM_RUNTIME/i386/usr/lib:$STEAM_RUNTIME/amd64/lib/x86_64-linux-gnu:$STEAM_RUNTIME/amd64/lib:$STEAM_RUNTIME/amd64/usr/lib/x86_64-linux-gnu:$STEAM_RUNTIME/amd64/usr/lib"

steam_runtime_library_paths="/usr/local/lib64:$host_library_paths$STEAM_RUNTIME/i386/lib/i386-linux-gnu:$STEAM_RUNTIME/i386/lib:$STEAM_RUNTIME/i386/usr/lib/i386-linux-gnu:$STEAM_RUNTIME/i386/usr/lib:$STEAM_RUNTIME/amd64/lib/x86_64-linux-gnu:$STEAM_RUNTIME/amd64/lib:$STEAM_RUNTIME/amd64/usr/lib/x86_64-linux-gnu:$STEAM_RUNTIME/amd64/usr/lib"

Restart steam, launch the game and have a good time

Clone this wiki locally