-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add support for Apple Silicon (macOS M1) #244
Comments
Hi. I've managed to compile and package a darwin-aarch64 version of the libusb master branch. There were a few minor changes required in the makefile see here : usb4java/libusb4java#12 Note that this only works with Lunii v2.x firmwares. I had previously tried with a Lunii running v1.1 firmwares but studio did not work as there is no driver for the 1.1 firmware available for M1. Make sure you update your Lunii first ! I can share the aarch64 jar if needed, however i would recommend people to build it. |
I would love that you share the build package or the procedure to build the lib because I have the same issue |
Hi. The instruction to build the jar are in the message above. I recommend building the jar from sources using that link : usb4java/libusb4java#12 This is not recommended : if you still want to run a random file downloaded from the internet (just remove the .zip extension) |
Hi, thank you for the aarch64 jar file. However, I still have a library error when I launch the sh file (also on M1). Can't load library: /var/folders/jw/p7z6_jzn7wngh64rdnv_yt900000gn/T/usb4java18146965738665781312.tmp/libusb4java.dylib Can you help please? Thank you very much... |
Thanks to @ioExpander, I was able to compile and run a version on one M1 laptop. Install the openjdkUsing brew: brew install openjdk Build libusb4javaFirst, download the libusb source code from https://github.com/usb4java/libusb4java. You will need to install the brew install autoconf automake libtool cmake I updated the cmake_minimum_required(VERSION 2.8)
project(usb4java C)
set(PROJECT_VERSION 1.3.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/.cmake/Modules/")
set(JAVA_INCLUDE_PATH2 /opt/homebrew/opt/openjdk/include)
set(JAVA_INCLUDE_PATH /opt/homebrew/opt/openjdk/include)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI REQUIRED)
find_package(LibUsb REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
include_directories(${LibUsb_INCLUDE_DIRS})
if(CMAKE_COMPILER_IS_GNUCC)
add_definitions(-Wall -Werror -std=c99)
endif()
add_subdirectory(src) Then we build the library from the root directory of mvn clean install
cd dists/darwin
chmod +x build
./build This will create one file named Build studioInstall maven if you do not have it: brew install maven With the current version, I needed to update the version of one dependencies inside the
Now you can build the studio: mvn clean install Copy the libusb4java jar inside the libs directoryNow move the generated jar to the |
Hi, Tried to find how to get out of this, but the only thing I'be found is this Unable to compile under MacOS Big Sur #45 and it seems they didn't succeed... Has anyone found a solution for this jni.h not found? |
I guess it is |
Completely right 😅 I updated the comment! |
Ok, I was guessing right, the man command seemed weird. Do you have any idea ? |
Hey, just FIY I created a golang app that can install STUdio packs on your lunii: https://github.com/olup/lunii-admin The macos version is built for intel but works fine on M1 (I am developing on m1, and can provide m1 builds if really needed) |
Hi, |
I would also love to have this problem solved since I am facing an error while building the lib: `24 warnings generated. CCLD libusb-1.0.la .././install-sh -c -d '/tmp/libusb4java/target/build/darwin-x86_64/root/lib' /bin/sh ../libtool --mode=install /usr/bin/install -c -s libusb-1.0.la '/tmp/libusb4java/target/build/darwin-x86_64/root/lib' libtool: install: /usr/bin/install -c .libs/libusb-1.0.lai /tmp/libusb4java/target/build/darwin-x86_64/root/lib/libusb-1.0.la libtool: install: /usr/bin/install -c .libs/libusb-1.0.a /tmp/libusb4java/target/build/darwin-x86_64/root/lib/libusb-1.0.a libtool: install: chmod 644 /tmp/libusb4java/target/build/darwin-x86_64/root/lib/libusb-1.0.a libtool: install: ranlib /tmp/libusb4java/target/build/darwin-x86_64/root/lib/libusb-1.0.a .././install-sh -c -d '/tmp/libusb4java/target/build/darwin-x86_64/root/include/libusb-1.0' /usr/bin/install -c -m 644 libusb.h '/tmp/libusb4java/target/build/darwin-x86_64/root/include/libusb-1.0' make[3]: Nothing to be done for `install-exec-am'. ./install-sh -c -d '/tmp/libusb4java/target/build/darwin-x86_64/root/lib/pkgconfig' /usr/bin/install -c -m 644 libusb-1.0.pc '/tmp/libusb4java/target/build/darwin-x86_64/root/lib/pkgconfig' CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. ... -- The C compiler identification is AppleClang 13.1.6.13160021 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found JNI: /Library/Java/JavaVirtualMachines/jdk-11.0.14.1+1/Contents/Home/include found components: AWT JVM CMake Error at .cmake/Modules/FindLibUsb.cmake:103 (message): libusb NOT FOUND! Try defining LibUsb_LIBRARIES manually Call Stack (most recent call first): CMakeLists.txt:13 (find_package)` |
You are missing the libusb library. I think some versions can be found in homebrew. To install it: brew install libusb Then, you could give a new try |
Thank you @yageek I already did that. Changing the JDK leads to another error : Undefined symbols for architecture x86_64: "_libusb_alloc_streams", referenced from:
"_libusb_alloc_transfer", referenced from:
... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [src/libusb4java.dylib] Error 1 make[1]: *** [src/CMakeFiles/usb4java.dir/all] Error 2 make: *** [all] Error 2` |
Did anyone face this error in the past and/or could help me to get Studio running on my Mac M1 please? |
Need help, I'm able to build and got libusb4java.dylib, How to generate jar from dylib
|
I face to the same problem sadly. |
I use your .jar file and its work (copying to lib/ directory to studio directory). Thanks ! |
Hi, |
I also have an Apple Silicon laptop, and I managed to have the program working by using the x86 OpenJDK installed via Brew. These steps might be useful:
This might be easier than recompiling libusb. It might also be slower and require more disk space, because of emulated CPU and the additional libraries required. |
Describe the bug
I'm failing to run studio 0.3.0 on my M1 Mac. There seems to be an issue with missing libusb4java binaries
Caused by: org.usb4java.LoaderException: Native library not found in classpath: /org/usb4java/darwin-aarch64/libusb4java.dylib
It seems that libusb4java recently added support for aarch64 but the darwin-aarch64 jar is missing in the
lib
folder of studio.Thank you.
To Reproduce
Steps to reproduce the behavior:
brew install openjdk
Logs
Desktop and environment
The text was updated successfully, but these errors were encountered: