So you’ve bought Divinity: Original Sin Enhanced Edition on Steam and you want to play it on your Linux gaming rig with an AMD Radeon or Intel graphics card using the Mesa 3D Graphics Library, right? Wrong!
The game won’t start and instead will show you an ugly error that looks like in the screenshot attached in the gallery at the end of the tutorial. I purchased the game a few months ago to play co-op with a friend, but, after installing it on my GNU/Linux computer I could not even start it with my AMD Radeon HD 8750M discrete GPU, nor with the integrated Intel Haswell HD 4000 graphics card.
Of course, if you’re playing the game with Nvidia GPUs, you shouldn’t even read this. Now, let’s get back to business as I’m gonna show you a very simple way to make Divinity: Original Sin Enhanced Edition work with the open source Intel or Radeon drivers that are included in the popular Mesa graphics stack. But first, I’d like to tell you a little background story on this bug.
As you might expect, there’s a bug report on the Mesa bug tracker since a year ago. During all this time, it was marked as resolved/fixed/closed, then it got reopened again. Attached to the bug report, there are two files, but we’re interested in the first one, the simple LD_PRELOAD shim submitted by Thomas J. Moore. So this being a game bug, not a Mesa one, it should be reported to the game’s devs, who don’t offer support for Mesa.
“MESA drivers are not supported. We chose to only support the official nVidia and AMD drivers,” said one of the devs on the official forums when asked by a Linux user if they plan on fixing that annoying crash on startup with the Mesa drivers. So, I’m writing this tutorial now because it doesn’t look like the bug will be fixed, and if you need these instructions if you want to play this gorgeous game.
Here’s how to patch Divinity: Original Sin Enhanced Edition for Mesa
I have to give credit where credit is due, so my tutorial is based on a tutorial that Pontostroy (Gears on Gallium) translated into English from a Russian tutorial made by Stil on the linux.org.ru website (read that if you’re using the r600 driver because I’m using the radeon one). I’ve simplified everything to make it easier for newcomers that aren’t used with terminal commands and compiling stuff on Linux, as well as anyone else who reinstalls the game and needs a quick workaround for the bug.
The first thing you need to do is to install the game. Once the installation is complete, right-click its entry on the game list and select Properties. Go to the “Local Files” tab and click on the “Browse Local Files” button. The default file manager will open with the game’s files, and here you’ll have to open a terminal window by right-clicking on an empty area and select the “Open in Terminal” entry from the context menu.
Now, you’ll need to run the following command listed below to install a few packages that you’ll for compiling a library (our workaround). Once those packages have been successfully installed, you must create a new text file in the same location, which we will name “workaround.c” (without quotes, of course). To create the file, run the second command listed below, assuming you have the Gedit text editor installed.
sudo apt-get install mesa-common-dev libgl1-mesa-dev
gedit workaround.c
In the empty text file, paste the contents of the LD_PRELOAD shim by Thomas J. Moore by selecting the text and using the middle mouse click (do NOT copy the text to clipboard with Ctrl+C or it won’t look like it’s supposed to). Save the file with the name “workaround.c” (again, without quotes), and then run the following two commands, one by one, hitting the Enter key after each one.
gcc -Wall -fPIC -DPIC -c workaround.c
ld -shared -o workaround.so workaround.o -ldl -lGL
Now you should have three new files in the game’s folder, namely workaround.c workaround.o, and workaround.so. Open the “runner.sh” file in the text editor by right-clicking on it and selecting the “Open With Text Editor” context menu entry (see screenshot below). Edit the contents of the file by adding two new lines like shown below. Make sure your file looks identical with the one in the screenshot and save it.
export allow_glsl_extension_directive_midshader=true
LD_PRELOAD=”workaround.so”
LD_LIBRARY_PATH=”.” ./EoCApp
That’s it! You can close the game’s folder, the Terminal, etc., add the DRI_PRIME=1 %command% hack in the “Set Launch Options” box and hit the Play button to enjoy Divinity: Original Sin Enhanced Edition. If I missed something, or if you run into any issues while trying to patch the bug, don’t hesitate to drop a comment below and I’ll try to help you if I can, because Larian Studios sure won’t help you. Have fun!