a1ien / rusb

A safe Rust wrapper for libusb.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

sourcebox opened this issue · 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.

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

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?

Maybe making the HAVE_CLOCK_GETTIME dependent of MACOSX_DEPLOYMENT_TARGET is an option.

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

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

commented

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.