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

quick_usb need libusb (m1 and Intel) support on MacOS #77

Open
AlphaBlend1975 opened this issue Sep 20, 2022 · 6 comments
Open

quick_usb need libusb (m1 and Intel) support on MacOS #77

AlphaBlend1975 opened this issue Sep 20, 2022 · 6 comments

Comments

@AlphaBlend1975
Copy link

I found libusb v1.0.26 are support both (arm64 and x86_x64)
Could you please update source and library for support both version?

Your source of QuickUsbDesktop

class QuickUsbMacos extends _QuickUsbDesktop {
QuickUsbMacos() {
if(arm64) { //-- I do not know detect cpu architecture and possible?
_libusb = Libusb(DynamicLibrary.open('libusb-1.0.23_arm64.dylib'));
} else {
_libusb = Libusb(DynamicLibrary.open('libusb-1.0.23_x64.dylib'));
}
}
}

We need you to fixed and publish asap.
Thank you

@juliendeuse-1
Copy link

juliendeuse-1 commented Oct 3, 2022

Hello,

I implemented your solution to make it work on our Desktop App. It is not possible to detect the CPU architecture in a robust way at the moment with Flutter. To detect it, we used Flutter Platform to retrieve the full version of the OS and check if it contained the string "arm64" (M1). Here is the code:

For the file quick_usb_desktop.dart

class QuickUsbMacos extends _QuickUsbDesktop {
  QuickUsbMacos() {
    if(Platform.version.contains('arm64')) {
      _libusb = Libusb(DynamicLibrary.open('libusb-1.0.23.dylib'));
    } else {
      _libusb = Libusb(DynamicLibrary.open('libusb-1.0.0.dylib'));
    }
  }
}

For the file quick_usb.podspec:
s.vendored_libraries = 'libusb-1.0.0.dylib', 'libusb-1.0.23.dylib'

We also had to retrieve the correct libraries on a Mac M1 and Intel. I'll put them there if it can saves someone some time:
You have to put them in the folder quick_usb/macos
libusb-1.0.0_intel.zip
libusb-1.0.23_m1_arm64.zip

If you see ways to improve the code above, feel free to let me know.

I know for a fact that adding both libs in the podspec file is not the best way of doing this. But I am no Mac expert and well.. it works ^_^'

It would be nice if someone could add it for the next release.

@AlphaBlend1975
Copy link
Author

Hello,

I implemented your solution to make it work on our Desktop App. It is not possible to detect the CPU architecture in a robust way at the moment with Flutter. To detect it, we used Flutter Platform to retrieve the full version of the OS and check if it contained the string "arm64" (M1). Here is the code:

For the file quick_usb_desktop.dart

class QuickUsbMacos extends _QuickUsbDesktop {
  QuickUsbMacos() {
    if(Platform.version.contains('arm64')) {
      _libusb = Libusb(DynamicLibrary.open('libusb-1.0.23.dylib'));
    } else {
      _libusb = Libusb(DynamicLibrary.open('libusb-1.0.0.dylib'));
    }
  }
}

For the file quick_usb.podspec: s.vendored_libraries = 'libusb-1.0.0.dylib', 'libusb-1.0.23.dylib'

We also had to retrieve the correct libraries on a Mac M1 and Intel. I'll put them there if it can saves someone some time: You have to put them in the folder quick_usb/macos libusb-1.0.0_intel.zip libusb-1.0.23_m1_arm64.zip

If you see ways to improve the code above, feel free to let me know.

I know for a fact that adding both libs in the podspec file is not the best way of doing this. But I am no Mac expert and well.. it works ^_^'

It would be nice if someone could add it for the next release.

Thank you for suggesion but did'nt work.
After do the step both library did not copy to Frameworks folder when finish build release and debug.
Application crash on startup.

@juliendeuse-1
Copy link

@AlphaBlend1975 : Strange. What are the flutter logs of your build? Did you do a flutter clean before launching the build?

@AlphaBlend1975
Copy link
Author

AlphaBlend1975 commented Oct 5, 2022

33

003

>

Yes i clean before build
flutter clean
flutter build macos --release
001
2

@ucola
Copy link

ucola commented Jun 29, 2023

Any succsess on this issue?

@kaciula
Copy link

kaciula commented Sep 6, 2024

@AlphaBlend1975 Have you managed to include the .dylib file in the Frameworks build folder? If I manually try to include it I get "code object is not signed at all"

cc: @juliendeuse-1

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

4 participants