Borderlands 2 on Gentoo

I decided to create to make a detailed guide to get Borderlands 2 running as I run into different problems at different stages. Some of those steps will also be applicable to other Linux versions and some might be pretty specific to Gentoo Linux.

Make sure no Steam Play compatibility is set

Make sure the checkmark for "Force the use of a specific Steam Play compatibility tool" is unchecked under the properties of the game. In my case when it was checked, the game popped out as soon as I should have arrived at the menu.

Recompile some libraries with optimization set to 1

To get Borderlands 2 up and running on Gentoo I needed to recompile the following modules with flag "-O1" instead of the commonly used flag "-O2":

  • media-libs/openal
  • media-sound/pulseaudio
  • sys-libs/glib
  • x11-libs/libxcb

This may or may not be required for media-sound/pulseaudio and sys-libs/glib but is definitely required for the other two. I just didn't wat to revert back after troubleshooting.

I created two files in my system:

COMMON_FLAGS="-O1 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
/etc/portage/env/o1.conf
media-libs/openal       o1.conf
media-sound/pulseaudio  o1.conf
sys-libs/glibc          o1.conf
x11-libs/libxcb         o1.conf
/etc/portage/package.env

...and recompiled using "emerge -1 media-libs/openal media-sound/pulseaudio sys-libs/glibc x11-libs/libxcb".

See also: Steam/Games troubleshooting (Gentoo Wiki)