Repository navigation
Conversation
configure required libusb_strerror() (libusb 1.0.16+, see networkupstools#509) to use the libusb-1.0 API, so e.g. the libusb1 1.0.9 package of CentOS 6 was rejected. Building against it showed only one other method missing: libusb_get_version(). * configure: accept libusb_error_name() (1.0.9+) when libusb_strerror() is missing, and check for libusb_get_version(). * usb-common.h: map libusb_strerror() to libusb_error_name() when the former is missing; messages then show the error code name. * libusb1.c: without libusb_get_version(), report the libusb version in driver.version.usb as unknown. * nut-scanner: when the libusb loaded at run time lacks libusb_strerror(), use libusb_error_name(); treat a missing libusb_get_version() as an unknown (old) version instead of failing to load the library. Mirror struct libusb_version for builds against headers that lack it. Tested by building against the headers and libraries from the CentOS 6.10 RPMs (host GCC), and by running nut-scanner built against libusb 1.0.27 with the 1.0.9 library and vice versa. Not tested with devices. Refs: networkupstools#3781 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: nmbro <nmbro@users.noreply.github.com>
With --with-usb=auto (or yes), configure picks libusb-1.0 whenever pkg-config knows it. If that libusb-1.0 then failed the usability checks, the libusb-0.1 checks were never tried and configure silently built no USB drivers, even with a usable libusb-0.1 installed. When the libusb-1.0 picked by preference does not link with libusb_init() and libusb_error_name() (libusb 1.0.9+), and a libusb-0.1 was also detected, switch to libusb-0.1 before computing the flags and say so in a notice. An explicit --with-usb=libusb-1.0, or custom --with-usb-includes/--with-usb-libs, still fails as before. Tested with the CentOS 6.0 libusb1 1.0.3 + libusb 0.1.12 RPM contents (falls back, builds all drivers), 1.0.9 + 0.1.12 (keeps 1.0.9), and the host libusb 1.0.27 (unchanged), including a cached configure re-run. Closes: networkupstools#3781 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: nmbro <nmbro@users.noreply.github.com>
|
A ZIP file with standard source tarball and another tarball with pre-built docs for commit 8ca85cf is temporarily available: NUT-tarballs-PR-3782.zip. |
Resolve the NEWS.adoc conflict with master (both sides added entries at the same place; keep both), and add the PR number to this branch's NEWS references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: nmbro <nmbro@users.noreply.github.com>
nmbro
added a commit
to nmbro/nut
that referenced
this pull request
Oct 21, 2026
The libusb-1.0.9 and libusb-0.1 fallback entries come from the commits of PR networkupstools#3782, which this branch builds on; use the same references there and here, so either PR merges cleanly after the other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: nmbro <nmbro@users.noreply.github.com>
With autoconf 2.69, a line break between the last line of an AS_IF condition and its closing bracket makes the generated configure read "if <condition>" followed by a line starting with "; then :", which is a shell syntax error. autogen.sh rejects such a configure in its "$CONFIG_SHELL -n configure" check, which failed every Jenkins stage that runs autogen.sh on CentOS 7, Debian 11, Ubuntu trusty/impish, Slackware 15 and OpenBSD 6.5 for this PR. autoconf 2.70 and newer emit "then :" without the semicolon, so newer systems were not hit. Reproduced with autoconf 2.69 (dash -n and bash -n on the generated configure); with this change both pass, as does configure from autoconf 2.73. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: nmbro <nmbro@users.noreply.github.com>
|
✅ Build nut 2.8.5.5921-master completed (commit 14a50ef4fb by @nmbro)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3781, found while researching which platforms still need libusb-0.1 for #1507.
Problem
configurerequiredlibusb_strerror()(libusb 1.0.16+, Add autoconf check for libusb_strerror() #509) to use the libusb-1.0 API, so e.g. thelibusb11.0.9 package of CentOS 6.3-6.10 was rejected.--with-usb=auto(oryes), a rejected libusb-1.0 also disabled USB drivers entirely, without trying an available libusb-0.1: the 0.1 checks only ran when pkg-config did not know libusb-1.0 at all.Building current master against libusb 1.0.9 with that check bypassed showed only two methods missing:
libusb_strerror()andlibusb_get_version().Changes
build: accept libusb-1.0 from 1.0.9 onconfigure: acceptlibusb_error_name()(1.0.9+) whenlibusb_strerror()is missing; check forlibusb_get_version(). Both the detection and the cached pass.usb-common.h: withoutlibusb_strerror(), map it tolibusb_error_name(). Log messages then show the code name (e.g.LIBUSB_ERROR_TIMEOUT) instead of a description.libusb1.c: withoutlibusb_get_version(),driver.version.usbreportslibusb-1.0 (version unknown, 1.0.9 or older).nut-scanner: if the libusb loaded at run time lackslibusb_strerror(), uselibusb_error_name(); a missinglibusb_get_version()is treated as an unknown (old) version instead of failing to load the library.struct libusb_versionis mirrored (stable ABI) for builds against headers that lack it, so a newer run-time libusb can still be asked.build: fall back to libusb-0.1 if libusb-1.0 is too oldlibusb_init()andlibusb_error_name(), and a libusb-0.1 was also detected, switch to libusb-0.1 before computing flags, with a notice. Explicit--with-usb=libusb-1.0or custom--with-usb-includes/--with-usb-libsstill fail as before. Replaces an existing TODO comment about this case.Testing
Built against headers and libraries extracted from the CentOS 6.0/6.10 RPMs (
PKG_CONFIG_LIBDIR/PKG_CONFIG_SYSROOT_DIR, host GCC; thecentos:6container itself does not run on a current kernel withoutvsyscall=emulate):--with-usb=autonut-scannerbuild, no new warningsautoautolibusb-1.0libusb_strerror()norlibusb_error_name()auto,--enable-Werrornut-scannerbuild cleanautoAlso: cached
configure -Cre-run of the fallback case; the first commit alone against 1.0.9;nut-scannerbuilt against 1.0.27 run with the 1.0.9 library (both fallbacks taken, library loads, scan runs) and vice versa;make distcheck-light;make spellcheck. Not tested with USB devices on libusb 1.0.9.libusb 1.0.3 (CentOS 6.0-6.2 only; a
yum updatebrings 1.0.9) would additionally need a fallback forlibusb_error_name(),libusb_handle_events_timeout()for the_completedvariant (used byapcmicrolink), and an emptyLIBUSB_CALL; I left that out.Checklist
configureprobes are guarded, no new pragmasmake distcheck-lightpassesNEWS.adocmake spellcheck🤖 Generated with Claude Code