rusb icon indicating copy to clipboard operation
rusb copied to clipboard

Vendored libusb does not work on older versions of macOS (below 10.12).

Open sourcebox opened this issue 4 years ago • 6 comments

This is mainly related to the clock_gettime() function which is not available before macOS 10.12. On the other hand, libusb can be compiled on older systems (I tested 10.11) via Homebrew.

There is a define HAVE_CLOCK_GETTIME which is always set to 1 in the build.rs of the libusb1-sys, so it will fail on macOS 10.11 and below.

sourcebox avatar Jul 29 '21 10:07 sourcebox

Hmmm.., i think we need some patch build.rs to use Xcode/config.h when build libusb for macOS. And not broke other build)

a1ien avatar Jul 29 '21 11:07 a1ien

There's also one case to consider: compiling on older macOS may work by setting HAVE_CLOCK_GETTIME to 0 on these OSs. But if you compile on macOS 10.12 or higher, the executable will not work on those older systems. Maybe by setting HAVE_CLOCK_GETTIME to 0 then also, but what is the impact on doing this?

sourcebox avatar Jul 29 '21 11:07 sourcebox

Maybe making the HAVE_CLOCK_GETTIME dependent of MACOSX_DEPLOYMENT_TARGET is an option.

sourcebox avatar Jul 29 '21 12:07 sourcebox

I very little knowledge about macOs. So if want add support on older mac I am ask for PR. Because i not have any device with macOs for testing

a1ien avatar Jul 29 '21 13:07 a1ien

I'll have a look at this at some point, but it can take a while.

sourcebox avatar Aug 01 '21 11:08 sourcebox

I am not so sure if it is just HAVE_CLOCK_GETTIME, maybe there are others. Ref: a potential example which may or may not matter for rusb.

  • https://github.com/libusb/libusb/issues/1169

mcuee avatar Apr 30 '23 13:04 mcuee