Boomaa23 / open-ds

A reverse-engineered lightweight cross-platform FRC Driver Station
https://boomaa23.github.io/open-ds/
Other
42 stars 8 forks source link

Issue with Running on Arm #10

Closed srimanachanta closed 2 years ago

srimanachanta commented 2 years ago

When executing jar file with java -jar open-ds-v0.2.2.jar I get the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/qd/13b4hpw17r1_jj9k9qr99l_00000gn/T/ods-input-osx.jnilib: dlopen(/private/var/folders/qd/13b4hpw17r1_jj9k9qr99l_00000gn/T/ods-input-osx.jnilib, 0x0001): tried: '/private/var/folders/qd/13b4hpw17r1_jj9k9qr99l_00000gn/T/ods-input-osx.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/ods-input-osx.jnilib' (no such file)
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170)
    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.boomaa.opends.util.Libraries.init(Libraries.java:45)
    at com.boomaa.opends.display.DisplayEndpoint.main(DisplayEndpoint.java:135)

macOS 12.2 on Macbook Pro 2020 with M1 chip (ARM64)

Boomaa23 commented 2 years ago

Ah okay an M1 Mac. I don't have access to an M1 Mac at the moment so this might be a while, but I will look into it.

Boomaa23 commented 2 years ago

Alright I believe this just needs someone with an M1 mac to recompile the macOS natives (this script) then I need to write a small addition to the native loader code that will detect an M1 vs x86 mac and load the appropriate binary.

srimanachanta commented 2 years ago

Alright I believe this just needs someone with an M1 mac to recompile the macOS natives (this script) then I need to write a small addition to the native loader code that will detect an M1 vs x86 mac and load the appropriate binary.

My Results:

clang: error: no such file or directory: 'com_boomaa_opends_usb_IOKit.c'
clang: error: no such file or directory: 'com_boomaa_opends_usb_IOKitDevice.c'
clang: error: no input files
clang: error: no such file or directory: 'com_boomaa_opends_usb_IOKit.o'
clang: error: no such file or directory: 'com_boomaa_opends_usb_IOKitDevice.o'
Boomaa23 commented 2 years ago

Are you running this in the full cloned repo? i.e. do you have the .c file that it mentions in the same folder? Also depending on the version of Java you have, that script might need to be changed (the adoptopenjdk-11.jdk part)

srimanachanta commented 2 years ago

Are you running this in the full cloned repo? i.e. do you have the .c file that it mentions in the same folder? Also depending on the version of Java you have, that script might need to be changed (the adoptopenjdk-11.jdk part)

I have now realized that I am stupid. After running the compiled file I get this:

com_boomaa_opends_usb_IOKit.c:28:51: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
    IOReturn ioRtn = IOServiceGetMatchingServices(kIOMasterPortDefault, hidMatchDictionary, &hidObjectIterator);
                                                  ^~~~~~~~~~~~~~~~~~~~
                                                  kIOMainPortDefault
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:123:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
const mach_port_t kIOMasterPortDefault
                  ^
1 warning generated.

And here is the link for the file: ods-input-osx.jnilib

Boomaa23 commented 2 years ago

All good! Please try this out and tell me if it works: open-ds-v0.2.3-SNAPSHOT-jar-with-dependencies.zip

srimanachanta commented 2 years ago

works!

Boomaa23 commented 2 years ago

Great! I will do a release.