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

macOS m1 failed build #564

Open
kortov opened this issue Apr 5, 2022 · 24 comments
Open

macOS m1 failed build #564

kortov opened this issue Apr 5, 2022 · 24 comments

Comments

@kortov
Copy link
Contributor

kortov commented Apr 5, 2022

I tried to build a project and stumbled upon some problems. Finally I solved them but I want to share this info.
OS: macOS Monterey , MacBook Air M1
I installed tesseract-eng via ports
IDE: Intellij IDEA

  1. master branch can't find dependencies from jcenter (I guess jcenter is shut down)
  2. development branch tries to download tesseract for macosx-null , so I added to ext.targetOSArch "aarch64":"x86_64" (there is no tesseract for m1 at the moment)
  3. at java 17 aarch64 I had 'java.lang.UnsatisfiedLinkError: no lept in java.library.path' so I switched to java 17 x64 and build passed and GUI opened.

You can close this issue if there you find it unrelated

@maximumspatium
Copy link
Contributor

Hi,

master branch can't find dependencies from jcenter (I guess jcenter is shut down)

Yes, JCenter is down. We fixed this issue in the development branch.

development branch tries to download tesseract for macosx-null

null in the architecture postfix means that the corresponding architecture isn't supported in the build script yet. That's easy to add ARM64 though provided all required dependencies are available for the said architecture.

there is no tesseract for m1 at the moment

Why not?

at java 17 aarch64 I had 'java.lang.UnsatisfiedLinkError: no lept in java.library.path' so I switched to java 17 x64 and build passed and GUI opened.

You can run x64 binaries in an ARM laptop?

@kortov
Copy link
Contributor Author

kortov commented Apr 19, 2022

there is no tesseract for m1 at the moment
Why not?

I see no aarch64 artefacts there
image

Execution failed for task ':run'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Could not find tesseract-4.0.0-1.4.4-macosx-aarch64.jar (org.bytedeco.javacpp-presets:tesseract:4.0.0-1.4.4).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/org/bytedeco/javacpp-presets/tesseract/4.0.0-1.4.4/tesseract-4.0.0-1.4.4-macosx-aarch64.jar
   > Could not find leptonica-1.77.0-1.4.4-macosx-aarch64.jar (org.bytedeco.javacpp-presets:leptonica:1.77.0-1.4.4).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/org/bytedeco/javacpp-presets/leptonica/1.77.0-1.4.4/leptonica-1.77.0-1.4.4-macosx-aarch64.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

You can run x64 binaries in an ARM laptop?

Mostly, yes. Thankfully to Rossetta 2, but not any binary. Here are examples https://isapplesiliconready.com/for/unsupported

@kortov
Copy link
Contributor Author

kortov commented Apr 19, 2022

When I switch back to x64, I got this log on start

Mac OS X Adapter could not talk to EAWT:
java.lang.IllegalAccessException: class org.jdesktop.application.utils.OSXAdapter cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @4dca0ecd
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.jdesktop.application.utils.OSXAdapter.setHandler(OSXAdapter.java:140)
	at org.jdesktop.application.utils.OSXAdapter.setQuitHandler(OSXAdapter.java:74)
	at org.jdesktop.application.Application.create(Application.java:257)
	at org.jdesktop.application.Application$1.run(Application.java:185)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

so I added ext.jvmLineArgs = '--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED' to build.gradle then I got

WARN  []            MacApplication 192  | Unable to setup Mac OS X GUI integration
java.lang.NoSuchMethodException: com.apple.eawt.Application.setEnabledAboutMenu(boolean)
	at java.base/java.lang.Class.getMethod(Class.java:2227)
	at org.audiveris.omr.ui.MacApplication.setupMacMenus(MacApplication.java:154)
	at org.audiveris.omr.ui.MainGui.defineMenus(MainGui.java:594)
	at org.audiveris.omr.ui.MainGui.startup(MainGui.java:431)
	at org.jdesktop.application.Application$1.run(Application.java:187)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

I guess awt api for Mac changed dramatically in idk 9, so native macOS GUI integration got broken, but basic functionality should work

@maximumspatium
Copy link
Contributor

I guess awt api for Mac changed dramatically in idk 9, so native macOS GUI integration got broken, but basic functionality should work

That Apple EAWT package is obsolete and scheduled for removal in the next Audiveris' release.

@maximumspatium
Copy link
Contributor

maximumspatium commented Apr 20, 2022

I see no aarch64 artefacts there

Can you take care of getting Javacpp artifacts for Mac ARM64 compiled and uploaded to Maven Central? Javacpp-presets project provides the necessary infrastructure for that. This would be really great! I can't do that because I don't own the corresponding HW.

There is a dedicated issue for Apple Silicon integration: bytedeco/javacpp-presets#1069

@kortov
Copy link
Contributor Author

kortov commented Apr 20, 2022

I'll give it a try, but I haven't done such things, I'm more into java :)

@maximumspatium
Copy link
Contributor

I'll give it a try, but I haven't done such things, I'm more into java :)

I understand. Javacpp-presets is an important project that brings the Java language to a new level by providing C++ interops. Without it machine learning in Java wouldn't be possible.
Samuel Audet provides an excellent support.

@saudet
Copy link

saudet commented May 9, 2022

FYI, macosx-arm64 builds are now available, see issue bytedeco/javacpp-presets#814.
Please give it a try with the snapshots: http://bytedeco.org/builds/

@singingwolfboy
Copy link

I tried to build the latest version of the development branch on my M1 Macbook Pro, and it failed due to missing macosx-arm64 builds. I filed this issue with javacpp-presets, and was told to update to version 1.5.8. I did so, and discovered that the versions of leptonica and tesseract in that version of javacpp-presets are different. So I dutifully updated the versions in the build.gradle file, but the build is still failing due to API changes between the different versions.

If anyone wants to reproduce my work, I've posted it as a GitHub Gist. I'm trying to write a Homebrew formula for Audiveris, so I'm using that for testing. The full error messages that I'm getting are also posted in that Gist.

Is there a way that Audiveris can update to these newer versions of leptonica and tesseract? I have no idea how much work is involved in doing so.

@hbitteur
Copy link
Contributor

@singingwolfboy
I wrote these TesseractOCR and TesseractOrder Java classes a long time ago.
I can try to update them according to API changes, especially Tesseract 5.x version.

Since I have no access to a MacOS environment, I plan to do this work on Windows, with the hope that the same Java code will apply to Mac as well.

Stay tuned...

hbitteur added a commit that referenced this issue May 5, 2023
…ract

	- javacpp set to 1.5.8
	- leptonica set to 1.82.0
	- tesseract set to 5.2.0
	- TesseractOCR and TesseractOrder classes updated to new API
@hbitteur
Copy link
Contributor

hbitteur commented May 5, 2023

@singingwolfboy
I just pushed commit d5b1e05 to development branch.
It uses javacpp 1.5.8, leptonica 1.82.0 and tesseract 5.2.0. Just slight modifications were needed for new API.
This works fine on my Windows environment.

Could you pull again and make sure it's OK also for your Mac environment?

@hbitteur
Copy link
Contributor

hbitteur commented May 6, 2023

@singingwolfboy

I know of Mac users who are reluctant to get into development tools and expect just "plain applications".
Since we have yet no installer for MacOS, I'm wondering if Homebrew could be used for such functionality.

I'm not at all familiar with Homebrew.
According to Wikipedia:

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's operating system, macOS, as well as Linux.

Could you elaborate on this possibility in Audiveris context?
Just my two cents...

@singingwolfboy
Copy link

Could you pull again and make sure it's OK also for your Mac environment?

Using commit 5b8204a, I was able to build and install Audiveris on my M1 Mac, and it runs! Sort of. When I launch the app, it looks like this:
Audiveris screen, no music

When I try to import a PDF of sheet music, it looks like this:
Audiveris screen, attempting to display music

Click here to see the traceback in the terminal
$ audiveris
INFO  []                       CLI 282  | CLI args: []
INFO  []                      Main 402  | Environment:
- Audiveris:    5.3-beta:5b8204a0f
- OS:           Mac OS X 13.3.1
- Architecture: aarch64
- Java VM:      OpenJDK 64-Bit Server VM (build 20.0.1, mixed mode, sharing)
- OCR Engine:   Tesseract OCR, version 5.2.0
INFO  []             AliasPatterns 134  | Alias patterns: [(IMSLP[0-9]*)-.*]
Mac OS X Adapter could not talk to EAWT:
java.lang.IllegalAccessException: class org.jdesktop.application.utils.OSXAdapter cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @3f3e6f71
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:709)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:493)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
	at org.jdesktop.application.utils.OSXAdapter.setHandler(OSXAdapter.java:140)
	at org.jdesktop.application.utils.OSXAdapter.setQuitHandler(OSXAdapter.java:74)
	at org.jdesktop.application.Application.create(Application.java:257)
	at org.jdesktop.application.Application$1.run(Application.java:185)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
INFO  []                   MainGui 573  | Audiveris version 5.3-beta
INFO  []                   MainGui 574  | 
LogUtil. Property logback.configurationFile not defined, skipped.
LogUtil. No /Users/singingwolfboy/Library/Application Support/AudiverisLtd/audiveris/logback.xml, skipped.
LogUtil. Configuration found jar:file:/opt/homebrew/Cellar/audiveris/5.3-beta/libexec/audiveris.jar!/res/logback.xml
LogUtil. Logging to /Users/singingwolfboy/Library/AudiverisLtd/audiveris/log/20230506T092701.log

INFO [] PluginsManager 210 | No /Users/singingwolfboy/Library/Application Support/AudiverisLtd/audiveris/plugins.xml file found
INFO [] BasicClassifier 277 | Classifier loaded XML norms.
INFO [] AbstractClassifier 396 | Classifier data loaded from default uri jar:file:/opt/homebrew/Cellar/audiveris/5.3-beta/libexec/audiveris.jar!/res/basic-classifier.zip
WARN [] MacApplication 235 | Unable to setup Mac OS X GUI integration
java.lang.IllegalAccessException: class org.audiveris.omr.ui.MacApplication cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @3f3e6f71
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:709)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:493)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:304)
at java.base/java.lang.Class.newInstance(Class.java:685)
at org.audiveris.omr.ui.MacApplication.setupMacMenus(MacApplication.java:196)
at org.audiveris.omr.ui.MainGui.defineMenus(MainGui.java:301)
at org.audiveris.omr.ui.MainGui.startup(MainGui.java:589)
at org.jdesktop.application.Application$1.run(Application.java:187)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
INFO [] Versions 301 | Versions. Poll frequency: Weekly, next poll on: 05-May-2023
INFO [] Versions 397 | Software version is up-to-date
2023-05-06 09:29:57.875 java[76701:1265930] +[CATransaction synchronize] called within transaction
2023-05-06 09:29:58.001 java[76701:1265930] +[CATransaction synchronize] called within transaction
INFO [] Book 587 | 10 sheets in /Users/singingwolfboy/Dropbox/AMSGMC-music/Arcade.pdf
WARN [Arcade#1] SheetStub 1308 | Error in performing [LOAD, BINARY] java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:555)
at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:1292)
at org.audiveris.omr.sheet.ui.StubsController.checkStubStatus(StubsController.java:265)
at org.audiveris.omr.sheet.ui.StubsController.lambda$display$1(StubsController.java:354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.ExceptionInInitializerError: null
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLibrary(FreetypeFontFactory.java:64)
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.createPlatformFont(FreetypeFontFactory.java:135)
at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(CSPlatformDevice.java:755)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(CSDeviceBasedInterpreter.java:762)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:238)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:206)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(CSDeviceBasedInterpreter.java:195)
at org.audiveris.omr.image.ImageLoading$JPodLoader.getImage(ImageLoading.java:403)
at org.audiveris.omr.sheet.Book.loadSheetImage(Book.java:1804)
at org.audiveris.omr.step.LoadStep.doit(LoadStep.java:73)
at org.audiveris.omr.step.OmrStep.doit(OmrStep.java:138)
at org.audiveris.omr.sheet.SheetStub.lambda$doOneStep$2(SheetStub.java:540)
... 4 common frames omitted
Caused by: java.lang.NullPointerException: no native interface available
at de.intarsys.nativec.api.NativeInterface.set(NativeInterface.java:104)
at de.intarsys.nativec.api.NativeInterface.get(NativeInterface.java:93)
at de.intarsys.cwt.freetype.nativec._FTNI.init(_FTNI.java:127)
at de.intarsys.cwt.freetype.nativec._FTNI.(_FTNI.java:88)
at de.intarsys.cwt.freetype.Freetype.(Freetype.java:99)
... 16 common frames omitted
WARN [Arcade#2] SheetStub 1308 | Error in performing [LOAD, BINARY] java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:555)
at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:1292)
at org.audiveris.omr.sheet.ui.StubsController.checkStubStatus(StubsController.java:265)
at org.audiveris.omr.sheet.ui.StubsController.lambda$display$1(StubsController.java:354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLibrary(FreetypeFontFactory.java:64)
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.createPlatformFont(FreetypeFontFactory.java:135)
at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(CSPlatformDevice.java:755)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(CSDeviceBasedInterpreter.java:762)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:238)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:206)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(CSDeviceBasedInterpreter.java:195)
at org.audiveris.omr.image.ImageLoading$JPodLoader.getImage(ImageLoading.java:403)
at org.audiveris.omr.sheet.Book.loadSheetImage(Book.java:1804)
at org.audiveris.omr.step.LoadStep.doit(LoadStep.java:73)
at org.audiveris.omr.step.OmrStep.doit(OmrStep.java:138)
at org.audiveris.omr.sheet.SheetStub.lambda$doOneStep$2(SheetStub.java:540)
... 4 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NullPointerException: no native interface available [in thread "cachedLow-thread-4"]
at de.intarsys.nativec.api.NativeInterface.set(NativeInterface.java:104)
at de.intarsys.nativec.api.NativeInterface.get(NativeInterface.java:93)
at de.intarsys.cwt.freetype.nativec._FTNI.init(_FTNI.java:127)
at de.intarsys.cwt.freetype.nativec._FTNI.(_FTNI.java:88)
at de.intarsys.cwt.freetype.Freetype.(Freetype.java:99)
... 16 common frames omitted
WARN [Arcade#3] SheetStub 1308 | Error in performing [LOAD, BINARY] java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:555)
at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:1292)
at org.audiveris.omr.sheet.ui.StubsController.checkStubStatus(StubsController.java:265)
at org.audiveris.omr.sheet.ui.StubsController.lambda$display$1(StubsController.java:354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLibrary(FreetypeFontFactory.java:64)
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.createPlatformFont(FreetypeFontFactory.java:135)
at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(CSPlatformDevice.java:755)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(CSDeviceBasedInterpreter.java:762)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:238)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:206)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(CSDeviceBasedInterpreter.java:195)
at org.audiveris.omr.image.ImageLoading$JPodLoader.getImage(ImageLoading.java:403)
at org.audiveris.omr.sheet.Book.loadSheetImage(Book.java:1804)
at org.audiveris.omr.step.LoadStep.doit(LoadStep.java:73)
at org.audiveris.omr.step.OmrStep.doit(OmrStep.java:138)
at org.audiveris.omr.sheet.SheetStub.lambda$doOneStep$2(SheetStub.java:540)
... 4 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NullPointerException: no native interface available [in thread "cachedLow-thread-4"]
at de.intarsys.nativec.api.NativeInterface.set(NativeInterface.java:104)
at de.intarsys.nativec.api.NativeInterface.get(NativeInterface.java:93)
at de.intarsys.cwt.freetype.nativec._FTNI.init(_FTNI.java:127)
at de.intarsys.cwt.freetype.nativec._FTNI.(_FTNI.java:88)
at de.intarsys.cwt.freetype.Freetype.(Freetype.java:99)
... 16 common frames omitted
WARN [Arcade#2] SheetStub 1308 | Error in performing [LOAD, BINARY] java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:555)
at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:1292)
at org.audiveris.omr.sheet.ui.StubsController.checkStubStatus(StubsController.java:265)
at org.audiveris.omr.sheet.ui.StubsController.lambda$display$1(StubsController.java:354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLibrary(FreetypeFontFactory.java:64)
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.createPlatformFont(FreetypeFontFactory.java:135)
at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(CSPlatformDevice.java:755)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(CSDeviceBasedInterpreter.java:762)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:238)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:206)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(CSDeviceBasedInterpreter.java:195)
at org.audiveris.omr.image.ImageLoading$JPodLoader.getImage(ImageLoading.java:403)
at org.audiveris.omr.sheet.Book.loadSheetImage(Book.java:1804)
at org.audiveris.omr.step.LoadStep.doit(LoadStep.java:73)
at org.audiveris.omr.step.OmrStep.doit(OmrStep.java:138)
at org.audiveris.omr.sheet.SheetStub.lambda$doOneStep$2(SheetStub.java:540)
... 4 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NullPointerException: no native interface available [in thread "cachedLow-thread-4"]
at de.intarsys.nativec.api.NativeInterface.set(NativeInterface.java:104)
at de.intarsys.nativec.api.NativeInterface.get(NativeInterface.java:93)
at de.intarsys.cwt.freetype.nativec._FTNI.init(_FTNI.java:127)
at de.intarsys.cwt.freetype.nativec._FTNI.(_FTNI.java:88)
at de.intarsys.cwt.freetype.Freetype.(Freetype.java:99)
... 16 common frames omitted
WARN [Arcade#1] SheetStub 1308 | Error in performing [LOAD, BINARY] java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:555)
at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:1292)
at org.audiveris.omr.sheet.ui.StubsController.checkStubStatus(StubsController.java:265)
at org.audiveris.omr.sheet.ui.StubsController.lambda$display$1(StubsController.java:354)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class de.intarsys.cwt.freetype.Freetype
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLibrary(FreetypeFontFactory.java:64)
at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.createPlatformFont(FreetypeFontFactory.java:135)
at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(CSPlatformDevice.java:755)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(CSDeviceBasedInterpreter.java:762)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:238)
at de.intarsys.pdf.content.CSInterpreter.process(CSInterpreter.java:206)
at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(CSDeviceBasedInterpreter.java:195)
at org.audiveris.omr.image.ImageLoading$JPodLoader.getImage(ImageLoading.java:403)
at org.audiveris.omr.sheet.Book.loadSheetImage(Book.java:1804)
at org.audiveris.omr.step.LoadStep.doit(LoadStep.java:73)
at org.audiveris.omr.step.OmrStep.doit(OmrStep.java:138)
at org.audiveris.omr.sheet.SheetStub.lambda$doOneStep$2(SheetStub.java:540)
... 4 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NullPointerException: no native interface available [in thread "cachedLow-thread-4"]
at de.intarsys.nativec.api.NativeInterface.set(NativeInterface.java:104)
at de.intarsys.nativec.api.NativeInterface.get(NativeInterface.java:93)
at de.intarsys.cwt.freetype.nativec._FTNI.init(_FTNI.java:127)
at de.intarsys.cwt.freetype.nativec._FTNI.(_FTNI.java:88)
at de.intarsys.cwt.freetype.Freetype.(Freetype.java:99)
... 16 common frames omitted

It appears that there are a few other Java libraries that have problems running on a Mac, and I have no idea of these libraries have any fixes/updates available. Based on a quick web search, it appears that these libraries haven't been updated in years, so they probably are abandoned. ☹️

Since we have yet no installer for MacOS, I'm wondering if Homebrew could be used for such functionality.

Yes! If we manage to get Audiveris packaged in Homebrew, then in order to install it, a Mac user would simply need to run brew install audiveris, and Homebrew would take care of installing all of Audiveris and all of its dependencies. Once that process is done, a user would run audiveris and the application would launch, ready to use! It might even be possible to install a "plain app" that a user can double-click to launch, rather than running a command from the terminal, but let's focus on getting the terminal functionality working first -- if it's even possible to do so, considering the broken libraries I mentioned above.

@hbitteur
Copy link
Contributor

hbitteur commented May 6, 2023

The lines that appear in log window, located at the bottom of Audiveris main window, are just short messages, for example to signal that an exception has been raised.
Could you have a look at the log file itself (or the terminal from which you launched Audiveris).
Path to the log file appears at the very beginning of Audiveris messages. In your case, log files are in /Users/singingwolfboy/Library/AudiverisLtd/audiveris/log folder.

Generally there is a stack dump for every exception raised, giving more information about the root causes.

@hbitteur
Copy link
Contributor

hbitteur commented May 6, 2023

Oops, sorry!
I hadn't noticed your hyperlink to the stack dump.

@hbitteur
Copy link
Contributor

hbitteur commented May 6, 2023

I noticed this line in your stack dump:

java.lang.IllegalAccessException: class org.audiveris.omr.ui.MacApplication cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @3f3e6f71

This reminds me of illegal accesses that occurred with Java 9 and above, due to Jigsaw
You could try to explicitly allow the access.

For example, look at lines 45/46 in build.gradle file:

// To circumvent limitations brought by Jigsaw
applicationDefaultJvmArgs = ["--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED"]

Perhaps you could add an arg like "--add-exports=com.apple.eawt=ALL-UNNAMED"
[update]: or rather "--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED"

@maximumspatium
Copy link
Contributor

@singingwolfboy It looks like you're missing Freetype library JPodRenderer needs for rasterizing PDFs. Freetype is a native dependency meaning it needs to be compiled from C sources and placed to some predefined location in order to be accessible for the Java Virtual Machine.
The authors of the JPodRenderer software assumed that a system wide Freetype library is already installed in a Linux like system while for Windows a drop-in library (Intel x86 DLL) is provided. In other words, the JPodRenderer component has an undeclared native dependency that the Gradle package manager can't satisfy because it knows nothing about it. The only way to currently deal with this kind of broken packaging is to install Freetype manually using Homebrew/Macports. A proper Audiveris packaging including all required dependencies is therefore more than desirable...

@singingwolfboy
Copy link

It looks like you're missing Freetype library JPodRenderer needs for rasterizing PDFs.

Freetype is installed on my system already, but JPodRenderer probably doesn't know where to find it. On M1 Macs, Homebrew uses /opt/homebrew as its install prefix; the Freetype library is available at /opt/homebrew/lib/libfreetype.dylib on my computer. How do I tell JPodRenderer where to find it?

@hbitteur
Copy link
Contributor

hbitteur commented May 8, 2023

@maximumspatium Your message got into my mail box at 1:44 in the morning. What do you do in the middle of the night?!! :-)

@maximumspatium
Copy link
Contributor

How do I tell JPodRenderer where to find it?

Symlink in /usr/lib that points to /opt/homebrew/lib/libfreetype.dylib maybe?

@singingwolfboy
Copy link

Symlink in /usr/lib that points to /opt/homebrew/lib/libfreetype.dylib maybe?

I was not able to do that -- macOS System Integrity Protection prevents any modification of the /usr/lib directory, even when using sudo. However, I discovered that there was already a symlink in /usr/local/lib, presumably installed by Homebrew. I verified that JPodRenderer is still not able to find/use this symlink to load Freetype.

Any other suggestions?

@hbitteur
Copy link
Contributor

Is there any progress on this issue?
If not, should we close it?

@singingwolfboy
Copy link

I haven't made any progress. However, I'm not sure closing it is the best option; this is still a problem on macOS, and leaving the issue open might allow others to find it more easily.

@hbitteur
Copy link
Contributor

OK, let's keep it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants