From 2d92d1009b1fbcaf3f0ce0d244e3a2ea874ad905 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Nov 2023 07:56:58 +0530 Subject: [PATCH] Linux installer: Check that the user has libxcb-cursor.so.0 installed If not quit early with an error message asking them to install it --- setup/linux-installer.py | 12 ++++++++++++ setup/linux-installer.sh | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/setup/linux-installer.py b/setup/linux-installer.py index add3b0b9a7..7382ff2b81 100644 --- a/setup/linux-installer.py +++ b/setup/linux-installer.py @@ -768,6 +768,16 @@ def check_for_libOpenGl(): raise SystemExit('You are missing the system library libOpenGL.so.0. Try installing packages such as libopengl0') +def check_for_libxcb_cursor(): + import ctypes + try: + ctypes.CDLL('libxcb-cursor.so.0') + return + except Exception: + pass + raise SystemExit('You are missing the system library libxcb-cursor.so.0. Try installing packages such as libxcb-cursor0 or xcb-cursor') + + def check_glibc_version(min_required=(2, 31), release_date='2020-02-01'): # See https://sourceware.org/glibc/wiki/Glibc%20Timeline import ctypes @@ -809,6 +819,8 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_ if q[0] >= 6: check_for_libEGL() check_for_libOpenGl() + if q[0] >= 7: + check_for_libxcb_cursor() run_installer(install_dir, isolated, bin_dir, share_dir, version) diff --git a/setup/linux-installer.sh b/setup/linux-installer.sh index 9d36fe88f0..bad2ce6863 100644 --- a/setup/linux-installer.sh +++ b/setup/linux-installer.sh @@ -817,6 +817,16 @@ def check_for_libOpenGl(): raise SystemExit('You are missing the system library libOpenGL.so.0. Try installing packages such as libopengl0') +def check_for_libxcb_cursor(): + import ctypes + try: + ctypes.CDLL('libxcb-cursor.so.0') + return + except Exception: + pass + raise SystemExit('You are missing the system library libxcb-cursor.so.0. Try installing packages such as libxcb-cursor0 or xcb-cursor') + + def check_glibc_version(min_required=(2, 31), release_date='2020-02-01'): # See https://sourceware.org/glibc/wiki/Glibc%20Timeline import ctypes @@ -858,6 +868,8 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_ if q[0] >= 6: check_for_libEGL() check_for_libOpenGl() + if q[0] >= 7: + check_for_libxcb_cursor() run_installer(install_dir, isolated, bin_dir, share_dir, version) @@ -869,7 +881,7 @@ except NameError: def update_intaller_wrapper(): - # To run: python3 -c "import runpy; runpy.run_path('setup/linux-installer.py', run_name='update_wrapper')" + # To update: python3 -c "import runpy; runpy.run_path('setup/linux-installer.py', run_name='update_wrapper')" with open(__file__, 'rb') as f: src = f.read().decode('utf-8') wrapper = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'linux-installer.sh')