Repository: lutris/lutris

Issue:
"Prefer system libraries" has no effect in next
As the Wine versions on Lutris are build on Ubuntu 16.04, they are incompatible with the version of fontconfig that Arch provides, resulting in errors in applications (like Battle.Net not starting properly).
To fix that, I need to enable "Prefer System Libraries", which is disabled by default in `next`. But, for some reason, in `next`, enabling it has no effect, as I keep getting fontconfig errors. In the game config `  prefer_system_libs:` is set to `true`, but Lutris just ignores it, it seems.


Discussion:
On my machine, picking a random wine application and toggling "Prefer System Libraries" on and off appears to cause a much different `LD_LIBRARY_PATH` to be set:

w/o
```
LD_LIBRARY_PATH="/home/aopfer/.local/share/lutris/runtime/lib32:/home/aopfer/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/i386/lib:/home/aopfer/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/i386/usr/lib:/home/aopfer/.local/share/lutris/runtime/lib64:/home/aopfer/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/amd64/lib:/home/aopfer/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH"
```

w/
```
LD_LIBRARY_PATH="/home/aopfer/.local/share/lutris/runners/wine/tkg-3.21-x86_64/lib:/home/aopfer/.local/share/lutris/runners/wine/tkg-3.21-x86_64/lib64:/lib:/lib64:/lib32:/lib64:/lib/i386-linux-gnu:/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/x86_64-linux-gnu:/home/aopfer/.local/share/lutris/runtime/lib32:/home/aopfer/.local/share/lutris/runtime/steam/i386/lib/i386-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/i386/lib:/home/aopfer/.local/share/lutris/runtime/steam/i386/usr/lib/i386-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/i386/usr/lib:/home/aopfer/.local/share/lutris/runtime/lib64:/home/aopfer/.local/share/lutris/runtime/steam/amd64/lib/x86_64-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/amd64/lib:/home/aopfer/.local/share/lutris/runtime/steam/amd64/usr/lib/x86_64-linux-gnu:/home/aopfer/.local/share/lutris/runtime/steam/amd64/usr/lib:$LD_LIBRARY_PATH"
```
Can you run lutris with `lutris --debug` and paste what `LD_LIBRARY_PATH` is generated? Also: is your OS a 32bit or 64bit?
64 bit arch
enabled:
https://paste.ubuntu.com/p/89HyCSZK4Y/
disabled:
https://paste.ubuntu.com/p/Wx97Znq3Ck/

Thanks for your logs, they're pretty helpful. Can you provide another log of when you use 0.4.21 to launch the game?

For developer reference, the "prefer system libraries" enabled has the following prepended to the `LD_LIBRARY_PATH`:
```
/home/alex/.local/share/lutris/runners/wine/tkg-3.21-x86_64/lib
/home/alex/.local/share/lutris/runners/wine/tkg-3.21-x86_64/lib64
/lib
/lib64
/usr/lib
/usr/lib64
```
I'm assuming that we're missing an entry that used to be present here in `master`.
Lutris 0.4.23 with prefer system libraries enabled:
https://paste.ubuntu.com/p/KDh4RyvSTj/
I assume you have the lutris git checked out; can you tell me if this patch fixes the problem for you? 
```diff
diff --git a/lutris/util/system.py b/lutris/util/system.py
index 9662cc52..b1b3b67e 100644
--- a/lutris/util/system.py
+++ b/lutris/util/system.py
@@ -90,6 +90,7 @@ class LinuxSystem:
         ('/lib', '/lib64'),
         ('/lib32', '/lib64'),
         ('/usr/lib', '/usr/lib64'),
+        ('/usr/lib32', '/usr/lib64'),
         ('/lib/i386-linux-gnu', '/lib/x86_64-linux-gnu'),
         ('/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu'),
     ]
```
Save the above quoted with some filename like `usr_lib32.patch`

apply with `git apply usr_lib32.patch`

and ensure "prefer system libraries" is checked and run it again with `lutris --debug`
It did not unfortunately:
https://paste.ubuntu.com/p/fb4Nkqn376/
Did you reenable "prefer system libraries" before that run? It doesn't look like it was enabled from what the debug log is showing.
Oh I am sorry, I forgot to save the changes by mistake.
I enabled it and now it works!
https://paste.ubuntu.com/p/wr4sgxtz25/

Resolving patch:
diff --git a/lutris/util/system.py b/lutris/util/system.py
--- a/lutris/util/system.py
+++ b/lutris/util/system.py
@@ -90,6 +90,7 @@ class LinuxSystem:
         ('/lib', '/lib64'),
         ('/lib32', '/lib64'),
         ('/usr/lib', '/usr/lib64'),
+        ('/usr/lib32', '/usr/lib64'),
         ('/lib/i386-linux-gnu', '/lib/x86_64-linux-gnu'),
         ('/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu'),
     ]


Test patch: