Skip to content

Commit

Permalink
Linux installer: Check that the user has libxcb-cursor.so.0 installed
Browse files Browse the repository at this point in the history
If not quit early with an error message asking them to install it
  • Loading branch information
kovidgoyal committed Nov 18, 2023
1 parent a326b9f commit 2d92d10
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions setup/linux-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down
14 changes: 13 additions & 1 deletion setup/linux-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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')
Expand Down

0 comments on commit 2d92d10

Please sign in to comment.