kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.73k stars 344 forks source link

libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory #152

Open leif81 opened 7 years ago

leif81 commented 7 years ago

I tried updating my app to use jnativehook 2.1.0 today. When I built and then ran it I see the following error in console on startup.

Caused by: java.lang.UnsatisfiedLinkError: /tmp/libJNativeHook-2.1.0.x86_64.so: libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
        at java.lang.Runtime.load0(Runtime.java:809)
        at java.lang.System.load(System.java:1086)
        at org.jnativehook.GlobalScreen.<clinit>(Unknown Source)

I'm using Java8u40 on CentOS 6.5.

kwhat commented 7 years ago

Install xkbcommon with x11 support. I think it's called libxkbcommon-0.5.0 on CentOS.

leif81 commented 7 years ago

Thanks. I thought it might be something like that. I have searched in yum for "libxkbcommon" but it doesn't turn up anything. I'll keep looking.

leif81 commented 7 years ago

Darn. It looks like at best I'll have to use an unofficial rpm to get libxkbcommon on CentOS 6. 😞 I think I'll stick with 2.0.3 a little while longer.

Btw I see my issue is a dupe of #145.

kwhat commented 7 years ago

The only thing you need xkbcommon for is language support on Linux. If you don't upgrade, it will always be in english on Linux. I think xkbcommon was added to CentOS 7. Version 2.0 will be maintained for a while.

leif81 commented 7 years ago

Would it be possible to make it an optional dependency somehow or is that more trouble than it's worth?

kwhat commented 7 years ago

Totally possible, and probably something I should do for 2.1.1 if CentOS 6 doesn't support xkbcommon. I don't think it will be possible for 3.0 though.

leif81 commented 7 years ago

Cool, that would be very helpful.

Sadly it doesn't look like it's in the CentOS 7 package listing either. Doh.

http://mirror.centos.org/centos/6.8/os/x86_64/Packages/ http://mirror.centos.org/centos/7/os/x86_64/Packages/

kwhat commented 7 years ago

This will be combined with efforts for issue #163.

sonerokur commented 7 years ago

Hi, I'm using Fedora 15. I'm also getting this error. Is there any progress on this issue ? Thank you.

kwhat commented 7 years ago

xkbcommon is required for non-english language support on Linux. I have not figured out a way around this issue besides making xkbcommon an optional runtime dependency, but that doesn't really "fix" the problem. There are a couple of possibilities for a long term solution. I think I maybe able to use the KeySym produced by the event tap to get the correct unicode char for the selected language, however, It would require using a different set of key constants and I still need to test that this method will work. The only other option would be to interface with the system's locale, but I don't know if this is the same locale used by X11 Window Managers. Let me know if anyone interested in this bug can test on non-english locales.

kwhat commented 7 years ago

As long as you have an xcb-proto package (PECL) I should be able to staticaly link the missing depends.

Sharpevil commented 7 years ago

I'm using JNativeHook in a project, and I've started getting this problem after switching to a new computer. Both computers run CentOS 7, which is the target platform, and I believe I fixed it on the old computer by installing libxkbcommon-x11, but installing it on the new computer didn't change anything.

Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError: /tmp/libJNativeHook-2.1.0.x86_64.so: libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at org.jnativehook.GlobalScreen.<clinit>(Unknown Source)
jethwanidhiraj commented 9 months ago

Facing the same issue. I am using ubuntu server.