diff mbox series

[v2,2/2] package/dtui: require 64-bit atomic support

Message ID 20260831-wip-obbardc-package-dtui-fix-armv5-v2-2-42eceaa12f55@oss.qualcomm.com
State New
Headers show
Series package/dtui: fix build failure on targets without 64-bit atomics | expand

Commit Message

Chris Obbard Aug. 31, 2026, 3:49 p.m. UTC
dtui depends on tui-textarea which unconditionally imports AtomicU64 in
src/widget.rs to pack a viewport rectangle into a single atomic word:

  use std::sync::atomic::{AtomicU64, Ordering};
  pub struct Viewport(AtomicU64);

As there is no cfg(target_has_atomic) guard in tui-textarea, its
build fails on any target for which rustc does not provide 64-bit
atomics with:

  Compiling tui-textarea v0.7.0
  error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
    --> .../dtui-3.0.0/VENDOR/tui-textarea/src/widget.rs:10:25
     |
  10 | use std::sync::atomic::{AtomicU64, Ordering};
     |                         ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
     |
  help: a similar name exists in the module
     |
  10 - use std::sync::atomic::{AtomicU64, Ordering};
  10 + use std::sync::atomic::{AtomicU32, Ordering};

This has been reported to tui-textarea upstream, but unfortunately the
project seems to be unmaintained (issue linked below). A sane workaround
is to disable the package on targets which lack 64-bit atomic support,
which is exactly what BR2_PACKAGE_HOST_RUSTC_TARGET_HAS_ATOMIC_64
describes: it is n for armv5te-unknown-linux-{gnu,musl}eabi and
powerpc-unknown-linux-gnu, the only rust targets Buildroot can generate
which lack 64-bit atomics, and y everywhere else.

The same problem was hit by package/dust and worked around in commit
3abc3b97bad9 ("package/dust: bump to version 1.1.2") by bumping to a
version in which upstream had added the missing guard. That is not an
option here as tui-textarea 0.7.0 is the latest release.

Note that a runtime test for dtui cannot use the default
infra.basetest.BASIC_TOOLCHAIN_CONFIG, since that builds with
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE, where dtui is now
disabled; such a test would need an armv7 or aarch64 toolchain instead.

Build tested with utils/test-pkg against:
- BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE
- BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_MUSL_STABLE
- BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_POWERPC_E500MC_GLIBC_STABLE

all three fail with the above error before this change and are skipped
after it, while armv7 (glibc and musl), aarch64, powerpc64le and x86-64
still select and build the package.

Link: https://github.com/rhysd/tui-textarea/issues/66
Fixes: https://autobuild.buildroot.org/results/188f6442371500731453f75983590c922eab6d57
Fixes: https://autobuild.buildroot.org/results/e254db2654f18f1d2110eb8b1a32b43ad0f2a3d6
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
---
 package/dtui/Config.in | 2 ++
 1 file changed, 2 insertions(+)

Comments

Romain Naour Sept. 2, 2026, 9:39 p.m. UTC | #1
Hello Christopher, All,

Le 31/08/2026 à 17:49, Christopher Obbard via buildroot a écrit :
> dtui depends on tui-textarea which unconditionally imports AtomicU64 in
> src/widget.rs to pack a viewport rectangle into a single atomic word:
> 
>   use std::sync::atomic::{AtomicU64, Ordering};
>   pub struct Viewport(AtomicU64);
> 
> As there is no cfg(target_has_atomic) guard in tui-textarea, its
> build fails on any target for which rustc does not provide 64-bit
> atomics with:
> 
>   Compiling tui-textarea v0.7.0
>   error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
>     --> .../dtui-3.0.0/VENDOR/tui-textarea/src/widget.rs:10:25
>      |
>   10 | use std::sync::atomic::{AtomicU64, Ordering};
>      |                         ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
>      |
>   help: a similar name exists in the module
>      |
>   10 - use std::sync::atomic::{AtomicU64, Ordering};
>   10 + use std::sync::atomic::{AtomicU32, Ordering};
> 
> This has been reported to tui-textarea upstream, but unfortunately the
> project seems to be unmaintained (issue linked below). A sane workaround
> is to disable the package on targets which lack 64-bit atomic support,
> which is exactly what BR2_PACKAGE_HOST_RUSTC_TARGET_HAS_ATOMIC_64

As discussed in the first patch: BR2_PACKAGE_HOST_RUSTC_ARCH_HAS_ATOMIC_U64

> describes: it is n for armv5te-unknown-linux-{gnu,musl}eabi and
> powerpc-unknown-linux-gnu, the only rust targets Buildroot can generate
> which lack 64-bit atomics, and y everywhere else.
> 
> The same problem was hit by package/dust and worked around in commit
> 3abc3b97bad9 ("package/dust: bump to version 1.1.2") by bumping to a
> version in which upstream had added the missing guard. That is not an
> option here as tui-textarea 0.7.0 is the latest release.
> 
> Note that a runtime test for dtui cannot use the default
> infra.basetest.BASIC_TOOLCHAIN_CONFIG, since that builds with
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE, where dtui is now
> disabled; such a test would need an armv7 or aarch64 toolchain instead.

We have a few test case that are using an armv7 or aarch64 architecture.
We actually plan to switch the Buildroot testsuite to the aarch64 architecture
by default.

A runtime test for dtui is welcome!

> 
> Build tested with utils/test-pkg against:
> - BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE
> - BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_MUSL_STABLE
> - BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_POWERPC_E500MC_GLIBC_STABLE
> 
> all three fail with the above error before this change and are skipped
> after it, while armv7 (glibc and musl), aarch64, powerpc64le and x86-64
> still select and build the package.
> 
> Link: https://github.com/rhysd/tui-textarea/issues/66
> Fixes: https://autobuild.buildroot.org/results/188f6442371500731453f75983590c922eab6d57
> Fixes: https://autobuild.buildroot.org/results/e254db2654f18f1d2110eb8b1a32b43ad0f2a3d6

With BR2_PACKAGE_HOST_RUSTC_ARCH_HAS_ATOMIC_U64 updated:

  Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
> ---
>  package/dtui/Config.in | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/dtui/Config.in b/package/dtui/Config.in
> index 65d51df7d5..aee719a63f 100644
> --- a/package/dtui/Config.in
> +++ b/package/dtui/Config.in
> @@ -3,6 +3,8 @@ config BR2_PACKAGE_DTUI
>  	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
>  	depends on BR2_USE_MMU # dbus
> +	# tui-textarea unconditionally uses AtomicU64
> +	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_HAS_ATOMIC_64
>  	select BR2_PACKAGE_DBUS # runtime
>  	select BR2_PACKAGE_HOST_RUSTC
>  	help
>
diff mbox series

Patch

diff --git a/package/dtui/Config.in b/package/dtui/Config.in
index 65d51df7d5..aee719a63f 100644
--- a/package/dtui/Config.in
+++ b/package/dtui/Config.in
@@ -3,6 +3,8 @@  config BR2_PACKAGE_DTUI
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
 	depends on BR2_USE_MMU # dbus
+	# tui-textarea unconditionally uses AtomicU64
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_HAS_ATOMIC_64
 	select BR2_PACKAGE_DBUS # runtime
 	select BR2_PACKAGE_HOST_RUSTC
 	help