phillipberndt / fakexrandr

Fake XRandR configurations for multi-head setups with crappy video drivers, like fakexinerama but with xrandr
270 stars 40 forks source link

Error running on Rasbian (Stretch) - Raspberry Pi 3B. FakeXrandr states that "The GUI requires ctypes to be able to open libX11.so and an X Display" #58

Open browloga490 opened 4 years ago

browloga490 commented 4 years ago

This is the output that I receive when I run fakexrandr-manage:

$ sudo fakexrandr-manage gui /usr/bin/fakexrandr-manage:37: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Gdk The GUI requires ctypes to be able to open libX11.so and an X Display

I have both Python 2 and 3 installed on my pi and they both have the ctypes library instaled (I was able to import this library on both versions). I am not sure what I am missing here.

Any help would be greatly appreciated. Thank you.

webstrand commented 4 years ago

I ran into the same issue, as far as I can tell, the error message is erroneous. The actual exception is:

Traceback (most recent call last):
  File "./fakexrandr-manage.py", line 56, in <module>
    libXrandr = ctypes.CDLL(Xrandr_path)
  File "/usr/lib64/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libXrandr.so: wrong ELF class: ELFCLASS32

I don't really know where it's going wrong, but I suspect it's related to having both /usr/lib/libXrandr.so and /usr/lib64/libXrandr.so.

phillipberndt commented 4 years ago

The GUI requires ctypes to be able to open libX11.so and an X Display

Try replacing

HAS_X11_DISPLAY=False

in line 69 with

raise

and paste the error message here, please. If it's the same as reported by @webstrand, then never mind.

phillipberndt commented 4 years ago

I don't really know where it's going wrong, but I suspect it's related to having both /usr/lib/libXrandr.so and /usr/lib64/libXrandr.so.

Do you run this on a raspberrypi as well? If yes, then you accidentally installed xrandr for a different system (x86 rather than the arm architecture used by RPi)

webstrand commented 4 years ago

Got fakexrandr working by modifying line 53 to

for directory in ("/usr/lib64/x86_64-linux-gnu/", "/usr/lib64", "/lib64/x86_64-linux-gnu/", "/lib64", "/usr/lib64/i386-linux-gnu/", "/lib64/i386-linux-gnu/", "/usr/lib64"):

The issue is, my distro (gentoo) keeps x86_64 libraries in /usr/lib64 and cross-platform libraries in /usr/lib so the python script was loading the 32-bit library preferentially.