build error for net/usbredir after recent update to 0.9.0 ... usbredirect.c:531:19: error: call to undeclared function 'libusb_set_option'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration] 531 | int ret = libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_NONE); | ^ usbredirect.c:531:19: note: did you mean 'libusb_get_version'? /usr/include/libusb.h:478:30: note: 'libusb_get_version' declared here 478 | const struct libusb_version *libusb_get_version(void); This was on stable/13, but I don't see libusb_set_option in libusb on freebsd-current either. It looks like having devel/glib20 installed triggers usbredir to build "tools". So a workaround is to explicitly add --without-tools to CONFIGURE_ARGS.
Created attachment 268514 [details] [patch] add CLIENT option and fix build of usbredirect client tool on FreeBSD Fix potential build error of tools/ (when glib20 is installed). If not told otherwise, configure will detect presence of glib20 and, if found, enable the build of "tools" (usbredirect client). Currently building this throws an error because libusb_set_options is not in FreeBSD's libusb currently. To get past that, patch usbredirect.c to skip the code that calls libusb_set_options - it is not necessary. It adjusts libusb log level based on usbredirect log level, but the user can use the LIBUSB_DEBUG environment variable to control the libusb log level. Add a CLIENT option which will install the usbredirect client tool if enabled (or explicitly disable "tools" if not to avoid failure in case glib20 is installed). usbredirect depends on devel/glib20. Make CLIENT off by default to favor a lighter package by default. This could be set to be enabled by default in the future if it proves popular. While here, pet portclippy and sort plist. Bump PORTREVISION due to new CLIENT option.
^Triage: this patch no longer applies. Can you resubmit it to apply to the current contents of the port? Thanks.
Created attachment 270968 [details] [patch] add CLIENT option (v2) (In reply to Mark Linimon from comment #2) Thanks for the reminder. I have been using an updated version locally for a month. diff from v1: - sync with port updates, now at 0.13.0 - port now includes a patch to solve the "no libusb_set_option on freebsd" issue - rebase CLIENT option patch to work with 0.13.0 - old client usbredirserver deprecated in 0.9.0, now removed in 0.13.0 - new client, usbredirect, first appeared in 0.9.0 - build tested against qemu-devel with USBREDIR option on - qemu / qemu-devel uses the library, not the client - qemu / qemu-devel is the only consumer of net/usbredir The CLIENT option is off (same as v1) since the only ports tree consumer does not need it, and it removes the dependency on glib. But I can see a case for users wanting the usbredirect client, so having it on by default. Committer's discretion on that as far as I am concerned. PORTREVISION bumped. QA: - build testing with qemu-devel (USBREDIR option on) - ok - portclippy, portfmt, portlint - ok
Update title of this bug. The undeclared 'libusb_set_option' now is addressed by a patch (files/patch-tools_usbredirect.c - see ports 525aa57a92705a02ccffd166b9039ea557fb9507). Update summary.