From e61923ed72a4946007f6a32b3216a7c02077f4b3 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 29 Sep 2026 06:01:34 +0000 Subject: [PATCH] sockperf: fix musl build (libexecinfo dependency, missing includes) configure.ac's AC_SEARCH_LIBS([backtrace], [execinfo], ...) fails with 'libexecinfo not found' on musl, which lacks glibc's backtrace()/backtrace_symbols(); depend on the libexecinfo compat library there. Once configure succeeds, ticks.h's timeval2nsec() needs struct timeval, which was only pulled in via under __FreeBSD__, and vma-xlio-redirect.cpp calls sscanf()/sprintf() without including ; fix both for musl too. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj --- ...-includes-for-musl-struct-timeval-ss.patch | 54 +++++++++++++++++++ .../sockperf/sockperf_git.bb | 11 +++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 meta-oe/recipes-benchmark/sockperf/files/0001-src-fix-missing-includes-for-musl-struct-timeval-ss.patch diff --git a/meta-oe/recipes-benchmark/sockperf/files/0001-src-fix-missing-includes-for-musl-struct-timeval-ss.patch b/meta-oe/recipes-benchmark/sockperf/files/0001-src-fix-missing-includes-for-musl-struct-timeval-ss.patch new file mode 100644 index 0000000000..3a59a8dbbe --- /dev/null +++ b/meta-oe/recipes-benchmark/sockperf/files/0001-src-fix-missing-includes-for-musl-struct-timeval-ss.patch @@ -0,0 +1,54 @@ +From: Khem Raj +Date: Tue, 29 Sep 2026 02:40:00 +0000 +Subject: [PATCH] src: fix missing includes for musl (struct timeval, + sscanf/sprintf) + +ticks.h's timeval2nsec() uses struct timeval, but the header only +pulled in under __FreeBSD__ -- glibc's happens +to declare struct timeval as a side effect of other headers already +included elsewhere in the build, but musl's does not, so building +against musl fails: + +| ticks.h:115:30: error: member access into incomplete type 'const struct timeval' + +Always include instead of gating it on __FreeBSD__. + +vma-xlio-redirect.cpp uses sscanf()/sprintf() but never includes +, relying on it being pulled in transitively. That doesn't +happen on musl either: + +| vma-xlio-redirect.cpp:92:14: error: use of undeclared identifier 'sscanf' +| vma-xlio-redirect.cpp:99:5: error: use of undeclared identifier 'sprintf' + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- +diff --git a/src/ticks.h b/src/ticks.h +index 679f3d9..6e38095 100644 +--- a/src/ticks.h ++++ b/src/ticks.h +@@ -99,9 +99,10 @@ with simple integral values. The following describes these calculations: + #include // for int64_t + #include // for qsort + +-#ifdef __FreeBSD__ ++/* struct timeval is used below (timeval2nsec()); alone doesn't ++ * guarantee it, so always pull in rather than just on ++ * __FreeBSD__. */ + #include +-#endif + + #include "ticks_os.h" + +diff --git a/src/vma-xlio-redirect.cpp b/src/vma-xlio-redirect.cpp +index 5554d4a..a54a6c1 100644 +--- a/src/vma-xlio-redirect.cpp ++++ b/src/vma-xlio-redirect.cpp +@@ -28,6 +28,7 @@ + */ + + #include "vma-xlio-redirect.h" ++#include /* sscanf(), sprintf() */ + #include + + socket_fptr_t fn_socket = NULL; diff --git a/meta-oe/recipes-benchmark/sockperf/sockperf_git.bb b/meta-oe/recipes-benchmark/sockperf/sockperf_git.bb index ab0e35667e..fe285465e6 100644 --- a/meta-oe/recipes-benchmark/sockperf/sockperf_git.bb +++ b/meta-oe/recipes-benchmark/sockperf/sockperf_git.bb @@ -5,9 +5,16 @@ SECTION = "console/network" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://copying;md5=b4563b57c98bc23c8cecbc0b6d9546e9" -SRC_URI = "git://github.com/Mellanox/sockperf;branch=sockperf_v2;protocol=https" +SRC_URI = "git://github.com/Mellanox/sockperf;branch=sockperf_v2;protocol=https \ + file://0001-src-fix-missing-includes-for-musl-struct-timeval-ss.patch \ + " SRCREV = "3c65ad99cd385e18f8a2a655c19826e81a4d17e8" UPSTREAM_CHECK_COMMITS = "1" -inherit autotools \ No newline at end of file +# musl lacks glibc's backtrace()/backtrace_symbols(); configure.ac uses +# AC_SEARCH_LIBS([backtrace], [execinfo], ...) which errors out with +# "libexecinfo not found" unless the compat library is available. +DEPENDS:append:libc-musl = " libexecinfo" + +inherit autotools