Having problem with libXtst when trying to emulate Xiaomi Tools V2

Hi, i installed the following dependencies:

xorg.libXtst gtk3 xorg.libXext xorg.libXi jdk17 javaPackages.openjfx17

Verifying archive integrity… 100% All good.
Uncompressing XiaoMiTool V2 100%
Exception in thread “main” java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /tmp/selfgz4043418274/lib/libglassgtk3.so: libXtst.so.6: cannot open shared object file: No such file or directory
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
… 5 more
Caused by: java.lang.UnsatisfiedLinkError: /tmp/selfgz4043418274/lib/libglassgtk3.so: libXtst.so.6: cannot open shared object file: No such file or directory
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(Unknown Source)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$new$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.(Unknown Source)
at javafx.graphics/com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.run(Unknown Source)

I suspect that ${xorg.libXtst}/lib is not contained in your LD_LIBRARY_PATH. If you just want to test, you can define this manually (in a shell, run echo $buildInputs to find the store path of the dependencies you declared), but if you’re packaging this software with Nix, you should probably consider patching the code to adjust the path or using a wrapper.

2 Likes

i tested with nix-shell first, with all the necessary dependencies and it had not worked, then tested with nix-ld declaring the dependencies in /etc/nixes/configuration.nix and solved my problem. Thanks a lot.

I put this:
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
jdk17
uutils-coreutils-noprefix
xorg.xorgserver
xorg.libX11
gtk3
libglibutil
glib
glibc
javaPackages.openjfx17
xorg.libXtst
];

on configuraiton.nix