Skip to contentSkip to conversation

package/igt-gpu-tools: needs NPTL threads

PATCH In review Thomas Petazzoni via buildroot 4 participants 4 messages Jan 3, 2025 – Jan 8, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/igt-gpu-tools: needs NPTL threads

With classic thread library, the build fails with:

../lib/igt_kmod.c:1090:21: error: implicit declaration of function 'pthread_mutexattr_setrobust'; did you mean 'pthread_mutexattr_settype'? [-Werror=implicit-function-declaration]

igt-gpu-tools needs NPTL threads.

Fixes:

http://autobuild.buildroot.net/results/85311ce68ae1fff771ca00b434be1c4f8453d357/

---
 package/igt-gpu-tools/Config.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/igt-gpu-tools/Config.in +3 -3
index 08fc34e917..de87bf8e99 100644
@@ -3,7 +3,7 @@ config BR2_PACKAGE_IGT_GPU_TOOLS
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_ENABLE_LOCALE
 	depends on !BR2_STATIC_LIBS
-	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_PACKAGE_HAS_UDEV
 	depends on BR2_USE_WCHAR # elfutils, procps-ng
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11 # linux/dma-buf.h
@@ -24,9 +24,9 @@ config BR2_PACKAGE_IGT_GPU_TOOLS
 
 	  https://gitlab.freedesktop.org/drm/igt-gpu-tools
 
-comment "igt-gpu-tools needs udev /dev management and toolchain w/ threads, wchar, dynamic library, locale, headers >= 4.11"
+comment "igt-gpu-tools needs udev /dev management and toolchain w/ NPTL, wchar, dynamic library, locale, headers >= 4.11"
 	depends on BR2_USE_MMU
 	depends on !BR2_PACKAGE_HAS_UDEV || BR2_STATIC_LIBS || \
-		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
+		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || !BR2_USE_WCHAR || \
 		!BR2_ENABLE_LOCALE || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11
Signature · 6 lines
2.47.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/igt-gpu-tools: fix build with procps-ng 4.0.5

Since the bump of procps-ng to version 4.0.5 in Buildroot commit f7fe84508a14641617586bc481a08cb3face0477, the build of igt-gpu-tools fails with:

../lib/igt_aux.c:1358:78: error: macro "PIDS_VAL" passed 4 arguments, but takes just 3

Indeed, the API of procps-ng has slightly changed between 4.0.4 and 4.0.5. Since it looks strange as those are minor releases the API breakage has been reported to upstream procps-ng.

In the mean time, we still need to fix igt-gpu-tools, which the patch added in this commit does. This patch has been submitted to upstream igt-gpu-tools.

There are no autobuilder failures at this point, as the update to procps-ng is quite recent, and igt-gpu-tools needing quite a lot of dependencies, the build has a high chance of failing elsewhere previously. However, the build issue is reproducible with the following minimal defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_IGT_GPU_TOOLS=y
# BR2_TARGET_ROOTFS_TAR is not set

---
 ...nce-procps-ng-4.0.5-PIDS_VAL-takes-3.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/igt-gpu-tools/0001-lib-igt_aux.c-since-procps-ng-4.0.5-PIDS_VAL-takes-3.patch
package/igt-gpu-tools/0001-lib-igt_aux.c-since-procps-ng-4.0.5-PIDS_VAL-takes-3.patch new file +66 -0
new file mode 100644
index 0000000000..7c58024f01
@@ -0,0 +1,66 @@
+From 17a30d4dbd60c644244d5bc7355eeaa221aaa820 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Thu, 2 Jan 2025 14:16:47 +0100
+Subject: [PATCH] lib/igt_aux.c: since procps-ng 4.0.5, PIDS_VAL() takes 3
+ arguments, not 4
+
+Unfortunately, the API of procps-ng has changed between procps-ng
+4.0.4 and procps-ng 4.0.5, with the PIDS_VAL() macro changing in
+upstream commit
+https://gitlab.com/procps-ng/procps/-/commit/967fdcfb06e20aad0f31073474cb94545c9bdea5.
+
+This API breakage has been reported upstream as of
+https://gitlab.com/procps-ng/procps/-/issues/366, but in the mean
+time, the build of igt-gpu-tools breaks with:
+
+../lib/igt_aux.c:1358:78: error: macro "PIDS_VAL" passed 4 arguments, but takes just 3
+
+We fix this by detecting the version of the libproc2 library, and
+adjusting accordingly how PIDS_VAL() gets used.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+Upstream: https://lists.freedesktop.org/archives/igt-dev/2025-January/083809.html
+---
+ lib/igt_aux.c | 7 +++++++
+ meson.build   | 3 +++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/lib/igt_aux.c b/lib/igt_aux.c
+index 3407cc4f2..f5bf48da6 100644
+--- a/lib/igt_aux.c
++++ b/lib/igt_aux.c
+@@ -1358,10 +1358,17 @@ static bool get_process_ids(struct igt_process *prcs)
+ 	prcs->comm = NULL;
+ 	prcs->stack = procps_pids_get(prcs->info, PIDS_FETCH_TASKS_ONLY);
+ 	if (prcs->stack) {
++#if defined(HAVE_LIBPROC2_POST_4_0_5_API)
++		prcs->tid = PIDS_VAL(EU_PID, s_int, prcs->stack);
++		prcs->euid = PIDS_VAL(EU_EUID, s_int, prcs->stack);
++		prcs->egid = PIDS_VAL(EU_EGID, s_int, prcs->stack);
++		prcs->comm = PIDS_VAL(EU_CMD, str, prcs->stack);
++#else
+ 		prcs->tid = PIDS_VAL(EU_PID, s_int, prcs->stack, prcs->info);
+ 		prcs->euid = PIDS_VAL(EU_EUID, s_int, prcs->stack, prcs->info);
+ 		prcs->egid = PIDS_VAL(EU_EGID, s_int, prcs->stack, prcs->info);
+ 		prcs->comm = PIDS_VAL(EU_CMD, str, prcs->stack, prcs->info);
++#endif
+ 	}
+ #endif
+ 	return prcs->tid != 0;
+diff --git a/meson.build b/meson.build
+index 8b2a2a64a..f3e645c4d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -139,6 +139,9 @@ if libprocps.found()
+   config.set('HAVE_LIBPROCPS', 1)
+ elif libproc2.found()
+   config.set('HAVE_LIBPROC2', 1)
++  if libproc2.version().version_compare('>= 4.0.5')
++    config.set('HAVE_LIBPROC2_POST_4_0_5_API', 1)
++  endif
+ else
+   error('Either libprocps or libproc2 is required')
+ endif
+-- 
+2.47.1
+
Signature · 6 lines
2.47.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 4 lines · Thomas Petazzoni via buildroot

With classic thread library, the build fails with:

../lib/igt_kmod.c:1090:21: error: implicit declaration of function 'pthread_mutexattr_setrobust'; did you mean 'pthread_mutexattr_settype'? [-Werror=implicit-function-declaration]

Quoted 8 lines

igt-gpu-tools needs NPTL threads.

Fixes:

http://autobuild.buildroot.net/results/85311ce68ae1fff771ca00b434be1c4f8453d357/

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 11 lines · Thomas Petazzoni via buildroot

With classic thread library, the build fails with:

../lib/igt_kmod.c:1090:21: error: implicit declaration of function 'pthread_mutexattr_setrobust'; did you mean 'pthread_mutexattr_settype'? [-Werror=implicit-function-declaration]

igt-gpu-tools needs NPTL threads.

Fixes:

   http://autobuild.buildroot.net/results/85311ce68ae1fff771ca00b434be1c4f8453d357/

Committed to 2024.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot