PNG-Upscale icon indicating copy to clipboard operation
PNG-Upscale copied to clipboard

Load button not working under MacOS Monterey (LWJGL failing to load a library?)

Open not-nullptr opened this issue 3 years ago • 9 comments

not-nullptr avatar Jan 27 '22 12:01 not-nullptr

same issue on xubuntu 20.04, fails with: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.so the library is present on the system.

scarlett-blake avatar Feb 16 '22 19:02 scarlett-blake

I have the same issue on MacOS Catalina 10.15.7 after trying to build the project myself. Using Java 15.0.2, Maven 3.8.5, and the following:


mvn -Djavacpp.platform=macosx-x86_64 -Dlwjgl.natives=natives-macos clean package
java -jar target/png-upscale-1.0-jar-with-dependencies.jar

Then clicking the 'Load' button causes the following 'NSInternalInconsistencyException' exception:

Error Message

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff33ac9627 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6ca995bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff33af1e0c -[NSException raise] + 9
	3   AppKit                              0x00007fff30cec5ec -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
	4   AppKit                              0x00007fff30cd4052 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
	5   AppKit                              0x00007fff30eb4db5 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
	6   AppKit                              0x00007fff30cd3ac3 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
	7   AppKit                              0x00007fff30eb4d6a -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
	8   AppKit                              0x00007fff316b22d6 -[NSSavePanel initWithContentRect:styleMask:backing:defer:] + 97
	9   AppKit                              0x00007fff316ba582 -[NSOpenPanel initWithContentRect:styleMask:backing:defer:] + 151
	10  AppKit                              0x00007fff31011392 -[NSPanel init] + 75
	11  AppKit                              0x00007fff316b226e -[NSSavePanel init] + 80
	12  AppKit                              0x00007fff313cf96b +[NSSavePanel(Instantiation) _crunchyRawUnbonedPanel] + 74
	13  liblwjgl_nfd.dylib                  0x00000001aa3bad76 liblwjgl_nfd.dylib + 3446
	14  ???                                 0x00000001102e453a 0x0 + 4566435130
)
libc++abi.dylib: terminating with uncaught exception of type NSException

This seems potentially relevant to a similar issue https://github.com/adoptium/adoptium-support/issues/101 potentially related to compatibility with MacOS.

Slanman3755 avatar May 31 '22 18:05 Slanman3755

idk what is this error, but is the "lwjgl, lwjgl-utils, lwjgl-platform" libraries loaded in built path/configure build path/libraries?

Gamer069 avatar Aug 01 '22 19:08 Gamer069

Yeah, the load button doesn't work for me on macOS Monterey 12.6

NAICOLAS avatar Sep 24 '22 08:09 NAICOLAS

according to https://hub.jmonkeyengine.org/t/macos-nswindow-drag-regions-should-only-be-invalidated-on-the-main-thread/43523/2 it's necessary -XstartOnFirstThread for running lwjgl on mac. but -XstartOnFirstThread kills the swing.

so i used rococoa like https://github.com/umjammer/vavi-image-filter-dnnsuperres/blob/1.0.1/src/test/java/com/github/araxeus/dnnsuperres/MainApp.java#L419-L451 it works on my env

$ uname -a                                                                                                                                                                                                      0.2.5
Darwin nsanomac4 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:45 PDT 2022; root:xnu-7195.141.29~1/RELEASE_X86_64 x86_64
$ java -version                                                                                                                                                                                                 0.2.5
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

lwjgl needs to run on main thread in brief.

BUT is it really needed to use lwjgl in the first place? this project used lwjgl for the native looking file chooser only. afaik awt file chooser has nearly native file chooser looking, isn't it?

umjammer avatar Oct 16 '22 03:10 umjammer

BUT is it really needed to use lwjgl in the first place? this project used lwjgl for the native looking file chooser only. afaik awt file chooser has nearly native file chooser looking, isn't it?

Well I'm on win10 and the JFileChooser is pretty ugly and doesn't resemble the native one. when I made this program I wanted the file chooser to feel good and lwjgl had the most complete native file chooser that I could find

Araxeus avatar Oct 20 '22 18:10 Araxeus

sorry, i mean not swing JFileChooser but awt FileDialog (i pasted mistaken url...) of cause i know the swing file chooser is different from the native one.

umjammer avatar Oct 20 '22 18:10 umjammer

Its still not very pretty and doesn't really look like the native one ^-^

Araxeus avatar Oct 20 '22 19:10 Araxeus

oh that make sense 👍

umjammer avatar Oct 20 '22 19:10 umjammer