Posted February 02, 2020
I just bought X3: Terran Conflict last night because it claimed Linux support, and I wasn't going to buy the recently released X4 because it apparently is not DRM free (not sure how it made it onto gog...).
I run Arch Linux, and the game did not work out of the box because of issues with how the game binaries linked to system libs, and my local system versions were incompatible.
I was a little irritated but I still wanted to play. I didn't want to muck around with my system libraries so I wrote a script that pulls all the necessary libraries from one of the distros and versions they claim support for (Ubuntu 18.04 LTS) and places them in the game's lib dir.
I wanted to share it here in case it helps anyone else running modern Linux systems. It should be run inside the `game/lib/` directory of your installation to place the libraries there:
```
#!/bin/bash
set -euo pipefail
CONTAINER_NAME="x3-tc-libs-retriever"
CONTAINER_IMAGE="ubuntu:18.04"
echo "INFO: downloading container image ${CONTAINER_IMAGE} to pull libs for x3 terran conflict"
cleanup() {
ex=$?
docker stop -t 0 ${CONTAINER_NAME} 1>/dev/null
exit $ex
}
trap "cleanup" INT TERM EXIT
docker run -d -it --rm --name ${CONTAINER_NAME} ${CONTAINER_IMAGE} sleep infinity 1>/dev/null
docker exec -it ${CONTAINER_NAME} dpkg --add-architecture i386
docker exec -it ${CONTAINER_NAME} apt-get update 1>/dev/null
docker exec -it ${CONTAINER_NAME} apt-get install libgtk2.0-0:i386 -y 1>/dev/null
REQUIRED_LIBS="libgtk-x11-2.0.so.0 libgdk-x11-2.0.so.0 libpango-1.0.so.0 libpangocairo-1.0.so.0 \
libcairo.so.2 libgdk_pixbuf-2.0.so.0 libpangoft2-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 \
libpng16.so.16 libharfbuzz.so.0 libgraphite2.so.3 libxcb-shm.so.0 libz.so.1"
for REQUIRED_LIB in $REQUIRED_LIBS
do
if test -f "${REQUIRED_LIB}"; then
echo "WARNING: ${REQUIRED_LIB} already exists, skipping..."
else
echo "INFO: pulling ${REQUIRED_LIB} from ${CONTAINER_IMAGE}..."
LIB_CONTAINER_PATH='/usr/lib/i386-linux-gnu'
if [[ "${REQUIRED_LIB}" == "libz.so.1" ]]; then
LIB_CONTAINER_PATH='/lib/i386-linux-gnu'
fi
LATEST_VERSION="$(docker exec -it ${CONTAINER_NAME} /bin/bash -c "ls ${LIB_CONTAINER_PATH}/${REQUIRED_LIB}.*" | tail -1 | tr -d '\n' | tr -d '\r')"
docker cp ${CONTAINER_NAME}:${LATEST_VERSION} ./${REQUIRED_LIB}
fi
done
```
You'll need to have docker installed, otherwise you can just use the script as reference for which libraries you'll need.
The game's been working fine for me on Arch Linux, hope it helps.
I run Arch Linux, and the game did not work out of the box because of issues with how the game binaries linked to system libs, and my local system versions were incompatible.
I was a little irritated but I still wanted to play. I didn't want to muck around with my system libraries so I wrote a script that pulls all the necessary libraries from one of the distros and versions they claim support for (Ubuntu 18.04 LTS) and places them in the game's lib dir.
I wanted to share it here in case it helps anyone else running modern Linux systems. It should be run inside the `game/lib/` directory of your installation to place the libraries there:
```
#!/bin/bash
set -euo pipefail
CONTAINER_NAME="x3-tc-libs-retriever"
CONTAINER_IMAGE="ubuntu:18.04"
echo "INFO: downloading container image ${CONTAINER_IMAGE} to pull libs for x3 terran conflict"
cleanup() {
ex=$?
docker stop -t 0 ${CONTAINER_NAME} 1>/dev/null
exit $ex
}
trap "cleanup" INT TERM EXIT
docker run -d -it --rm --name ${CONTAINER_NAME} ${CONTAINER_IMAGE} sleep infinity 1>/dev/null
docker exec -it ${CONTAINER_NAME} dpkg --add-architecture i386
docker exec -it ${CONTAINER_NAME} apt-get update 1>/dev/null
docker exec -it ${CONTAINER_NAME} apt-get install libgtk2.0-0:i386 -y 1>/dev/null
REQUIRED_LIBS="libgtk-x11-2.0.so.0 libgdk-x11-2.0.so.0 libpango-1.0.so.0 libpangocairo-1.0.so.0 \
libcairo.so.2 libgdk_pixbuf-2.0.so.0 libpangoft2-1.0.so.0 libfontconfig.so.1 libfreetype.so.6 \
libpng16.so.16 libharfbuzz.so.0 libgraphite2.so.3 libxcb-shm.so.0 libz.so.1"
for REQUIRED_LIB in $REQUIRED_LIBS
do
if test -f "${REQUIRED_LIB}"; then
echo "WARNING: ${REQUIRED_LIB} already exists, skipping..."
else
echo "INFO: pulling ${REQUIRED_LIB} from ${CONTAINER_IMAGE}..."
LIB_CONTAINER_PATH='/usr/lib/i386-linux-gnu'
if [[ "${REQUIRED_LIB}" == "libz.so.1" ]]; then
LIB_CONTAINER_PATH='/lib/i386-linux-gnu'
fi
LATEST_VERSION="$(docker exec -it ${CONTAINER_NAME} /bin/bash -c "ls ${LIB_CONTAINER_PATH}/${REQUIRED_LIB}.*" | tail -1 | tr -d '\n' | tr -d '\r')"
docker cp ${CONTAINER_NAME}:${LATEST_VERSION} ./${REQUIRED_LIB}
fi
done
```
You'll need to have docker installed, otherwise you can just use the script as reference for which libraries you'll need.
The game's been working fine for me on Arch Linux, hope it helps.
Post edited February 02, 2020 by yunix