usb icon indicating copy to clipboard operation
usb copied to clipboard

Bug in the recent macOS 12.0 build fix

Open benma opened this issue 3 years ago • 2 comments

This commit:

https://github.com/karalabe/usb/commit/c7c6bc0112904e38bff30fb4ed81ecefc0db8fca#diff-030195b530be26a69d54ce9487a942a3b24568c08397d003492f4507e1217f16R33

uses MAC_OS_X_VERSION_MAX_ALLOWED to determine whether to use the old or new name. This definition can be 120000 even if compiling on macOS 11, resulting in compiler warnings and a broken build.

It looks like MAC_OS_X_VERSION_MIN_REQUIRED should be used instead?

Like in this patch:

https://bug-224632-attachments.webkit.org/attachment.cgi?id=426166 (from https://bugs.webkit.org/show_bug.cgi?id=224632).

benma avatar May 10 '22 13:05 benma

For reference, here is the error I ran when compiling on macOS 11:

n file included from vendor/github.com/karalabe/usb/libs.go:50:
vendor/github.com/karalabe/usb/libusb/libusb/os/darwin_usb.c:253:39: warning: 'kIOMainPortDefault' is only available on macOS 12.0 or newer [-Wunguarded-availability-new]

When I print the MAC_OS_X_VERSION_MAX_ALLOWED var during compilation, it was shown to be 120000.

benma avatar May 10 '22 13:05 benma

Running into this again. @karalabe is this package still maintained?

The above fix was suboptimal also in that it uses the definition made in libusb inside of hidapi, even though these are separate libraries. The two libraries have in the meantime fixed it upstream by simply using 0 instead of kIOMainPortDefault. It would be good to pull the latest upstream changes instead of doing local patches.

benma avatar Feb 06 '23 16:02 benma