Bug 293567 - net/usbredir: build error, undeclared libusb_set_option
Summary: net/usbredir: build error, undeclared libusb_set_option
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-03 22:16 UTC by John Hein
Modified: 2026-03-03 23:06 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
[patch] add CLIENT option and fix build of usbredirect client tool on FreeBSD (3.88 KB, patch)
2026-03-03 22:24 UTC, John Hein
jcfyecrayz: maintainer-approval? (bofh)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2026-03-03 22:16:04 UTC
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.
Comment 1 John Hein 2026-03-03 22:24:09 UTC
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.