christopheraue / ruby-uinput-keyboard

Ruby wrapper around uinput to create a virtual keyboard.
4 stars 0 forks source link

Could not open library 'libxkbcommon.so': libxkbcommon.so. #3

Closed zw963 closed 8 years ago

zw963 commented 8 years ago

When i run following code:

require 'uinput/keyboard'

begin
    keymap = Uinput::Keyboard.keymap(rules: 'evdev', model: 'pc104', layout: 'de', variant: 'nodeadkeys')
    keyboard = Uinput::Keyboard.new(keymap)

    sleep 1 # to give linux time to setup the new device

    # While pasting this code into irb
    keyboard.type('Time.now')   # types 'Time.now'
    keyboard.tap(:Return)       # presses the Return key and returns the timestamp
ensure
    keyboard.destroy if keyboard
end

get following error:

/home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'xkbcommon': xkbcommon: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libxkbcommon.so': libxkbcommon.so: cannot open shared object file: No such file or directory
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `map'
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `ffi_lib'
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/libxkbcommon-1.0.0/lib/libxkbcommon.rb:7:in `<module:Libxkbcommon>'
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/libxkbcommon-1.0.0/lib/libxkbcommon.rb:4:in `<top (required)>'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/xkbcommon-0.1.0/lib/xkbcommon.rb:1:in `<top (required)>'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/zw963/.rvm/gems/ruby-2.2.4@uinput1/gems/uinput-keyboard-0.3/lib/uinput/keyboard.rb:3:in `<top (required)>'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /home/zw963/.rvm/rubies/ruby-2.2.4/lib64/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from test1.rb:1:in `<main>'
christopheraue commented 8 years ago

That's because you need the xkbcommon library for your linux distribution.

zw963 commented 8 years ago

i have this package installed, though the name is not exactly same.

rpm -ql libxkbcommon-x11-0
/usr/lib64/libxkbcommon-x11.so.0
/usr/lib64/libxkbcommon-x11.so.0.0.0
/usr/share/doc/packages/libxkbcommon-x11-0
/usr/share/doc/packages/libxkbcommon-x11-0/COPYING
/usr/share/doc/packages/libxkbcommon-x11-0/NEWS

does i need recreate a new symbolic link?

christopheraue commented 8 years ago

No, that's not the correct lib.

zw963 commented 8 years ago

after a search in openSUSE 42.1 with zypper(package manager) I can found the only package is this.

 rpm -ql libxkbcommon0
/usr/lib64/libxkbcommon.so.0
/usr/lib64/libxkbcommon.so.0.0.0
/usr/share/doc/packages/libxkbcommon0
/usr/share/doc/packages/libxkbcommon0/COPYING
/usr/share/doc/packages/libxkbcommon0/NEWS

and i recreate it will a new symbolic link as need, it worked.