AltF02 / x11-rs

Rust bindings for X11 libraries
https://docs.rs/x11
MIT License
206 stars 66 forks source link

link error #65

Closed obv-mikhail closed 7 years ago

obv-mikhail commented 7 years ago

Seem to only appear when xtest::XTestFakeKeyEvent is in the code. xtest::XTestFakeButtonEvent works fine.


/home/mikhail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_uni
code-cfbd6648f7db2ee5.rlib" "/home/mikhail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unk
nown-linux-gnu/lib/libcore-687e6a964d22cbb4.rlib" "/home/mikhail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/
lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-987729be881d4d32.rlib" "-Wl,-Bdynamic" "-l" "X11" "-l"
 "util" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-
l" "util"
  = note: /home/mikhail/Documents/InputBot/target/debug/deps/libinputbot-17f3ee6752fe300d.rlib(inputbot-17f3ee6752fe
300d.0.o): In function `inputbot::linux::send_keybd_input':
          /home/mikhail/Documents/InputBot/src/linux/mod.rs:85: undefined reference to `XTestFakeKeyEvent'
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: Could not compile `inputbot`.
ghost commented 7 years ago

Is the xtest cargo feature enabled?

[dependencies]
x11 = { version = "2.14.0", features = ["xtest"] }

If not, the function may be missing from your libXtst.so. Here's a quick way to check:

readelf -sW /usr/lib/libXtst.so | grep XTestFakeKeyEvent
obv-mikhail commented 7 years ago

Thanks for the quick response. As you guessed, I forgot to enable the "xtest" feature. Everything works now.