deltacv / EOCV-Sim

Develop, test, and tune your EasyOpenCV pipelines directly on your computer with a simple GUI !
https://deltacv.gitbook.io/eocv-sim/
MIT License
51 stars 18 forks source link

MacOS M1 crashes on launch #63

Closed js802025 closed 2 years ago

js802025 commented 2 years ago

This error is thrown on launch:

/--------------------------------\

  EOCV-Sim v3.3.1 crash report

\--------------------------------/

: Crash stacktrace

java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat()'
    at org.opencv.core.Mat.n_Mat(Native Method)
    at org.opencv.core.Mat.<init>(Mat.java:23)
    at com.github.serivesmejia.eocvsim.input.InputSourceManager.init(InputSourceManager.java:67)
    at com.github.serivesmejia.eocvsim.EOCVSim.init(EOCVSim.kt:157)
    at com.github.serivesmejia.eocvsim.EOCVSimCommandInterface.run(Main.kt:65)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at com.github.serivesmejia.eocvsim.Main.main(Main.kt:17)

==========================================

: EOCV-Sim info
   Version: 3.3.1
   Built on: 2021-10-26 05:44:22

: System specs
   OS name: Mac OS X
   OS version: 11.3.1
   Detected OS: MACOS
   Architecture: aarch64
   Java version: 17.0.1
   Java vendor: Oracle Corporation
   Last memory usage: 20 MB

==========================================

: Full thread dump

 > Thread "main"
     java.base@17.0.1/java.lang.Thread.dumpThreads(Native Method)
     java.base@17.0.1/java.lang.Thread.getAllStackTraces(Thread.java:1662)
     app//com.github.serivesmejia.eocvsim.util.exception.handling.CrashReport.<init>(CrashReport.kt:78)
     app//com.github.serivesmejia.eocvsim.util.exception.handling.EOCVSimUncaughtExceptionHandler.uncaughtException(EOCVSimUncaughtExceptionHandler.kt:38)
     java.base@17.0.1/java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1082)
     java.base@17.0.1/java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1077)
     java.base@17.0.1/java.lang.Thread.dispatchUncaughtException(Thread.java:2008)
 > Thread "AppKit Thread"
 > Thread "AWT-EventQueue-0"
     java.base@17.0.1/java.lang.Class.initClassName(Native Method)
     java.base@17.0.1/java.lang.Class.getName(Class.java:863)
     java.base@17.0.1/java.lang.Class.getPackageName(Class.java:1082)
     java.base@17.0.1/jdk.internal.reflect.Reflection.verifyModuleAccess(Reflection.java:243)
     java.base@17.0.1/jdk.internal.reflect.Reflection.verifyMemberAccess(Reflection.java:141)
     java.base@17.0.1/java.lang.reflect.AccessibleObject.slowVerifyAccess(AccessibleObject.java:715)
     java.base@17.0.1/java.lang.reflect.AccessibleObject.verifyAccess(AccessibleObject.java:701)
     java.base@17.0.1/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:673)
     java.base@17.0.1/java.lang.reflect.Method.invoke(Method.java:560)
     app//com.github.serivesmejia.eocvsim.gui.util.ReflectTaskbar.isTaskbarSupported(ReflectTaskbar.kt:20)
     app//com.github.serivesmejia.eocvsim.gui.util.ReflectTaskbar$isUsable$2.invoke(ReflectTaskbar.kt:17)
     app//com.github.serivesmejia.eocvsim.gui.util.ReflectTaskbar$isUsable$2.invoke(ReflectTaskbar.kt:15)
     app//kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
     app//com.github.serivesmejia.eocvsim.gui.util.ReflectTaskbar.isUsable(ReflectTaskbar.kt:15)
     app//com.github.serivesmejia.eocvsim.gui.Visualizer.init(Visualizer.java:97)
     app//com.github.serivesmejia.eocvsim.gui.Visualizer.lambda$initAsync$0(Visualizer.java:226)
     app//com.github.serivesmejia.eocvsim.gui.Visualizer$$Lambda$228/0x0000000800e1fcd8.run(Unknown Source)
     java.desktop@17.0.1/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
     java.desktop@17.0.1/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
     java.desktop@17.0.1/java.awt.EventQueue$4.run(EventQueue.java:722)
     java.desktop@17.0.1/java.awt.EventQueue$4.run(EventQueue.java:716)
     java.base@17.0.1/java.security.AccessController.executePrivileged(AccessController.java:776)
     java.base@17.0.1/java.security.AccessController.doPrivileged(AccessController.java:399)
     java.base@17.0.1/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
     java.desktop@17.0.1/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
     java.desktop@17.0.1/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
     java.desktop@17.0.1/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
     java.desktop@17.0.1/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
     java.desktop@17.0.1/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
     java.desktop@17.0.1/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
     java.desktop@17.0.1/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
 > Thread "Reference Handler"
     java.base@17.0.1/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
     java.base@17.0.1/java.lang.ref.Reference.processPendingReferences(Reference.java:253)
     java.base@17.0.1/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:215)
 > Thread "Java2D Queue Flusher"
     java.base@17.0.1/java.lang.Object.wait(Native Method)
     java.desktop@17.0.1/sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(OGLRenderQueue.java:206)
     java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
 > Thread "Signal Dispatcher"
 > Thread "DefaultDispatcher-worker-3"
     java.base@17.0.1/jdk.internal.misc.Unsafe.park(Native Method)
     java.base@17.0.1/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:376)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.park(CoroutineScheduler.kt:795)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.tryPark(CoroutineScheduler.kt:740)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:711)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
 > Thread "Notification Thread"
 > Thread "Common-Cleaner"
     java.base@17.0.1/java.lang.Object.wait(Native Method)
     java.base@17.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
     java.base@17.0.1/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:140)
     java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
     java.base@17.0.1/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:162)
 > Thread "AWT-Shutdown"
     java.base@17.0.1/java.lang.Object.wait(Native Method)
     java.base@17.0.1/java.lang.Object.wait(Object.java:338)
     java.desktop@17.0.1/sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:291)
     java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
 > Thread "Java2D Disposer"
     java.base@17.0.1/java.lang.Object.wait(Native Method)
     java.base@17.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
     java.base@17.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
     java.desktop@17.0.1/sun.java2d.Disposer.run(Disposer.java:145)
     java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
 > Thread "DefaultDispatcher-worker-1"
     java.base@17.0.1/java.lang.ClassLoader.defineClass1(Native Method)
     java.base@17.0.1/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
     java.base@17.0.1/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
     java.base@17.0.1/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
     java.base@17.0.1/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
     java.base@17.0.1/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
     java.base@17.0.1/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
     java.base@17.0.1/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
     java.base@17.0.1/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
     app//io.github.classgraph.Scanner.<init>(Scanner.java:161)
     app//io.github.classgraph.ClassGraph.scanAsync(ClassGraph.java:1495)
     app//io.github.classgraph.ClassGraph.scanAsync(ClassGraph.java:1523)
     app//io.github.classgraph.ClassGraph.scan(ClassGraph.java:1548)
     app//io.github.classgraph.ClassGraph.scan(ClassGraph.java:1587)
     app//io.github.classgraph.ClassGraph.scan(ClassGraph.java:1600)
     app//com.github.serivesmejia.eocvsim.util.ClasspathScan.scan(ClasspathScan.kt:45)
     app//com.github.serivesmejia.eocvsim.util.ClasspathScan$asyncScan$1.invokeSuspend(ClasspathScan.kt:109)
     app//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
     app//kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
 > Thread "FileWatcher-Workspace"
     java.base@17.0.1/java.lang.Thread.sleep(Native Method)
     app//com.github.serivesmejia.eocvsim.util.io.FileWatcher$Runner.run(FileWatcher.kt:68)
     java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
 > Thread "Finalizer"
     java.base@17.0.1/java.lang.Object.wait(Native Method)
     java.base@17.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
     java.base@17.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
     java.base@17.0.1/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:172)
 > Thread "DefaultDispatcher-worker-2"
     java.base@17.0.1/jdk.internal.misc.Unsafe.park(Native Method)
     java.base@17.0.1/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:376)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.park(CoroutineScheduler.kt:795)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.tryPark(CoroutineScheduler.kt:740)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:711)
     app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

==================================

: Full logs

00:00  INFO: [LockFile] Probably locked file /Users/jackadee/.eocvsim/.lock
00:00  INFO: [EOCVSim] Confirmed claiming of the lock file in /Users/jackadee/.eocvsim

00:00  INFO: [EOCVSim] Initializing EasyOpenCV Simulator v3.3.1 (2bbaf4f0)

00:00  INFO: [EOCVSim] Loading native lib...
00:00 ERROR: [EOCVSim] Failure loading native lib
java.lang.ExceptionInInitializerError
    at nu.pattern.OpenCV$LocalLoader.getInstance(OpenCV.java:340)
    at nu.pattern.OpenCV.loadLocally(OpenCV.java:323)
    at com.github.serivesmejia.eocvsim.EOCVSim$Companion.loadOpenCvLib(EOCVSim.kt:75)
    at com.github.serivesmejia.eocvsim.EOCVSim.init(EOCVSim.kt:146)
    at com.github.serivesmejia.eocvsim.EOCVSimCommandInterface.run(Main.kt:65)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at com.github.serivesmejia.eocvsim.Main.main(Main.kt:17)
Caused by: nu.pattern.OpenCV$UnsupportedPlatformException: Operating system "OSX" and architecture "ARMv8" are not supported.
    at nu.pattern.OpenCV.extractNativeBinary(OpenCV.java:381)
    at nu.pattern.OpenCV.extractNativeBinary(OpenCV.java:350)
    at nu.pattern.OpenCV.access$100(OpenCV.java:23)
    at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:329)
    at nu.pattern.OpenCV$LocalLoader.<init>(OpenCV.java:326)
    at nu.pattern.OpenCV$LocalLoader$Holder.<clinit>(OpenCV.java:336)
    ... 13 more
00:00  INFO: [EOCVSim] Retrying with old method...
00:00  INFO: [SysUtil] Downloading native lib from https://github.com/serivesmejia/OpenCVNativeLibs/raw/master/mac64_opencv_java451.dylib
00:00  INFO: [Icons] Loading future icon ico_eocvsim

00:00  INFO: [SysUtil] Loading native lib "mac64_opencv_java451.dylib"
00:00 ERROR: [SysUtil] Failure loading lib "mac64_opencv_java451", retrying with different architecture... (0 attempts)
00:00  INFO: [SysUtil] Downloading native lib from https://github.com/serivesmejia/OpenCVNativeLibs/raw/master/mac32_opencv_java451.dylib

00:00  INFO: [SysUtil] Loading native lib "mac32_opencv_java451.dylib"
00:00 ERROR: [SysUtil] Failure loading lib "mac32_opencv_java451", retrying with different architecture... (1 attempts)
00:00  INFO: [SysUtil] Downloading native lib from https://github.com/serivesmejia/OpenCVNativeLibs/raw/master/mac64_opencv_java451.dylib

00:01  INFO: [SysUtil] Loading native lib "mac64_opencv_java451.dylib"
00:01 ERROR: [SysUtil] Failure loading lib "mac64_opencv_java451", retrying with different architecture... (2 attempts)
00:01  INFO: [SysUtil] Downloading native lib from https://github.com/serivesmejia/OpenCVNativeLibs/raw/master/mac32_opencv_java451.dylib

00:01  INFO: [SysUtil] Loading native lib "mac32_opencv_java451.dylib"
00:01 ERROR: [SysUtil] Failure loading lib "mac32_opencv_java451", retrying with different architecture... (3 attempts)
00:01  INFO: [SysUtil] Downloading native lib from https://github.com/serivesmejia/OpenCVNativeLibs/raw/master/mac64_opencv_java451.dylib

00:01  INFO: [SysUtil] Loading native lib "mac64_opencv_java451.dylib"
00:01 ERROR: [SysUtil] Failure loading lib "mac64_opencv_java451" 4 times, giving up.

00:01  INFO: [ConfigManager] Initializing...
00:01  INFO: [ConfigManager] Loaded config from file successfully

00:01  INFO: [WorkspaceManager] Set current workspace to /Users/jackadee/.eocvsim/default_workspace
00:01  INFO: [WorkspaceManager] Loaded workspace config successfully
00:01  INFO: [ClasspathScan] Starting to scan classpath...
00:01  INFO: [FileWatcher-Workspace] Starting to watch directories in:
/Users/jackadee/.eocvsim/default_workspace
/Users/jackadee/.eocvsim/default_workspace

00:01  INFO: [WorkspaceManager] Loaded workspace config successfully

00:01  INFO: [InputSourceManager] Initializing...
00:01 ERROR: [EOCVSimUncaughtExceptionHandler] Uncaught exception thrown in "main" thread
java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_Mat()'
    at org.opencv.core.Mat.n_Mat(Native Method)
    at org.opencv.core.Mat.<init>(Mat.java:23)
    at com.github.serivesmejia.eocvsim.input.InputSourceManager.init(InputSourceManager.java:67)
    at com.github.serivesmejia.eocvsim.EOCVSim.init(EOCVSim.kt:157)
    at com.github.serivesmejia.eocvsim.EOCVSimCommandInterface.run(Main.kt:65)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at com.github.serivesmejia.eocvsim.Main.main(Main.kt:17)

;
serivesmejia commented 2 years ago

We do not currently support M1 natively as you can see on the logs, though I believe someone in the FTC discord had success using a x86 jvm from rosetta and running eocv sim from that. I'm not 100% sure how that works as I'm not really familiar with macos at all but perhaps it could work. I believe it was @shaunsingh, it would be appreciated if you could help us here :)

(sorry for the delay btw)

shaunsingh commented 2 years ago

I do use an m1 machine. I don't exactly remember what I did to get it working

Operating system "OSX" and architecture "ARMv8" are not supported.

I believe you're using a native build of the java jdk, i.e. one built from arm64. The project is attempting to download a version of opencv for x86, which obviously won't work.

You could try two things:

  1. building opencv with java support using homebrew, then pointing it to use that .dylib (instructions here: https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#install-opencv-3-x-under-macos)
  2. Installing a version of the java jdk built for x86 macOS, and running it using rosetta

Option one is more complicated but the resulting opencv will run faster, although with how optimized eocv sim is nowadays don't think it matters much :p

js802025 commented 2 years ago

I got it working with another M1 that had 86 java so I think your right. Thanks!

Sent from my iPhone

On Nov 2, 2021, at 5:08 PM, shaunsingh @.***> wrote:

 I do use an m1 machine. I don't exactly remember what I did to get it working

Operating system "OSX" and architecture "ARMv8" are not supported.

I believe you're using a native build of the java jdk, i.e. one built from arm64. The project is attempting to download a version of opencv for x86, which obviously won't work.

You could try two things:

building opencv with java support using homebrew, then pointing it to use that .dylib (instructions here: https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#install-opencv-3-x-under-macos) Installing a version of the java jdk built for x86 macOS, and running it using rosetta Option one is more complicated but the resulting opencv will run faster, although with how optimized eocv sim is nowadays don't think it matters much :p

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

serivesmejia commented 2 years ago

Glad you figured out :), we will see if we can get native m1 support in the future. Feel free to make a new issue if you stumble upon other errors as i haven't had much opportunity to test in Mac