Skip to contentSkip to conversation

package/coreutils: needs toolchain headers >= 5.6 (32-bit system with 64-bit time_t)

RFC In review Peter Seiderer 3 participants 3 messages May 10, 2023 – Jun 4, 2023

lore
Share & tools
lore
#0 lore raw

RFC 1/1 package/coreutils: needs toolchain headers >= 5.6 (32-bit system with 64-bit time_t)

Add coreutils dependency on toolchain headers >= 5.6 for 32-bit system to gain access to 64-bit time_t.

Fixes:

http://autobuild.buildroot.net/results/a5bac0aaadea43fcedf3a51b070e605e3906c237

checking for .../host/bin/arm-none-linux-gnueabi-gcc -std=gnu11 option to enable timestamps after Jan 2038... support not detected
configure: error: in '.../build/coreutils-9.3':
configure: error: support for timestamps after Jan 2038 is required

---
Notes:
- Config.in comment section for package/glslsandbox-player and package/opkg-utils missing
- Not sure if this is sufficient (e.g. possible libc system and/or version dependency), other possible solution would be something like introducing BR2_TOOLCHAIN_HAS_64_BIT_TIME_T

---
 package/coreutils/Config.in          | 6 ++++--
 package/glslsandbox-player/Config.in | 1 +
 package/opkg-utils/Config.in         | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)
package/coreutils/Config.in +4 -2
index 705013bae0..968c7a97cd 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_COREUTILS
 	bool "coreutils"
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64
 	depends on BR2_USE_WCHAR
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
@@ -33,7 +34,8 @@ comment "coreutils individual binaries need a toolchain w/ dynamic library"
 
 endif
 
-comment "coreutils needs a toolchain w/ wchar"
+comment "coreutils needs a toolchain w/ headers >= 5.6 (32-bit only), wchar"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 && !BR2_ARCH_IS_64 || \
+		!BR2_USE_WCHAR
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/glslsandbox-player/Config.in +1 -0
index 530c158fc3..78d6dd9a6f 100644
@@ -32,6 +32,7 @@ config BR2_PACKAGE_GLSLSANDBOX_PLAYER_SCRIPTS
 	bool "Install scripts"
 	depends on !BR2_STATIC_LIBS # python3
 	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64 # coreutls
 	depends on BR2_USE_MMU # bash, python3
 	depends on BR2_USE_WCHAR # python3
 	select BR2_PACKAGE_BASH # runtime
package/opkg-utils/Config.in +2 -0
index 2973055baf..cdefa193b7 100644
@@ -3,6 +3,8 @@ config BR2_PACKAGE_OPKG_UTILS
 	depends on !BR2_nios2 || BR2_PACKAGE_BUSYBOX # binutils
 	depends on BR2_USE_MMU # bash, python3
 	depends on BR2_USE_WCHAR # python3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64 || \
+		BR2_PACKAGE_BUSYBOX # coreutils
 	depends on BR2_TOOLCHAIN_HAS_THREADS # python3 <- libffi
 	depends on !BR2_STATIC_LIBS # python3
 	select BR2_PACKAGE_BINUTILS if !BR2_PACKAGE_BUSYBOX # runtime
Signature · 6 lines
2.40.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines · Peter Seiderer

Add coreutils dependency on toolchain headers >= 5.6 for 32-bit system to gain access to 64-bit time_t.

Fixes:

http://autobuild.buildroot.net/results/a5bac0aaadea43fcedf3a51b070e605e3906c237

checking for .../host/bin/arm-none-linux-gnueabi-gcc -std=gnu11 option to enable timestamps after Jan 2038... support not detected
configure: error: in '.../build/coreutils-9.3':
configure: error: support for timestamps after Jan 2038 is required

Quoted 8 lines

---
Notes:
- Config.in comment section for package/glslsandbox-player and package/opkg-utils missing
- Not sure if this is sufficient (e.g. possible libc system and/or version dependency), other possible solution would be something like introducing BR2_TOOLCHAIN_HAS_64_BIT_TIME_T

The current situation of 64-bit time_t is:

	depends on BR2_ARCH_IS_64 || \
		BR2_TOOLCHAIN_USES_MUSL || \
		(BR2_TOOLCHAIN_USES_GLIBC && BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6)

i.e.:
- 64-bit platforms always have 64-bit time.
- musl AFAIK always has 64-bit time in the headers (not sure what happens in
the actual syscalls).
- uClibc never has 64-bit time.
- glibc has 64-bit time with sufficiently recent headers.

It's actually a bit more complicated still, because on some architectures
(riscv for example), there's always 64-bit time even if it's a 32-bit architecture. So on those, even uClibc has 64-bit time.

Because of all this complexity, I think it's better to introduce something
like BR2_TOOLCHAIN_HAS_TIME_T_64 that encodes those conditions. It would be a blind symbol that defaults y for 64-bit architectures and is selected by the respective arch or toolchain symbols. It's a bit complicated that way, but gives us most flexibility to get all the conditions right. For instance, in external toolchains it would only be selected if glibc is sufficiently recent.

Therefore, I've marked this patch as Changes Requested. But I also added the
other matinainters in Cc because they may have different opinions.

Regards,
Arnout

Quoted 45 lines
---
  package/coreutils/Config.in          | 6 ++++--
  package/glslsandbox-player/Config.in | 1 +
  package/opkg-utils/Config.in         | 2 ++
  3 files changed, 7 insertions(+), 2 deletions(-)
package/coreutils/Config.in +4 -2
index 705013bae0..968c7a97cd 100644
@@ -1,5 +1,6 @@
  config BR2_PACKAGE_COREUTILS
  	bool "coreutils"
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64
  	depends on BR2_USE_WCHAR
  	depends on BR2_USE_MMU # fork()
  	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
@@ -33,7 +34,8 @@ comment "coreutils individual binaries need a toolchain w/ dynamic library"
 
  endif
 
-comment "coreutils needs a toolchain w/ wchar"
+comment "coreutils needs a toolchain w/ headers >= 5.6 (32-bit only), wchar"
  	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 && !BR2_ARCH_IS_64 || \
+		!BR2_USE_WCHAR
  	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/glslsandbox-player/Config.in +1 -0
index 530c158fc3..78d6dd9a6f 100644
@@ -32,6 +32,7 @@ config BR2_PACKAGE_GLSLSANDBOX_PLAYER_SCRIPTS
  	bool "Install scripts"
  	depends on !BR2_STATIC_LIBS # python3
  	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64 # coreutls
  	depends on BR2_USE_MMU # bash, python3
  	depends on BR2_USE_WCHAR # python3
  	select BR2_PACKAGE_BASH # runtime
package/opkg-utils/Config.in +0 -0
index 2973055baf..cdefa193b7 100644

package/opkg-utils/Config.in config BR2_PACKAGE_OPKG_UTILS · line 10

Quoted 8 lines
package/opkg-utils/Config.in +2 -0
@@ -3,6 +3,8 @@ config BR2_PACKAGE_OPKG_UTILS
  	depends on !BR2_nios2 || BR2_PACKAGE_BUSYBOX # binutils
  	depends on BR2_USE_MMU # bash, python3
  	depends on BR2_USE_WCHAR # python3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_6 || BR2_ARCH_IS_64 || \
+		BR2_PACKAGE_BUSYBOX # coreutils
  	depends on BR2_TOOLCHAIN_HAS_THREADS # python3 <- libffi
  	depends on !BR2_STATIC_LIBS # python3
  	select BR2_PACKAGE_BINUTILS if !BR2_PACKAGE_BUSYBOX # runtime

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

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 11 lines

Because of all this complexity, I think it's better to introduce something like BR2_TOOLCHAIN_HAS_TIME_T_64 that encodes those
conditions. It would be a blind symbol that defaults y for 64-bit architectures and is selected by the respective arch or toolchain symbols. It's a bit complicated that way, but gives us most flexibility to get all the conditions right. For instance, in external toolchains it would only be selected if glibc is sufficiently recent.

Therefore, I've marked this patch as Changes Requested. But I also added the other matinainters in Cc because they may have different
opinions.

No, I agree - Nice summary!

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