Skip to contentSkip to conversation

package/sysprof: fix build on 32-bit x86 with AVX2

PATCH In review Yegor Yefremov via buildroot 2 participants 5 messages Oct 19 – Oct 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/sysprof: fix build on 32-bit x86 with AVX2

From: Yegor Yefremov <[email protected]>

The bundled CRoaring code enables its x64 specific code paths as soon as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This results in calls to 64-bit only intrinsics:

roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Backport the upstream patch that defines DISABLE_X64 when building for 32-bit x86, so that the portable implementation is used instead.

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Assisted-by Claude:claude-opus-5-5
---
 ...disable-x64-code-paths-on-32-bit-x86.patch | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch
package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch new file +53 -0
new file mode 100644
index 0000000000..2b2c6cb6cb
@@ -0,0 +1,53 @@
+From 22c10f0dbd3c357e96f83f430ebe05d24a25c536 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Sat, 17 Oct 2026 22:47:15 +0200
+Subject: [PATCH] contrib/eggbitset: disable x64 code paths on 32-bit x86
+
+roaring.h enables USEAVX (and thus IS_X64) whenever __AVX2__ is defined,
+and USESSE4 whenever __POPCNT__ and __SSE4_2__ are defined.  This also
+happens on 32-bit x86 targets such as i686 built with -march=haswell,
+where 64-bit only intrinsics like _mm_popcnt_u64() and
+_mm256_extract_epi64() are not available, so the build fails with:
+
+  roaring.h:260:18: error: implicit declaration of function
+    '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'?
+    [-Wimplicit-function-declaration]
+  roaring.h:1011:23: error: implicit declaration of function
+    '_mm256_extract_epi64'; did you mean '_mm256_extract_epi8'?
+    [-Wimplicit-function-declaration]
+
+Define DISABLE_X64 from the build system when building for 32-bit x86 so
+that the portable implementation is used instead. This keeps the bundled
+CRoaring sources unmodified, making future updates a plain copy.
+DISABLE_X64 is only set for x86, as it also guards the NEON detection
+used on ARM.
+
+Upstream: https://gitlab.gnome.org/GNOME/sysprof/-/commit/22c10f0dbd3c357e96f83f430ebe05d24a25c536
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ contrib/eggbitset/meson.build | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/contrib/eggbitset/meson.build b/contrib/eggbitset/meson.build
+index 82cd8a40..f2f81685 100644
+--- a/contrib/eggbitset/meson.build
++++ b/contrib/eggbitset/meson.build
+@@ -6,9 +6,18 @@ libeggbitset_deps = [
+   gio_dep,
+ ]
+ 
++libeggbitset_c_args = []
++
++# roaring.h enables its x64 code paths based on __AVX2__/__SSE4_2__ alone,
++# but they rely on intrinsics only available on 64-bit x86.
++if host_machine.cpu_family() == 'x86'
++  libeggbitset_c_args += ['-DDISABLE_X64']
++endif
++
+ libeggbitset_static = static_library('eggbitset', libeggbitset_sources,
+   gnu_symbol_visibility: 'hidden',
+            dependencies: libeggbitset_deps,
++                 c_args: libeggbitset_c_args,
+ )
+ 
+ libeggbitset_static_dep = declare_dependency(
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 9 lines · Yegor Yefremov via buildroot

From: Yegor Yefremov <[email protected]>

The bundled CRoaring code enables its x64 specific code paths as soon as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This results in calls to 64-bit only intrinsics:

roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Quoted 8 lines

Backport the upstream patch that defines DISABLE_X64 when building for 32-bit x86, so that the portable implementation is used instead.

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Assisted-by Claude:claude-opus-5-5

Same request as usual: could you please indicate which Buildroot commit introduced the issue, so that our LTS maintainers have an easy way of figuring out whether or not this fix needs to be backported to our stable branches?

If you could make sure to perform this investigation and include the results in your commit message for all fixes, it would be really nice!

Thanks!

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v2 1/1 package/sysprof: fix build on 32-bit x86 with AVX2

In reply to Yegor Yefremov via buildroot

From: Yegor Yefremov <[email protected]>

The bundled CRoaring code enables its x64 specific code paths as soon as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This results in calls to 64-bit only intrinsics:

roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Backport the upstream patch that defines DISABLE_X64 when building for 32-bit x86, so that the portable implementation is used instead.

This issue has been present since commit 0d57555407 ("package/sysprof:
update to version 46.0"), which switched to the new sysprof code base bundling CRoaring in contrib/eggbitset. It therefore affects 2024.08 and later.

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Assisted-by Claude:claude-opus-5-5

---
Changes v1 -> v2:
- mention the commit that introduced the issue (suggested by Thomas)

 ...disable-x64-code-paths-on-32-bit-x86.patch | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch
package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch new file +53 -0
new file mode 100644
index 0000000000..2b2c6cb6cb
@@ -0,0 +1,53 @@
+From 22c10f0dbd3c357e96f83f430ebe05d24a25c536 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Sat, 17 Oct 2026 22:47:15 +0200
+Subject: [PATCH] contrib/eggbitset: disable x64 code paths on 32-bit x86
+
+roaring.h enables USEAVX (and thus IS_X64) whenever __AVX2__ is defined,
+and USESSE4 whenever __POPCNT__ and __SSE4_2__ are defined.  This also
+happens on 32-bit x86 targets such as i686 built with -march=haswell,
+where 64-bit only intrinsics like _mm_popcnt_u64() and
+_mm256_extract_epi64() are not available, so the build fails with:
+
+  roaring.h:260:18: error: implicit declaration of function
+    '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'?
+    [-Wimplicit-function-declaration]
+  roaring.h:1011:23: error: implicit declaration of function
+    '_mm256_extract_epi64'; did you mean '_mm256_extract_epi8'?
+    [-Wimplicit-function-declaration]
+
+Define DISABLE_X64 from the build system when building for 32-bit x86 so
+that the portable implementation is used instead. This keeps the bundled
+CRoaring sources unmodified, making future updates a plain copy.
+DISABLE_X64 is only set for x86, as it also guards the NEON detection
+used on ARM.
+
+Upstream: https://gitlab.gnome.org/GNOME/sysprof/-/commit/22c10f0dbd3c357e96f83f430ebe05d24a25c536
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ contrib/eggbitset/meson.build | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/contrib/eggbitset/meson.build b/contrib/eggbitset/meson.build
+index 82cd8a40..f2f81685 100644
+--- a/contrib/eggbitset/meson.build
++++ b/contrib/eggbitset/meson.build
+@@ -6,9 +6,18 @@ libeggbitset_deps = [
+   gio_dep,
+ ]
+ 
++libeggbitset_c_args = []
++
++# roaring.h enables its x64 code paths based on __AVX2__/__SSE4_2__ alone,
++# but they rely on intrinsics only available on 64-bit x86.
++if host_machine.cpu_family() == 'x86'
++  libeggbitset_c_args += ['-DDISABLE_X64']
++endif
++
+ libeggbitset_static = static_library('eggbitset', libeggbitset_sources,
+   gnu_symbol_visibility: 'hidden',
+            dependencies: libeggbitset_deps,
++                 c_args: libeggbitset_c_args,
+ )
+ 
+ libeggbitset_static_dep = declare_dependency(
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 17 lines · Yegor Yefremov

From: Yegor Yefremov <[email protected]>

The bundled CRoaring code enables its x64 specific code paths as soon as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This results in calls to 64-bit only intrinsics:

roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Backport the upstream patch that defines DISABLE_X64 when building for 32-bit x86, so that the portable implementation is used instead.

This issue has been present since commit 0d57555407 ("package/sysprof:
update to version 46.0"), which switched to the new sysprof code base bundling CRoaring in contrib/eggbitset. It therefore affects 2024.08 and later.

Quoted 5 lines

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Assisted-by Claude:claude-opus-5-5

I've added a proper Fixes: tag pointing to the commit that first caused the issue, and applied to master. Thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Yegor Yefremov

In reply of:

Quoted 15 lines

The bundled CRoaring code enables its x64 specific code paths as soon as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This results in calls to 64-bit only intrinsics:

roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Backport the upstream patch that defines DISABLE_X64 when building for 32-bit x86, so that the portable implementation is used instead.

This issue has been present since commit 0d57555407 ("package/sysprof:
update to version 46.0"), which switched to the new sysprof code base bundling CRoaring in contrib/eggbitset. It therefore affects 2024.08 and later.

Quoted 5 lines

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Assisted-by Claude:claude-opus-5-5

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 57 lines

---
Changes v1 -> v2:
- mention the commit that introduced the issue (suggested by Thomas)

 ...disable-x64-code-paths-on-32-bit-x86.patch | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch
package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch new file +43 -0
new file mode 100644
index 0000000000..2b2c6cb6cb
@@ -0,0 +1,53 @@
+From 22c10f0dbd3c357e96f83f430ebe05d24a25c536 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Sat, 17 Oct 2026 22:47:15 +0200
+Subject: [PATCH] contrib/eggbitset: disable x64 code paths on 32-bit x86
+
+roaring.h enables USEAVX (and thus IS_X64) whenever __AVX2__ is defined,
+and USESSE4 whenever __POPCNT__ and __SSE4_2__ are defined.  This also
+happens on 32-bit x86 targets such as i686 built with -march=haswell,
+where 64-bit only intrinsics like _mm_popcnt_u64() and
+_mm256_extract_epi64() are not available, so the build fails with:
+
+  roaring.h:260:18: error: implicit declaration of function
+    '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'?
+    [-Wimplicit-function-declaration]
+  roaring.h:1011:23: error: implicit declaration of function
+    '_mm256_extract_epi64'; did you mean '_mm256_extract_epi8'?
+    [-Wimplicit-function-declaration]
+
+Define DISABLE_X64 from the build system when building for 32-bit x86 so
+that the portable implementation is used instead. This keeps the bundled
+CRoaring sources unmodified, making future updates a plain copy.
+DISABLE_X64 is only set for x86, as it also guards the NEON detection
+used on ARM.
+
+Upstream: https://gitlab.gnome.org/GNOME/sysprof/-/commit/22c10f0dbd3c357e96f83f430ebe05d24a25c536
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ contrib/eggbitset/meson.build | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/contrib/eggbitset/meson.build b/contrib/eggbitset/meson.build
+index 82cd8a40..f2f81685 100644
+--- a/contrib/eggbitset/meson.build
++++ b/contrib/eggbitset/meson.build
+@@ -6,9 +6,18 @@ libeggbitset_deps = [
+   gio_dep,
+ ]
+ 
++libeggbitset_c_args = []
++
++# roaring.h enables its x64 code paths based on __AVX2__/__SSE4_2__ alone,
++# but they rely on intrinsics only available on 64-bit x86.
++if host_machine.cpu_family() == 'x86'

package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch line 53

Quoted 10 lines
package/sysprof/0001-contrib-eggbitset-disable-x64-code-paths-on-32-bit-x86.patch new file +10 -0
++  libeggbitset_c_args += ['-DDISABLE_X64']
++endif
++
+ libeggbitset_static = static_library('eggbitset', libeggbitset_sources,
+   gnu_symbol_visibility: 'hidden',
+            dependencies: libeggbitset_deps,
++                 c_args: libeggbitset_c_args,
+ )
+ 
+ libeggbitset_static_dep = declare_dependency(

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