Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recaf on NixOs #739

Open
C0D3-M4513R opened this issue Nov 13, 2023 · 11 comments
Open

Recaf on NixOs #739

C0D3-M4513R opened this issue Nov 13, 2023 · 11 comments
Labels
2.X 4.X JavaFX Bugs/Quirks related to JFX usage Not a bug, but a question/problem regarding usage

Comments

@C0D3-M4513R
Copy link

C0D3-M4513R commented Nov 13, 2023

Describe the bug
Recaf 2.21.13, latest 3.0.0-SNAPSHOT and recaf-launcher-0.1.3.jar all fail to start Recaf

To Reproduce

Steps to reproduce the behavior:

  1. Be on Nixos
  2. Download any of the versions I talked about
  3. Open a new shell with java inside: nix-shell -p jdk17 openjfx17
  4. Run the recaf jars
  5. See error

Exception

log

Nov 13, 2023 1:41:25 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @66a2429c'
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/user/.openjfx/cache/22-ea+16/amd64/libprism_es2.so: libXxf86vm.so.1: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: /home/user/.openjfx/cache/22-ea+16/amd64/libprism_es2.so: libXxf86vm.so.1: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1953)
        at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:220)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:200)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:142)
        at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:58)
        at com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:63)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:52)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:375)
        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.base/java.lang.Thread.run(Thread.java:833)
Loading library glassgtk3 from resource failed: java.lang.UnsatisfiedLinkError: /home/user/.openjfx/cache/22-ea+16/amd64/libglassgtk3.so: libXtst.so.6: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: /home/user/.openjfx/cache/22-ea+16/amd64/libglassgtk3.so: libXtst.so.6: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1953)
        at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:220)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:200)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:142)
        at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:58)
        at com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(GtkApplication.java:173)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:162)
        at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:40)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:290)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:833)
01:41:26.021 [Main/main] ERROR: Uncaught exception on thread 'main'
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no glassgtk3 in java.library.path: 
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:300)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:292)
        at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
        at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.UnsatisfiedLinkError: no glassgtk3 in java.library.path: 
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
        at java.base/java.lang.System.loadLibrary(System.java:1989)
        at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:170)
        at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:58)
        at com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(GtkApplication.java:173)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:162)
        at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:40)
        at com.sun.glass.ui.Application.run(Application.java:146)
        at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:290)
        ... 6 common frames omitted
Weld SE container recaf shut down by shutdown hook

The core issue here is probably most likely the changes that nix makes to library loading.
Feel free to see this issue as more of a tracking issue.
(I already tried packaging my software for nix, and it wasn't easy)
I made a package request to nix: NixOS/nixpkgs#267124

Screenshots

If applicable, add screenshots to help explain your problem.

@Col-E
Copy link
Owner

Col-E commented Nov 13, 2023

NixOS/nixpkgs#220470

Seems like there was a recent similar issue. It has the same caused by block at the end.

@Col-E Col-E added usage Not a bug, but a question/problem regarding usage JavaFX Bugs/Quirks related to JFX 2.X labels Nov 13, 2023
@C0D3-M4513R
Copy link
Author

I would probably only need to set my LD_LIBRARY_PATH appropriately...
I only need to find the correct folder in almost 10k...
(I only really have to search like 10, and there are tools that can help with even that)

Also this is technically also related to 4.0 as it is a fundamental issue with nix and lib loading. (excluding 3.0 since that never got past snapshots)

@C0D3-M4513R
Copy link
Author

C0D3-M4513R commented Nov 13, 2023

Yep. Can confirm that it launches fine with:
export LD_LIBRARY_PATH="/nix/store/yymhifvd7y7j0iy1m5qqhv5jqh12i7np-libXxf86vm-1.1.5/lib;/nix/store/i7vz86vq34m1rdgc8fnbqzcqp97kj9kz-libX11-1.8.7/lib;/nix/store/qz5n5lpzk4cxvqlvhq2wkxcaz24nypfg-libXtst-1.2.4/lib"

Also these paths might be different for everyone, because of the hashes.
This is NOT a univeral fix, but just a way to get it working temporarily.

I can confirm that recaf 2,3 and 4 all launch with this

Also sidenote: I love the ui updates. v3 felt so much better than v2, and from initial looks that trend continues with v3 to v4.

@C0D3-M4513R
Copy link
Author

C0D3-M4513R commented Nov 13, 2023

Seems like there are still some issues with file dialogues.
https://nixos.wiki/wiki/Packaging/Quirks_and_Caveats#GLib-GIO-Message:_Using_the_.27memory.27_GSettings_backend._Your_settings_will_not_be_saved_or_shared_with

[nix-shell:~]$ java -jar ~/Downloads/recaf-launcher-0.1.3.jar auto
Attempting to resolve installed Recaf version...
Found Recaf's build config, checking contents...
 - MAVEN_GROUP = software.coley
 - MAVEN_NAME = recaf-core
 - VERSION = 4.0.0-SNAPSHOT
 - GIT_REVISION = 1
 - GIT_SHA = 95bfd6142f92fd09493aea916d2a9035c857ce99
 - GIT_DATE = 2023 11/05 05:44
 - GIT_BRANCH = dev4
 - BUILD_DATE = 2023 11/05 05:45
 - BUILD_UNIX_TIME = 1699163124326
 - DIRTY = 0
Attempting to resolve JFX version...
No JavaFX version class found in the current classpath
Java Properties:
 - java.home = /nix/store/swdzzi5k5kcckjb7avpi0aip3hr6i0s6-openjdk-17.0.7+7/lib/openjdk
 - java.version = 17.0.7
 - java.vm.vendor = Oracle Corporation
 - java.vm.version = 17.0.7+7-nixos
 - javafx.platform = linux
 - javafx.version = -1
 - os.arch = amd64
 - os.bitness = 64
 - os.name = Linux
 - os.processors = 12
 - os.version = 6.1.60
 - recaf.version = 4.0.0-SNAPSHOT

JFX cache:
 - Files: 9547119
 - Size:  9547119
Updated to JavaFX '22-ea+16'
Checked for update recently on 2023/11/13 14:43:57, will check again later in 26m 41s
Looking in '/home/user/.config/Recaf' for Recaf/dependencies...
Running Recaf '4.0.0-SNAPSHOT' with JavaFX '22-ea+16:linux'
14:47:16.556 [AccessPatcher/main] DEBUG: Opening access to all packages
14:47:16.569 [AccessPatcher/main] DEBUG: Patching package reflection restrictions
14:47:16.570 [JFXValidation/main] INFO : JavaFX initialized: 22-ea
14:47:16.572 [Bootstrap/main] INFO : Initializing Recaf 4.0.0-SNAPSHOT
14:47:16.572 [Bootstrap/main] INFO : Creating Recaf CDI container...
14:47:16.574 [Bootstrap/main] INFO : CDI: Adding interceptors & extensions
14:47:16.575 [Bootstrap/main] INFO : CDI: Registering bean packages
14:47:16.575 [Bootstrap/main] INFO : CDI: Running user-defined Consumer<Weld>
14:47:16.575 [Bootstrap/main] INFO : CDI: Initializing...
14:47:17.521 [Bootstrap/main] INFO : Recaf CDI container created in 949ms
14:47:17.540 [Main/main] TRACE: Compressing 0 old log files
14:47:17.558 [Lang/main] DEBUG: Found 5 translations
14:47:17.567 [Lang/main] INFO : Loaded translations 'zh_CN'
14:47:17.572 [Lang/main] INFO : Loaded translations 'en_US'
14:47:17.576 [Lang/main] INFO : Loaded translations 'sv_SE'
14:47:17.579 [Lang/main] INFO : Loaded translations 'cs_CZ'
14:47:17.581 [Lang/main] INFO : Loaded translations 'de_DE'
14:47:17.593 [Main/main] INFO : Initialization: No plugins found
Nov 13, 2023 2:47:17 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @66a2429c'
14:47:18.053 [ScriptManager/JavaFX Application Thread] DEBUG: Starting script directory watch task
14:47:18.564 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: system-information
14:47:18.584 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: mapping-progress
14:47:18.586 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: script-manager
14:47:18.596 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: remote-vms
14:47:18.730 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: config
14:47:18.732 [WindowManager/JavaFX Application Thread] DEBUG: Register stage: main
14:47:18.737 [RecafURLStreamHandlerProvider/JavaFX Application Thread] TRACE: Installed Recaf URL stream handler
14:48:25.297 [BasicResourceImporter/path-loader-0] INFO : Reading input from ZIP container 'morejs-forge-1.19.2-0.2.1.jar.disabled'
14:48:25.398 [WorkspaceProcessing/path-loader-0] INFO : Applying workspace processor: Mark throwable types
14:52:49.697 [JavaContextActionSupport/java-parse-0] WARN : Parse error from source of: com/almostreliable/morejs/mixin/enchanting/EnchantmentMenuMixin after 100ms, err=java.lang.StringIndexOutOfBoundsException: String index out of range: 7868
  java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
  java.base/java.lang.String.charAt(String.java:1513)
  org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.arrayDimensions(ReloadableJava17ParserVisitor.java:1515)
  org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariables(ReloadableJava17ParserVisitor.java:1472)
  org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariable(ReloadableJava17ParserVisitor.java:1430)
  org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariable(ReloadableJava17ParserVisitor.java:73)
  com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1045)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
  ...
14:52:55.649 [JPhantomGenerator/recompile-0] DEBUG: Phantom analysis complete, generated 25 classes
14:52:55.650 [JvmDecompilerPane/recompile-0] DEBUG: Generated 25 phantoms for pre-compile
14:54:00.264 [JPhantomGenerator/recompile-0] DEBUG: Phantom analysis complete, generated 25 classes
14:54:00.265 [JvmDecompilerPane/recompile-0] DEBUG: Generated 25 phantoms for pre-compile
14:54:09.605 [JPhantomGenerator/recompile-0] DEBUG: Phantom analysis complete, generated 25 classes
14:54:09.606 [JvmDecompilerPane/recompile-0] DEBUG: Generated 25 phantoms for pre-compile
14:54:16.381 [JPhantomGenerator/recompile-0] DEBUG: Phantom analysis complete, generated 25 classes
14:54:16.381 [JvmDecompilerPane/recompile-0] DEBUG: Generated 25 phantoms for pre-compile

(java:421949): GLib-GIO-ERROR **: 14:55:17.678: No GSettings schemas are installed on the system

[nix-shell:~]$ java -jar ~/Downloads/recaf-2.21.13-J8-jar-with-dependencies.jar 
14:55:58.969 [main] INFO : Recaf-2.21.13
14:55:58.971 [main] INFO : - Java: 17.0.7 (OpenJDK 64-Bit Server VM)
14:55:59.049 [main] TRACE: Loading configuration
Nov 13, 2023 2:55:59 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @66a2429c'

(java:427424): GLib-GIO-ERROR **: 14:56:02.992: No GSettings schemas are installed on the system
Trace/breakpoint trap (core dumped)

@Col-E
Copy link
Owner

Col-E commented Nov 14, 2023

I can't really help with things on the native side of thing for an OS I don't run, but hopefully somebody else may have some valuable insight.

@C0D3-M4513R

This comment was marked as outdated.

@therathatter
Copy link
Contributor

I understand a lot more now, and I understand, that 4.x will (as it stands right now) NEVER be available in NixOs (or at least imo), due to it requiring a wrapping launcher.

The launcher is just used to keep Recaf automatically up to date and to set up JavaFX dependencies, both of which can be done by a package manager. I don't see any reason why it would never be available.

@Col-E
Copy link
Owner

Col-E commented Feb 22, 2024

As Rat said, the launcher just does what a package manager should do. Its for users who are looking for an easy solution that sets itself up and makes updating easy.

Unlike before Recaf will never try to self-inject or manage JavaFx. 4x is probably more ideal than prior versions in this regards.

@Amejonah1200
Copy link
Contributor

Amejonah1200 commented Feb 24, 2024

@Col-E Col-E added the 4.X label Feb 26, 2024
@C0D3-M4513R
Copy link
Author

C0D3-M4513R commented Apr 4, 2024

flake.txt
This flake should do about the same as one of my earlier comments.
It will let you launch recaf in dev mode, thanks to the LD_LIBRARY_PATH.

A ton of lines here are probably unnessesary. I just took something from another project of mine.
I still haven't gotten the file dialoges to work though. Idk how to properly apply the wrapGAppsHook to a jar file.

@C0D3-M4513R
Copy link
Author

@Col-E Can you review #805 when you get the chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.X 4.X JavaFX Bugs/Quirks related to JFX usage Not a bug, but a question/problem regarding usage
Projects
None yet
Development

No branches or pull requests

4 participants