From 543a70170ec452a260b18c3eb7430a6598c2f544 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel <brecht@blender.org> Date: Wed, 21 Jun 2023 14:49:27 +0200 Subject: [PATCH] Linux: add launcher script to fix issue launching on Steam The steam environment sets LD_LIBRARY_PATH with a libtbb.so.2 that is incompatible with our own. This wrapper scripts gives our own library priority. There is a more modern "Steam Linux Runtime" that can be used instead of the "LD_LIBRARY_PATH Steam Runtime" and which launches Blender, but it fails to detect GPU compute libraries. So that was not an option. Ref #107385 Pull Request: https://projects.blender.org/blender/blender/pulls/109169 --- release/bin/blender-launcher | 12 ++++++++++++ source/creator/CMakeLists.txt | 1 + tools/check_blender_release/check_static_binaries.py | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 release/bin/blender-launcher diff --git a/release/bin/blender-launcher b/release/bin/blender-launcher new file mode 100755 index 00000000000..521e2c82199 --- /dev/null +++ b/release/bin/blender-launcher @@ -0,0 +1,12 @@ +#!/bin/sh +BF_DIST_BIN=$(dirname "$0") +BF_PROGRAM="blender" + +# Add own lib folder first, because Steam or other environments may set an +# LD_LIBRARY_PATH that has priority over the runpath in the Blender excutable, +# but contains incompatible libraries. +LD_LIBRARY_PATH=${BF_DIST_BIN}/lib:${LD_LIBRARY_PATH} + +export LD_LIBRARY_PATH + +exec "$BF_DIST_BIN/$BF_PROGRAM" ${1+"$@"} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a7bd94dcfd0..0773b4e3722 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -619,6 +619,7 @@ if(UNIX AND NOT APPLE) install( PROGRAMS + ${CMAKE_SOURCE_DIR}/release/bin/blender-launcher ${CMAKE_SOURCE_DIR}/release/bin/blender-softwaregl DESTINATION "." ) diff --git a/tools/check_blender_release/check_static_binaries.py b/tools/check_blender_release/check_static_binaries.py index 2015452d99f..14eb15cf1e0 100644 --- a/tools/check_blender_release/check_static_binaries.py +++ b/tools/check_blender_release/check_static_binaries.py @@ -51,7 +51,7 @@ ALLOWED_LIBS = ( "libfreetype.so", ) -IGNORE_FILES = ("blender-softwaregl", ) +IGNORE_FILES = ("blender-launcher", "blender-softwaregl", ) IGNORE_EXTENSION = (".sh", ".py", ) -- GitLab