LilleAila / plover-uinput

MIT License
3 stars 0 forks source link

"Failed to build xkbcommon" when trying to install the plugin from the plover plugin manager #1

Closed tomklino closed 2 months ago

tomklino commented 2 months ago

Running on ubuntu 22.04

Trying to install the plugin from the plugin manager and getting an error for xkbcommon.

Tried installing libxkbcommon-dev with apt-get but that only results in a different error.

Full logs:

Collecting plover-uinput==0.0.13
  Using cached plover_uinput-0.0.13-py3-none-any.whl (10 kB)
Collecting xkbcommon>=0.8
  Using cached xkbcommon-1.5.1.tar.gz (80 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: plover>=4.0.0rc2 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover-uinput==0.0.13) (4.0.0rc2+6.g53c416f)
Collecting evdev>=1.7.0
  Using cached evdev-1.7.1-cp39-cp39-linux_x86_64.whl
Requirement already satisfied: python-xlib>=0.29 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (0.31)
Requirement already satisfied: wcwidth in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (0.2.5)
Requirement already satisfied: setuptools in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (58.3.0)
Requirement already satisfied: plover-stroke>=1.1.0 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (1.1.0)
Requirement already satisfied: rtf-tokenize in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (1.0.0)
Requirement already satisfied: pyserial>=2.7 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (3.5)
Requirement already satisfied: appdirs>=1.3.0 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from plover>=4.0.0rc2->plover-uinput==0.0.13) (1.4.4)
Requirement already satisfied: cffi>=1.5.0 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from xkbcommon>=0.8->plover-uinput==0.0.13) (1.15.0)
Requirement already satisfied: pycparser in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from cffi>=1.5.0->xkbcommon>=0.8->plover-uinput==0.0.13) (2.20)
Requirement already satisfied: six>=1.10.0 in /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages (from python-xlib>=0.29->plover>=4.0.0rc2->plover-uinput==0.0.13) (1.16.0)
Building wheels for collected packages: xkbcommon
  Building wheel for xkbcommon (pyproject.toml): started
  Building wheel for xkbcommon (pyproject.toml): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /tmp/.mount_ploverw5Q4Vg/usr/bin/python /tmp/.mount_ploverw5Q4Vg/usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp038mhsi6
       cwd: /tmp/pip-install-tvmu9odj/xkbcommon_155e688ac9ce449e891d2a7aa27002ed
  Complete output (21 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-39
  creating build/lib.linux-x86_64-cpython-39/xkbcommon
  copying xkbcommon/xkb.py -> build/lib.linux-x86_64-cpython-39/xkbcommon
  copying xkbcommon/__init__.py -> build/lib.linux-x86_64-cpython-39/xkbcommon
  copying xkbcommon/ffi_build.py -> build/lib.linux-x86_64-cpython-39/xkbcommon
  running build_ext
  generating cffi module 'build/temp.linux-x86_64-cpython-39/xkbcommon._ffi.c'
  creating build/temp.linux-x86_64-cpython-39
  building 'xkbcommon._ffi' extension
  creating build/temp.linux-x86_64-cpython-39/build
  creating build/temp.linux-x86_64-cpython-39/build/temp.linux-x86_64-cpython-39
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/.mount_ploverw5Q4Vg/usr/include/python3.9 -c build/temp.linux-x86_64-cpython-39/xkbcommon._ffi.c -o build/temp.linux-x86_64-cpython-39/build/temp.linux-x86_64-cpython-39/xkbcommon._ffi.o
  build/temp.linux-x86_64-cpython-39/xkbcommon._ffi.c:575:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
    575 | #include <xkbcommon/xkbcommon.h>
        |          ^~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for xkbcommon
Failed to build xkbcommon
ERROR: Could not build wheels for xkbcommon, which is required to install pyproject.toml-based projects

Any advice?

LilleAila commented 2 months ago

The error seems to indicate that libxkbcommon is missing. If you tried all the different libxkbcommon(-dev) packages and have pkg-config, i suspect it might be because of a wrongly specified version requirement of this package and i’ll fix it later today.

tomklino commented 2 months ago

Update: found out a few new things that might help

When the installer setup up xkbcommon, python resolves the ">0.8" requirement to version "1.5" of the python library for xkbcommon (this might change in the future). But as I was running Ubuntu 22.04, the latest package for libxkbcommon was version 1.4.

Luckily I had a 2nd laptop with Ubuntu 24.04, for which the libxkbcommon package is provided in version 1.6. So Installing on it worked.

I think a decent fix would be to set the python requirement to a fixed version, because the ">0.8" might change what it resolved to.

A few other possible solutions (though probably overkill): Maybe even have the installer detect the version libxkbcommon that is installed (or can be installed) on the current distribution. Somewhere in between could have the installer set up its own libxkbcommon and not depend on the package manager of the distribution used.

If you're willing to show me how to install the plugin from source I can try to code it myself

LilleAila commented 2 months ago

What i think i should do is set it to xkbcommon < 1.1, which is what the project readme says to do. As for installing from source, the required command should be in the plover docs.

tomklino commented 2 months ago

I noticed you fixed the requirement in your latest commit, thanks!

Did you also release it in the plover plugin manager? because when I'm trying to install it it installs version 0.0.13 of the plugin, which still has the >=0.8 requirement and fails to install on Ubuntu 22.04.

Should I just wait until plover plugin manager updates it?

LilleAila commented 2 months ago

No sorry, i forgot to push it to PyPi. I unfortunately can’t fix it right now, but i will do it in a few days

LilleAila commented 2 months ago

Actually i could, should work now :)

tomklino commented 2 months ago

thank you! i installed it from source and now it works

but, a weird issue... plover can't output any key that requires a shift to be pressed for example, i is typed in lower case and the exclamation mark is typed '1'. Also, when I use the command to capitalize the last word it just reprints it....

do you have any idea why that might be?

LilleAila commented 2 months ago

https://github.com/LilleAila/plover-uinput/blob/f3c3feb82e3e4fc499a7e61574da39edb3dc9aa5/plover_uinput/__init__.py#L300

I think that this line mighe be the culprit. I’ll take a look at it and see if i can reproduce it when i get home.