build(libusb): build libusb without pipe2 on macOS, where pipe2 needs macOS 27 #19920
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19920"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by XIIYAZ on 2026-11-14T08:10:07Z.
What
libusb-cmake sets
HAVE_PIPE2fromcheck_function_exists(pipe2 HAVE_PIPE2). The macOS 27 SDK declarespipe2with__API_AVAILABLE(macos(27.0), ...), so the check passes,usbi_create_eventcallspipe2, and with a lower minimum version the symbol is weakly imported and null on macOS 26.sceUsbdInitthen jumps to address 0:The compiler also warns
'pipe2' is only available on macOS 27.0 or neweratevents_posix.c:87.On Apple,
HAVE_PIPE2is now preset to false beforeadd_subdirectory(3rdparty/libusb-cmake);check_function_existsskips a variable that is already defined, so libusb takes its ownpipe+fcntl(FD_CLOEXEC)path, which works on every macOS version. No third-party file changes; Linux and Windows are unchanged. This is the libusb side of thelibkernelpipe2call fixed in #19903.Tested
macOS 26.7.3, Apple M4, Xcode SDK 27.2, Apple clang 21.0.0, CMake 4.4.4, Ninja, full build (
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_OSX_ARCHITECTURES=x86_64, tests under Rosetta) onmainwith #17425, #11049, #11437 and #19903 merged locally:guest_usbdsegfaults with the backtrace above.config.hhas/* #undef HAVE_PIPE2 */, theevents_posix.cavailability warning is gone, andguest_usbdpasses.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)