All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
@ 2022-11-08  0:08 Niko Mauno
  2022-11-08  0:08 ` [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc Niko Mauno
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Niko Mauno @ 2022-11-08  0:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Niko Mauno

Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
time on 32 bit host applications when glibc is used. Prerequisites
are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.

Example of impact on 32 bit 'qemuarm' machine running
core-image-minimal. Before this change:

  root@qemuarm:~# /bin/busybox date
  Sun Nov  6 06:09:39 UTC 2022
  root@qemuarm:~# /sbin/hwclock.util-linux -w
  root@qemuarm:~# /sbin/hwclock.util-linux
  2022-11-06 06:09:49.994249+00:00
  root@qemuarm:~# /bin/busybox date -s 2040-01-01
  date: invalid date '2040-01-01'
  root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
  Sun Jan  1 00:00:00 UTC 2040
  root@qemuarm:~# /sbin/hwclock.util-linux -w
  root@qemuarm:~# /sbin/hwclock.util-linux
  1931-03-04 06:26:23.000000+00:00
  root@qemuarm:~#

After this change:

  root@qemuarm:~# /bin/busybox date
  Sun Nov  6 06:02:20 UTC 2022
  root@qemuarm:~# /sbin/hwclock.util-linux -w
  root@qemuarm:~# /sbin/hwclock.util-linux
  2022-11-06 06:02:27.989730+00:00
  root@qemuarm:~# /bin/busybox date -s 2040-01-01
  Sun Jan  1 00:00:00 UTC 2040
  root@qemuarm:~# /sbin/hwclock.util-linux -w
  root@qemuarm:~# /sbin/hwclock.util-linux
  2040-01-01 00:00:20.992954+00:00
  root@qemuarm:~#

From here on, the adding of new flags can be disabled on recipe or
global level by resetting the value of associated variable containing
the CPPFLAGS specific for 64 bit time

  GLIBC_64BIT_TIME_CPPFLAGS = ""

which can be useful e.g. when working around failure to compile a
component due to lack of 64 bit time support on 32 bit build in the
component's source code.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
 meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
 meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
 meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
index f48d16939e..95770298e9 100644
--- a/meta/conf/distro/include/tclibc-glibc.inc
+++ b/meta/conf/distro/include/tclibc-glibc.inc
@@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
 
 CXXFLAGS += "-fvisibility-inlines-hidden"
 
+GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
+TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
+
 LIBC_DEPENDENCIES = "\
 		     glibc \
 		     glibc-dbg \
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
index 8bda2ccad6..b3fafa0ea4 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
@@ -5,3 +5,5 @@ require gcc-sanitizers.inc
 # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
 ARM_INSTRUCTION_SET:armv4 = "arm"
 ARM_INSTRUCTION_SET:armv5 = "arm"
+
+GLIBC_64BIT_TIME_CPPFLAGS = ""
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index c34580b4ff..7734d0fbb0 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
 
 # error: use of undeclared identifier '_STAT_VER'
 COMPATIBLE_HOST:libc-musl = 'null'
+
+GLIBC_64BIT_TIME_CPPFLAGS = ""
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08  0:08 [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Niko Mauno
@ 2022-11-08  0:08 ` Niko Mauno
  2022-11-08  9:14   ` [OE-core] " Alexander Kanavin
  2022-11-08  0:08 ` [RFC PATCH 3/3] pulseaudio: " Niko Mauno
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 23+ messages in thread
From: Niko Mauno @ 2022-11-08  0:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Niko Mauno

For now add exemption in order to avoid following failure during
do_compile()

  | .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
  | collect2: error: ld returned 1 exit status

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
 meta/recipes-core/kbd/kbd_2.5.1.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb b/meta/recipes-core/kbd/kbd_2.5.1.bb
index aa3ab6e121..b623aecd36 100644
--- a/meta/recipes-core/kbd/kbd_2.5.1.bb
+++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
@@ -18,6 +18,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
 
 SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
 
+# Compiling 64 bit time for 32 bit host is broken
+GLIBC_64BIT_TIME_CPPFLAGS = ""
+
 PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                   "
 
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [RFC PATCH 3/3] pulseaudio: Disable 64 bit time with 32 bit glibc
  2022-11-08  0:08 [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Niko Mauno
  2022-11-08  0:08 ` [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc Niko Mauno
@ 2022-11-08  0:08 ` Niko Mauno
  2022-11-08 10:17   ` [OE-core] " Peter Kjellerstedt
  2022-11-08  3:30 ` [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Khem Raj
  2022-11-08 10:51 ` Ola x Nilsson
  3 siblings, 1 reply; 23+ messages in thread
From: Niko Mauno @ 2022-11-08  0:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Niko Mauno

For now add exemption in order to avoid following kind of failures
during do_compile()

  | ../pulseaudio-16.1/src/modules/bluetooth/bt-codec-cvsd.c:55:22: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
  |    55 |         pa_log_debug("Got invalid block size: %lu, rounding down", block_size);
  |       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~
  |       |                                                                    |
  |       |                                                                    size_t {aka unsigned int}

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
---
 meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
index 64002cd1cc..ee4f8c7ed3 100644
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
@@ -8,3 +8,6 @@ SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
            "
 SRC_URI[sha256sum] = "8eef32ce91d47979f95fd9a935e738cd7eb7463430dabc72863251751e504ae4"
 UPSTREAM_CHECK_REGEX = "pulseaudio-(?P<pver>\d+(\.(?!99)\d+)+)\.tar"
+
+# Compiling 64 bit time for 32 bit host is broken
+GLIBC_64BIT_TIME_CPPFLAGS = ""
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
  2022-11-08  0:08 [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Niko Mauno
  2022-11-08  0:08 ` [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc Niko Mauno
  2022-11-08  0:08 ` [RFC PATCH 3/3] pulseaudio: " Niko Mauno
@ 2022-11-08  3:30 ` Khem Raj
  2022-11-08 10:51 ` Ola x Nilsson
  3 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2022-11-08  3:30 UTC (permalink / raw)
  To: niko.mauno; +Cc: openembedded-core

On Mon, Nov 7, 2022 at 4:09 PM Niko Mauno via lists.openembedded.org
<niko.mauno=vaisala.com@lists.openembedded.org> wrote:
>
> Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
> time on 32 bit host applications when glibc is used. Prerequisites
> are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.
>
> Example of impact on 32 bit 'qemuarm' machine running
> core-image-minimal. Before this change:
>
>   root@qemuarm:~# /bin/busybox date
>   Sun Nov  6 06:09:39 UTC 2022
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2022-11-06 06:09:49.994249+00:00
>   root@qemuarm:~# /bin/busybox date -s 2040-01-01
>   date: invalid date '2040-01-01'
>   root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
>   Sun Jan  1 00:00:00 UTC 2040
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   1931-03-04 06:26:23.000000+00:00
>   root@qemuarm:~#
>
> After this change:
>
>   root@qemuarm:~# /bin/busybox date
>   Sun Nov  6 06:02:20 UTC 2022
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2022-11-06 06:02:27.989730+00:00
>   root@qemuarm:~# /bin/busybox date -s 2040-01-01
>   Sun Jan  1 00:00:00 UTC 2040
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2040-01-01 00:00:20.992954+00:00
>   root@qemuarm:~#
>
> From here on, the adding of new flags can be disabled on recipe or
> global level by resetting the value of associated variable containing
> the CPPFLAGS specific for 64 bit time
>
>   GLIBC_64BIT_TIME_CPPFLAGS = ""
>
> which can be useful e.g. when working around failure to compile a
> component due to lack of 64 bit time support on 32 bit build in the
> component's source code.
>
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
>  meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
>  meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
>  3 files changed, 7 insertions(+)
>
> diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
> index f48d16939e..95770298e9 100644
> --- a/meta/conf/distro/include/tclibc-glibc.inc
> +++ b/meta/conf/distro/include/tclibc-glibc.inc
> @@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
>
>  CXXFLAGS += "-fvisibility-inlines-hidden"
>
> +GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
> +TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"

We only need it for 32bit systems and not for 64bit systems. So
perhaps we need it for only 32bit systems.

> +
>  LIBC_DEPENDENCIES = "\
>                      glibc \
>                      glibc-dbg \
> diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> index 8bda2ccad6..b3fafa0ea4 100644
> --- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> @@ -5,3 +5,5 @@ require gcc-sanitizers.inc
>  # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
>  ARM_INSTRUCTION_SET:armv4 = "arm"
>  ARM_INSTRUCTION_SET:armv5 = "arm"
> +
> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> index c34580b4ff..7734d0fbb0 100644
> --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> @@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
>
>  # error: use of undeclared identifier '_STAT_VER'
>  COMPATIBLE_HOST:libc-musl = 'null'
> +
> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> --
> 2.36.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172939): https://lists.openembedded.org/g/openembedded-core/message/172939
> Mute This Topic: https://lists.openembedded.org/mt/94880624/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08  0:08 ` [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc Niko Mauno
@ 2022-11-08  9:14   ` Alexander Kanavin
  2022-11-08 11:48     ` Niko Mauno
  2022-11-08 16:40     ` Khem Raj
  0 siblings, 2 replies; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08  9:14 UTC (permalink / raw)
  To: niko.mauno; +Cc: openembedded-core

We do build for 32 bit arm targets, so is this seen only in specific
circumstances? What are they?

Alex

On Tue, 8 Nov 2022 at 01:09, Niko Mauno via lists.openembedded.org
<niko.mauno=vaisala.com@lists.openembedded.org> wrote:
>
> For now add exemption in order to avoid following failure during
> do_compile()
>
>   | .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
>   | collect2: error: ld returned 1 exit status
>
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  meta/recipes-core/kbd/kbd_2.5.1.bb | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb b/meta/recipes-core/kbd/kbd_2.5.1.bb
> index aa3ab6e121..b623aecd36 100644
> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
> @@ -18,6 +18,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>
>  SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>
> +# Compiling 64 bit time for 32 bit host is broken
> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> +
>  PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
>                    "
>
> --
> 2.36.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172940): https://lists.openembedded.org/g/openembedded-core/message/172940
> Mute This Topic: https://lists.openembedded.org/mt/94880633/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [OE-core] [RFC PATCH 3/3] pulseaudio: Disable 64 bit time with 32 bit glibc
  2022-11-08  0:08 ` [RFC PATCH 3/3] pulseaudio: " Niko Mauno
@ 2022-11-08 10:17   ` Peter Kjellerstedt
  0 siblings, 0 replies; 23+ messages in thread
From: Peter Kjellerstedt @ 2022-11-08 10:17 UTC (permalink / raw)
  To: niko.mauno, openembedded-core

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Niko Mauno via
> lists.openembedded.org
> Sent: den 8 november 2022 01:08
> To: openembedded-core@lists.openembedded.org
> Cc: Niko Mauno <niko.mauno@vaisala.com>
> Subject: [OE-core] [RFC PATCH 3/3] pulseaudio: Disable 64 bit time with 32 bit glibc
> 
> For now add exemption in order to avoid following kind of failures
> during do_compile()
> 
>   | ../pulseaudio-16.1/src/modules/bluetooth/bt-codec-cvsd.c:55:22: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
>   |    55 |         pa_log_debug("Got invalid block size: %lu, rounding down", block_size);
>   |       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~
>   |       |                                                                    |
>   |       |                                                                    size_t {aka unsigned int}
> 
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
> index 64002cd1cc..ee4f8c7ed3 100644
> --- a/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
> +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_16.1.bb
> @@ -8,3 +8,6 @@ SRC_URI =
> "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
>             "
>  SRC_URI[sha256sum] = "8eef32ce91d47979f95fd9a935e738cd7eb7463430dabc72863251751e504ae4"
>  UPSTREAM_CHECK_REGEX = "pulseaudio-(?P<pver>\d+(\.(?!99)\d+)+)\.tar"
> +
> +# Compiling 64 bit time for 32 bit host is broken
> +GLIBC_64BIT_TIME_CPPFLAGS = ""

Rather than hiding the problem, you should patch the code to use %zu instead 
of %lu. And please send the patch upstream.

> --
> 2.36.1

//Peter



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
  2022-11-08  0:08 [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Niko Mauno
                   ` (2 preceding siblings ...)
  2022-11-08  3:30 ` [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Khem Raj
@ 2022-11-08 10:51 ` Ola x Nilsson
  2022-11-08 16:38   ` Khem Raj
                     ` (2 more replies)
  3 siblings, 3 replies; 23+ messages in thread
From: Ola x Nilsson @ 2022-11-08 10:51 UTC (permalink / raw)
  To: openembedded-core; +Cc: niko.mauno


I'm working on the same thing, but I put GLIBC_64BIT_TIME_CPPFLAGS in
TARGET_CC_ARCH instead to make sure they applied everywhere.

I'd be interested to hear what others think is the best place to put
these flags.

I'm also looking at QA tests to make sure that no application or shared
object is still using 32bit time or file functions from glibc.

/Ola

On Tue, Nov 08 2022, Niko Mauno via lists.openembedded.org wrote:

> Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
> time on 32 bit host applications when glibc is used. Prerequisites
> are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.
>
> Example of impact on 32 bit 'qemuarm' machine running
> core-image-minimal. Before this change:
>
>   root@qemuarm:~# /bin/busybox date
>   Sun Nov  6 06:09:39 UTC 2022
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2022-11-06 06:09:49.994249+00:00
>   root@qemuarm:~# /bin/busybox date -s 2040-01-01
>   date: invalid date '2040-01-01'
>   root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
>   Sun Jan  1 00:00:00 UTC 2040
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   1931-03-04 06:26:23.000000+00:00
>   root@qemuarm:~#
>
> After this change:
>
>   root@qemuarm:~# /bin/busybox date
>   Sun Nov  6 06:02:20 UTC 2022
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2022-11-06 06:02:27.989730+00:00
>   root@qemuarm:~# /bin/busybox date -s 2040-01-01
>   Sun Jan  1 00:00:00 UTC 2040
>   root@qemuarm:~# /sbin/hwclock.util-linux -w
>   root@qemuarm:~# /sbin/hwclock.util-linux
>   2040-01-01 00:00:20.992954+00:00
>   root@qemuarm:~#
>
> From here on, the adding of new flags can be disabled on recipe or
> global level by resetting the value of associated variable containing
> the CPPFLAGS specific for 64 bit time
>
>   GLIBC_64BIT_TIME_CPPFLAGS = ""
>
> which can be useful e.g. when working around failure to compile a
> component due to lack of 64 bit time support on 32 bit build in the
> component's source code.
>
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
>  meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
>  meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
>  3 files changed, 7 insertions(+)
>
> diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
> index f48d16939e..95770298e9 100644
> --- a/meta/conf/distro/include/tclibc-glibc.inc
> +++ b/meta/conf/distro/include/tclibc-glibc.inc
> @@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
>  
>  CXXFLAGS += "-fvisibility-inlines-hidden"
>  
> +GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
> +TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
> +
>  LIBC_DEPENDENCIES = "\
>  		     glibc \
>  		     glibc-dbg \
> diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> index 8bda2ccad6..b3fafa0ea4 100644
> --- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> @@ -5,3 +5,5 @@ require gcc-sanitizers.inc
>  # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
>  ARM_INSTRUCTION_SET:armv4 = "arm"
>  ARM_INSTRUCTION_SET:armv5 = "arm"
> +
> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> index c34580b4ff..7734d0fbb0 100644
> --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> @@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
>  
>  # error: use of undeclared identifier '_STAT_VER'
>  COMPATIBLE_HOST:libc-musl = 'null'
> +
> +GLIBC_64BIT_TIME_CPPFLAGS = ""



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08  9:14   ` [OE-core] " Alexander Kanavin
@ 2022-11-08 11:48     ` Niko Mauno
  2022-11-08 11:50       ` Alexander Kanavin
  2022-11-08 16:40     ` Khem Raj
  1 sibling, 1 reply; 23+ messages in thread
From: Niko Mauno @ 2022-11-08 11:48 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core

I have not studied the issue, but in order to reproduce this error I add 
'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against 
current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64 
-D_FILE_OFFSET_BITS=64".

-Niko

On 8.11.2022 11.14, Alexander Kanavin wrote:
> We do build for 32 bit arm targets, so is this seen only in specific
> circumstances? What are they?
> 
> Alex
> 
> On Tue, 8 Nov 2022 at 01:09, Niko Mauno via lists.openembedded.org
> <niko.mauno=vaisala.com@lists.openembedded.org> wrote:
>>
>> For now add exemption in order to avoid following failure during
>> do_compile()
>>
>>    | .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
>>    | collect2: error: ld returned 1 exit status
>>
>> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
>> ---
>>   meta/recipes-core/kbd/kbd_2.5.1.bb | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb b/meta/recipes-core/kbd/kbd_2.5.1.bb
>> index aa3ab6e121..b623aecd36 100644
>> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>> @@ -18,6 +18,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>>
>>   SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>>
>> +# Compiling 64 bit time for 32 bit host is broken
>> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>> +
>>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
>>                     "
>>
>> --
>> 2.36.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#172940): https://lists.openembedded.org/g/openembedded-core/message/172940
>> Mute This Topic: https://lists.openembedded.org/mt/94880633/1686489
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
>> -=-=-=-=-=-=-=-=-=-=-=-
>>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 11:48     ` Niko Mauno
@ 2022-11-08 11:50       ` Alexander Kanavin
  2022-11-08 12:04         ` Niko Mauno
  0 siblings, 1 reply; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08 11:50 UTC (permalink / raw)
  To: Niko Mauno; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

So you need to set -D_TIME_BITS=64
-D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t the
defaults work?

Alex

On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com> wrote:

> I have not studied the issue, but in order to reproduce this error I add
> 'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
> current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
> -D_FILE_OFFSET_BITS=64".
>
> -Niko
>
> On 8.11.2022 11.14, Alexander Kanavin wrote:
> > We do build for 32 bit arm targets, so is this seen only in specific
> > circumstances? What are they?
> >
> > Alex
> >
> > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via lists.openembedded.org
> > <niko.mauno=vaisala.com@lists.openembedded.org> wrote:
> >>
> >> For now add exemption in order to avoid following failure during
> >> do_compile()
> >>
> >>    |
> .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
> syntax error in VERSION script
> >>    | collect2: error: ld returned 1 exit status
> >>
> >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> >> ---
> >>   meta/recipes-core/kbd/kbd_2.5.1.bb | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
> b/meta/recipes-core/kbd/kbd_2.5.1.bb
> >> index aa3ab6e121..b623aecd36 100644
> >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
> >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
> >> @@ -18,6 +18,9 @@ SRC_URI =
> "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
> >>
> >>   SRC_URI[sha256sum] =
> "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
> >>
> >> +# Compiling 64 bit time for 32 bit host is broken
> >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> >> +
> >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
> >>                     "
> >>
> >> --
> >> 2.36.1
> >>
> >>
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >> Links: You receive all messages sent to this group.
> >> View/Reply Online (#172940):
> https://lists.openembedded.org/g/openembedded-core/message/172940
> >> Mute This Topic: https://lists.openembedded.org/mt/94880633/1686489
> >> Group Owner: openembedded-core+owner@lists.openembedded.org
> >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
>

[-- Attachment #2: Type: text/html, Size: 4710 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 11:50       ` Alexander Kanavin
@ 2022-11-08 12:04         ` Niko Mauno
  2022-11-08 12:18           ` Alexander Kanavin
       [not found]           ` <17259B3874804FB3.24550@lists.openembedded.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Niko Mauno @ 2022-11-08 12:04 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core

My understanding wrt. Y2038 and 32-bit glibc hosts was such that it 
makes sense to set said compiler flags globally to ensure user space 
wide Y2038 compliance. So I encountered this compiler error while 
building poky reference images with additional effective

   TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"

declaration in meta/conf/distro/include/tclibc-glibc.inc.

-Niko

On 8.11.2022 13.50, Alexander Kanavin wrote:
> So you need to set -D_TIME_BITS=64
> -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t 
> the defaults work?
> 
> Alex
> 
> On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com 
> <mailto:niko.mauno@vaisala.com>> wrote:
> 
>     I have not studied the issue, but in order to reproduce this error I
>     add
>     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>     -D_FILE_OFFSET_BITS=64".
> 
>     -Niko
> 
>     On 8.11.2022 11.14, Alexander Kanavin wrote:
>      > We do build for 32 bit arm targets, so is this seen only in specific
>      > circumstances? What are they?
>      >
>      > Alex
>      >
>      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>     lists.openembedded.org
>     <http://lists.openembedded.org/
>      > <niko.mauno=vaisala.com@lists.openembedded.org
>     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>      >>
>      >> For now add exemption in order to avoid following failure during
>      >> do_compile()
>      >>
>      >>    |
>     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
>      >>    | collect2: error: ld returned 1 exit status
>      >>
>      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>     <mailto:niko.mauno@vaisala.com>>
>      >> ---
>      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>     <http://kbd_2.5.1.bb/
>      >>   1 file changed, 3 insertions(+)
>      >>
>      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>     <http://kbd_2.5.1.bb/
>      >> index aa3ab6e121..b623aecd36 100644
>      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>     <http://kbd_2.5.1.bb/
>      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>     <http://kbd_2.5.1.bb/
>      >> @@ -18,6 +18,9 @@ SRC_URI =
>     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>      >>
>      >>   SRC_URI[sha256sum] =
>     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>      >>
>      >> +# Compiling 64 bit time for 32 bit host is broken
>      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>      >> +
>      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>     d)} \
>      >>                     "
>      >>
>      >> --
>      >> 2.36.1
>      >>
>      >>
>      >> -=-=-=-=-=-=-=-=-=-=-=-
>      >> Links: You receive all messages sent to this group.
>      >> View/Reply Online (#172940):
>     https://lists.openembedded.org/g/openembedded-core/message/172940
>     <https://lists.openembedded.org/g/openembedded-core/message/172940
>      >> Mute This Topic:
>     https://lists.openembedded.org/mt/94880633/1686489
>     <https://lists.openembedded.org/mt/94880633/1686489
>      >> Group Owner: openembedded-core+owner@lists.openembedded.org
>     <mailto:openembedded-core%2Bowner@lists.openembedded.org>
>      >> Unsubscribe:
>     https://lists.openembedded.org/g/openembedded-core/unsub
>     <https://lists.openembedded.org/g/openembedded-core/unsub
>      >> -=-=-=-=-=-=-=-=-=-=-=-
>      >>
> 


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 12:04         ` Niko Mauno
@ 2022-11-08 12:18           ` Alexander Kanavin
       [not found]           ` <17259B3874804FB3.24550@lists.openembedded.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08 12:18 UTC (permalink / raw)
  To: Niko Mauno; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 4088 bytes --]

Is this a recommendation somewhere official?

Alex

On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:

> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
> makes sense to set said compiler flags globally to ensure user space
> wide Y2038 compliance. So I encountered this compiler error while
> building poky reference images with additional effective
>
>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>
> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>
> -Niko
>
> On 8.11.2022 13.50, Alexander Kanavin wrote:
> > So you need to set -D_TIME_BITS=64
> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
> > the defaults work?
> >
> > Alex
> >
> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
> > <mailto:niko.mauno@vaisala.com>> wrote:
> >
> >     I have not studied the issue, but in order to reproduce this error I
> >     add
> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
> >     -D_FILE_OFFSET_BITS=64".
> >
> >     -Niko
> >
> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
> >      > We do build for 32 bit arm targets, so is this seen only in
> specific
> >      > circumstances? What are they?
> >      >
> >      > Alex
> >      >
> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
> >     lists.openembedded.org
> >     <http://lists.openembedded.org/
> >      > <niko.mauno=vaisala.com@lists.openembedded.org
> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
> >      >>
> >      >> For now add exemption in order to avoid following failure during
> >      >> do_compile()
> >      >>
> >      >>    |
> >
>  .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
> syntax error in VERSION script
> >      >>    | collect2: error: ld returned 1 exit status
> >      >>
> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
> >     <mailto:niko.mauno@vaisala.com>>
> >      >> ---
> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
> >     <http://kbd_2.5.1.bb/
> >      >>   1 file changed, 3 insertions(+)
> >      >>
> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
> >     <http://kbd_2.5.1.bb/
> >      >> index aa3ab6e121..b623aecd36 100644
> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
> >     <http://kbd_2.5.1.bb/
> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
> >     <http://kbd_2.5.1.bb/
> >      >> @@ -18,6 +18,9 @@ SRC_URI =
> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
> >      >>
> >      >>   SRC_URI[sha256sum] =
> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
> >      >>
> >      >> +# Compiling 64 bit time for 32 bit host is broken
> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> >      >> +
> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
> >     d)} \
> >      >>                     "
> >      >>
> >      >> --
> >      >> 2.36.1
> >      >>
> >      >>
> >      >> -=-=-=-=-=-=-=-=-=-=-=-
> >      >> Links: You receive all messages sent to this group.
> >      >> View/Reply Online (#172940):
> >     https://lists.openembedded.org/g/openembedded-core/message/172940
> >     <https://lists.openembedded.org/g/openembedded-core/message/172940
> >      >> Mute This Topic:
> >     https://lists.openembedded.org/mt/94880633/1686489
> >     <https://lists.openembedded.org/mt/94880633/1686489
> >      >> Group Owner: openembedded-core+owner@lists.openembedded.org
> >     <mailto:openembedded-core%2Bowner@lists.openembedded.org>
> >      >> Unsubscribe:
> >     https://lists.openembedded.org/g/openembedded-core/unsub
> >     <https://lists.openembedded.org/g/openembedded-core/unsub
> >      >> -=-=-=-=-=-=-=-=-=-=-=-
> >      >>
> >
>

[-- Attachment #2: Type: text/html, Size: 7444 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
       [not found]           ` <17259B3874804FB3.24550@lists.openembedded.org>
@ 2022-11-08 12:57             ` Alexander Kanavin
  2022-11-08 14:56               ` Ola x Nilsson
  0 siblings, 1 reply; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08 12:57 UTC (permalink / raw)
  To: alex.kanavin; +Cc: Niko Mauno, openembedded-core

I suppose what I want to say is - perhaps this should be discussed
with upstreams first? Things should 'just work' without having to set
some magic flags in an external configuration.

Alex

On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
wrote:
>
> Is this a recommendation somewhere official?
>
> Alex
>
> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
>>
>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
>> makes sense to set said compiler flags globally to ensure user space
>> wide Y2038 compliance. So I encountered this compiler error while
>> building poky reference images with additional effective
>>
>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>>
>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>>
>> -Niko
>>
>> On 8.11.2022 13.50, Alexander Kanavin wrote:
>> > So you need to set -D_TIME_BITS=64
>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
>> > the defaults work?
>> >
>> > Alex
>> >
>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
>> > <mailto:niko.mauno@vaisala.com>> wrote:
>> >
>> >     I have not studied the issue, but in order to reproduce this error I
>> >     add
>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>> >     -D_FILE_OFFSET_BITS=64".
>> >
>> >     -Niko
>> >
>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
>> >      > We do build for 32 bit arm targets, so is this seen only in specific
>> >      > circumstances? What are they?
>> >      >
>> >      > Alex
>> >      >
>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>> >     lists.openembedded.org
>> >     <http://lists.openembedded.org/
>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>> >      >>
>> >      >> For now add exemption in order to avoid following failure during
>> >      >> do_compile()
>> >      >>
>> >      >>    |
>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
>> >      >>    | collect2: error: ld returned 1 exit status
>> >      >>
>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>> >     <mailto:niko.mauno@vaisala.com>>
>> >      >> ---
>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>> >     <http://kbd_2.5.1.bb/
>> >      >>   1 file changed, 3 insertions(+)
>> >      >>
>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >     <http://kbd_2.5.1.bb/
>> >      >> index aa3ab6e121..b623aecd36 100644
>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >     <http://kbd_2.5.1.bb/
>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >     <http://kbd_2.5.1.bb/
>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>> >      >>
>> >      >>   SRC_URI[sha256sum] =
>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>> >      >>
>> >      >> +# Compiling 64 bit time for 32 bit host is broken
>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>> >      >> +
>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>> >     d)} \
>> >      >>                     "
>> >      >>
>> >      >> --
>> >      >> 2.36.1
>> >      >>
>> >      >>
>> >      >>
>> >      >>
>> >
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172964): https://lists.openembedded.org/g/openembedded-core/message/172964
> Mute This Topic: https://lists.openembedded.org/mt/94880633/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 12:57             ` Alexander Kanavin
@ 2022-11-08 14:56               ` Ola x Nilsson
  2022-11-08 15:00                 ` Ola x Nilsson
       [not found]                 ` <1725A47F2FC9966F.2170@lists.openembedded.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Ola x Nilsson @ 2022-11-08 14:56 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Niko Mauno, openembedded-core


As far as I can tell from glibc's documentation, this is how you are
supposed to do it.  glibc chose to always support both 32 and 64 bit
APIs for time and file offset and make the normal int size the default.
musl chose to switch to 64bit altogether. 

https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html

/Ola

On Tue, Nov 08 2022, Alexander Kanavin wrote:

> I suppose what I want to say is - perhaps this should be discussed
> with upstreams first? Things should 'just work' without having to set
> some magic flags in an external configuration.
>
> Alex
>
> On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
> wrote:
>>
>> Is this a recommendation somewhere official?
>>
>> Alex
>>
>> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
>>>
>>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
>>> makes sense to set said compiler flags globally to ensure user space
>>> wide Y2038 compliance. So I encountered this compiler error while
>>> building poky reference images with additional effective
>>>
>>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>>>
>>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>>>
>>> -Niko
>>>
>>> On 8.11.2022 13.50, Alexander Kanavin wrote:
>>> > So you need to set -D_TIME_BITS=64
>>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
>>> > the defaults work?
>>> >
>>> > Alex
>>> >
>>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
>>> > <mailto:niko.mauno@vaisala.com>> wrote:
>>> >
>>> >     I have not studied the issue, but in order to reproduce this error I
>>> >     add
>>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>>> >     -D_FILE_OFFSET_BITS=64".
>>> >
>>> >     -Niko
>>> >
>>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
>>> >      > We do build for 32 bit arm targets, so is this seen only in specific
>>> >      > circumstances? What are they?
>>> >      >
>>> >      > Alex
>>> >      >
>>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>>> >     lists.openembedded.org
>>> >     <http://lists.openembedded.org/
>>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
>>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>>> >      >>
>>> >      >> For now add exemption in order to avoid following failure during
>>> >      >> do_compile()
>>> >      >>
>>> >      >>    |
>>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
>>> > syntax error in VERSION script
>>> >      >>    | collect2: error: ld returned 1 exit status
>>> >      >>
>>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>>> >     <mailto:niko.mauno@vaisala.com>>
>>> >      >> ---
>>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>>> >     <http://kbd_2.5.1.bb/
>>> >      >>   1 file changed, 3 insertions(+)
>>> >      >>
>>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>> >     <http://kbd_2.5.1.bb/
>>> >      >> index aa3ab6e121..b623aecd36 100644
>>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>> >     <http://kbd_2.5.1.bb/
>>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>>> >     <http://kbd_2.5.1.bb/
>>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
>>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>>> >      >>
>>> >      >>   SRC_URI[sha256sum] =
>>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>>> >      >>
>>> >      >> +# Compiling 64 bit time for 32 bit host is broken
>>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>>> >      >> +
>>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>>> >     d)} \
>>> >      >>                     "
>>> >      >>
>>> >      >> --
>>> >      >> 2.36.1
>>> >      >>
>>> >      >>
>>> >      >>
>>> >      >>
>>> >
>>
>>
>> 
>>
> [4. ATT00001.txt --- text/plain; ATT00001.txt]...



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 14:56               ` Ola x Nilsson
@ 2022-11-08 15:00                 ` Ola x Nilsson
       [not found]                 ` <1725A47F2FC9966F.2170@lists.openembedded.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Ola x Nilsson @ 2022-11-08 15:00 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Niko Mauno, openembedded-core


Sorry, that link did not explain the -D_USE_TIME_BITS=64 flag.

I was sure I had read official docs of this somewhere but now I can only
find https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#Detailed_implementation

/Ola

On Tue, Nov 08 2022, Ola x Nilsson wrote:

> As far as I can tell from glibc's documentation, this is how you are
> supposed to do it.  glibc chose to always support both 32 and 64 bit
> APIs for time and file offset and make the normal int size the default.
> musl chose to switch to 64bit altogether. 
>
> https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
>
> /Ola
>
> On Tue, Nov 08 2022, Alexander Kanavin wrote:
>
>> I suppose what I want to say is - perhaps this should be discussed
>> with upstreams first? Things should 'just work' without having to set
>> some magic flags in an external configuration.
>>
>> Alex
>>
>> On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
>> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
>> wrote:
>>>
>>> Is this a recommendation somewhere official?
>>>
>>> Alex
>>>
>>> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
>>>>
>>>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
>>>> makes sense to set said compiler flags globally to ensure user space
>>>> wide Y2038 compliance. So I encountered this compiler error while
>>>> building poky reference images with additional effective
>>>>
>>>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>>>>
>>>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>>>>
>>>> -Niko
>>>>
>>>> On 8.11.2022 13.50, Alexander Kanavin wrote:
>>>> > So you need to set -D_TIME_BITS=64
>>>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
>>>> > the defaults work?
>>>> >
>>>> > Alex
>>>> >
>>>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
>>>> > <mailto:niko.mauno@vaisala.com>> wrote:
>>>> >
>>>> >     I have not studied the issue, but in order to reproduce this error I
>>>> >     add
>>>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>>>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>>>> >     -D_FILE_OFFSET_BITS=64".
>>>> >
>>>> >     -Niko
>>>> >
>>>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
>>>> >      > We do build for 32 bit arm targets, so is this seen only in specific
>>>> >      > circumstances? What are they?
>>>> >      >
>>>> >      > Alex
>>>> >      >
>>>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>>>> >     lists.openembedded.org
>>>> >     <http://lists.openembedded.org/
>>>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
>>>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>>>> >      >>
>>>> >      >> For now add exemption in order to avoid following failure during
>>>> >      >> do_compile()
>>>> >      >>
>>>> >      >>    |
>>>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
>>>> > syntax error in VERSION script
>>>> >      >>    | collect2: error: ld returned 1 exit status
>>>> >      >>
>>>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>>>> >     <mailto:niko.mauno@vaisala.com>>
>>>> >      >> ---
>>>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>>>> >     <http://kbd_2.5.1.bb/
>>>> >      >>   1 file changed, 3 insertions(+)
>>>> >      >>
>>>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>> >     <http://kbd_2.5.1.bb/
>>>> >      >> index aa3ab6e121..b623aecd36 100644
>>>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>> >     <http://kbd_2.5.1.bb/
>>>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>> >     <http://kbd_2.5.1.bb/
>>>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
>>>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>>>> >      >>
>>>> >      >>   SRC_URI[sha256sum] =
>>>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>>>> >      >>
>>>> >      >> +# Compiling 64 bit time for 32 bit host is broken
>>>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>>>> >      >> +
>>>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>>>> >     d)} \
>>>> >      >>                     "
>>>> >      >>
>>>> >      >> --
>>>> >      >> 2.36.1
>>>> >      >>
>>>> >      >>
>>>> >      >>
>>>> >      >>
>>>> >
>>>
>>>
>>> 
>>>
>> [4. ATT00001.txt --- text/plain; ATT00001.txt]...



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
  2022-11-08 10:51 ` Ola x Nilsson
@ 2022-11-08 16:38   ` Khem Raj
  2022-11-09  6:33   ` Niko Mauno
  2022-11-09 15:47   ` Alexandre Belloni
  2 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2022-11-08 16:38 UTC (permalink / raw)
  To: Ola x Nilsson; +Cc: openembedded-core, niko.mauno

On Tue, Nov 8, 2022 at 2:56 AM Ola x Nilsson <ola.x.nilsson@axis.com> wrote:
>
>
> I'm working on the same thing, but I put GLIBC_64BIT_TIME_CPPFLAGS in
> TARGET_CC_ARCH instead to make sure they applied everywhere.
>
> I'd be interested to hear what others think is the best place to put
> these flags.
>
> I'm also looking at QA tests to make sure that no application or shared
> object is still using 32bit time or file functions from glibc.

Perhaps another thing is that it might be good to control it via a
distro feature.

>
> /Ola
>
> On Tue, Nov 08 2022, Niko Mauno via lists.openembedded.org wrote:
>
> > Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
> > time on 32 bit host applications when glibc is used. Prerequisites
> > are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.
> >
> > Example of impact on 32 bit 'qemuarm' machine running
> > core-image-minimal. Before this change:
> >
> >   root@qemuarm:~# /bin/busybox date
> >   Sun Nov  6 06:09:39 UTC 2022
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2022-11-06 06:09:49.994249+00:00
> >   root@qemuarm:~# /bin/busybox date -s 2040-01-01
> >   date: invalid date '2040-01-01'
> >   root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
> >   Sun Jan  1 00:00:00 UTC 2040
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   1931-03-04 06:26:23.000000+00:00
> >   root@qemuarm:~#
> >
> > After this change:
> >
> >   root@qemuarm:~# /bin/busybox date
> >   Sun Nov  6 06:02:20 UTC 2022
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2022-11-06 06:02:27.989730+00:00
> >   root@qemuarm:~# /bin/busybox date -s 2040-01-01
> >   Sun Jan  1 00:00:00 UTC 2040
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2040-01-01 00:00:20.992954+00:00
> >   root@qemuarm:~#
> >
> > From here on, the adding of new flags can be disabled on recipe or
> > global level by resetting the value of associated variable containing
> > the CPPFLAGS specific for 64 bit time
> >
> >   GLIBC_64BIT_TIME_CPPFLAGS = ""
> >
> > which can be useful e.g. when working around failure to compile a
> > component due to lack of 64 bit time support on 32 bit build in the
> > component's source code.
> >
> > Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> > ---
> >  meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
> >  meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
> >  meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
> >  3 files changed, 7 insertions(+)
> >
> > diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
> > index f48d16939e..95770298e9 100644
> > --- a/meta/conf/distro/include/tclibc-glibc.inc
> > +++ b/meta/conf/distro/include/tclibc-glibc.inc
> > @@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
> >
> >  CXXFLAGS += "-fvisibility-inlines-hidden"
> >
> > +GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
> > +TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
> > +
> >  LIBC_DEPENDENCIES = "\
> >                    glibc \
> >                    glibc-dbg \
> > diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > index 8bda2ccad6..b3fafa0ea4 100644
> > --- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > @@ -5,3 +5,5 @@ require gcc-sanitizers.inc
> >  # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
> >  ARM_INSTRUCTION_SET:armv4 = "arm"
> >  ARM_INSTRUCTION_SET:armv5 = "arm"
> > +
> > +GLIBC_64BIT_TIME_CPPFLAGS = ""
> > diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> > index c34580b4ff..7734d0fbb0 100644
> > --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> > +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> > @@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
> >
> >  # error: use of undeclared identifier '_STAT_VER'
> >  COMPATIBLE_HOST:libc-musl = 'null'
> > +
> > +GLIBC_64BIT_TIME_CPPFLAGS = ""
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172959): https://lists.openembedded.org/g/openembedded-core/message/172959
> Mute This Topic: https://lists.openembedded.org/mt/94880624/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08  9:14   ` [OE-core] " Alexander Kanavin
  2022-11-08 11:48     ` Niko Mauno
@ 2022-11-08 16:40     ` Khem Raj
  2022-11-08 16:45       ` Alexander Kanavin
  1 sibling, 1 reply; 23+ messages in thread
From: Khem Raj @ 2022-11-08 16:40 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: niko.mauno, openembedded-core

On Tue, Nov 8, 2022 at 1:14 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>
> We do build for 32 bit arm targets, so is this seen only in specific
> circumstances? What are they?

Its when 64bit time_t is used with glibc on 32bit architectures. So
far we do not do that explicitly, with musl time_t is always 64bit

>
> Alex
>
> On Tue, 8 Nov 2022 at 01:09, Niko Mauno via lists.openembedded.org
> <niko.mauno=vaisala.com@lists.openembedded.org> wrote:
> >
> > For now add exemption in order to avoid following failure during
> > do_compile()
> >
> >   | .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2: syntax error in VERSION script
> >   | collect2: error: ld returned 1 exit status
> >
> > Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> > ---
> >  meta/recipes-core/kbd/kbd_2.5.1.bb | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb b/meta/recipes-core/kbd/kbd_2.5.1.bb
> > index aa3ab6e121..b623aecd36 100644
> > --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
> > +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
> > @@ -18,6 +18,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
> >
> >  SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
> >
> > +# Compiling 64 bit time for 32 bit host is broken
> > +GLIBC_64BIT_TIME_CPPFLAGS = ""
> > +
> >  PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
> >                    "
> >
> > --
> > 2.36.1
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172955): https://lists.openembedded.org/g/openembedded-core/message/172955
> Mute This Topic: https://lists.openembedded.org/mt/94880633/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 16:40     ` Khem Raj
@ 2022-11-08 16:45       ` Alexander Kanavin
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08 16:45 UTC (permalink / raw)
  To: Khem Raj; +Cc: niko.mauno, openembedded-core

On Tue, 8 Nov 2022 at 17:40, Khem Raj <raj.khem@gmail.com> wrote:
>
> On Tue, Nov 8, 2022 at 1:14 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
> >
> > We do build for 32 bit arm targets, so is this seen only in specific
> > circumstances? What are they?
>
> Its when 64bit time_t is used with glibc on 32bit architectures. So
> far we do not do that explicitly, with musl time_t is always 64bit

But why do we even need to worry about this, and not just let glibc
sort it out and make the right default choices?

I also haven't yet seen the official guideline from upstream, just 'I
think this flag is the correct one to use' kind of reasoning.

Alex


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
       [not found]                 ` <1725A47F2FC9966F.2170@lists.openembedded.org>
@ 2022-11-08 17:56                   ` Ola x Nilsson
  2022-11-08 18:38                     ` Alexander Kanavin
  0 siblings, 1 reply; 23+ messages in thread
From: Ola x Nilsson @ 2022-11-08 17:56 UTC (permalink / raw)
  To: Ola x Nilsson; +Cc: Alexander Kanavin, Niko Mauno, openembedded-core


And here is a link to the documentation for the _TIME_BITS Feature Test
Macro
https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fTIME_005fBITS

The docs for _FILE_OFFSET_BITS is just above.

/Ola

On Tue, Nov 08 2022, Ola x Nilsson wrote:

> Sorry, that link did not explain the -D_USE_TIME_BITS=64 flag.
>
> I was sure I had read official docs of this somewhere but now I can only
> find https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#Detailed_implementation
>
> /Ola
>
> On Tue, Nov 08 2022, Ola x Nilsson wrote:
>
>> As far as I can tell from glibc's documentation, this is how you are
>> supposed to do it.  glibc chose to always support both 32 and 64 bit
>> APIs for time and file offset and make the normal int size the default.
>> musl chose to switch to 64bit altogether. 
>>
>> https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
>>
>> /Ola
>>
>> On Tue, Nov 08 2022, Alexander Kanavin wrote:
>>
>>> I suppose what I want to say is - perhaps this should be discussed
>>> with upstreams first? Things should 'just work' without having to set
>>> some magic flags in an external configuration.
>>>
>>> Alex
>>>
>>> On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
>>> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
>>> wrote:
>>>>
>>>> Is this a recommendation somewhere official?
>>>>
>>>> Alex
>>>>
>>>> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
>>>>>
>>>>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
>>>>> makes sense to set said compiler flags globally to ensure user space
>>>>> wide Y2038 compliance. So I encountered this compiler error while
>>>>> building poky reference images with additional effective
>>>>>
>>>>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>>>>>
>>>>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>>>>>
>>>>> -Niko
>>>>>
>>>>> On 8.11.2022 13.50, Alexander Kanavin wrote:
>>>>> > So you need to set -D_TIME_BITS=64
>>>>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
>>>>> > the defaults work?
>>>>> >
>>>>> > Alex
>>>>> >
>>>>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
>>>>> > <mailto:niko.mauno@vaisala.com>> wrote:
>>>>> >
>>>>> >     I have not studied the issue, but in order to reproduce this error I
>>>>> >     add
>>>>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>>>>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>>>>> >     -D_FILE_OFFSET_BITS=64".
>>>>> >
>>>>> >     -Niko
>>>>> >
>>>>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
>>>>> >      > We do build for 32 bit arm targets, so is this seen only in specific
>>>>> >      > circumstances? What are they?
>>>>> >      >
>>>>> >      > Alex
>>>>> >      >
>>>>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>>>>> >     lists.openembedded.org
>>>>> >     <http://lists.openembedded.org/
>>>>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
>>>>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>>>>> >      >>
>>>>> >      >> For now add exemption in order to avoid following failure during
>>>>> >      >> do_compile()
>>>>> >      >>
>>>>> >      >>    |
>>>>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
>>>>> > syntax error in VERSION script
>>>>> >      >>    | collect2: error: ld returned 1 exit status
>>>>> >      >>
>>>>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>>>>> >     <mailto:niko.mauno@vaisala.com>>
>>>>> >      >> ---
>>>>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>>>>> >     <http://kbd_2.5.1.bb/
>>>>> >      >>   1 file changed, 3 insertions(+)
>>>>> >      >>
>>>>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>>> >     <http://kbd_2.5.1.bb/
>>>>> >      >> index aa3ab6e121..b623aecd36 100644
>>>>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>>> >     <http://kbd_2.5.1.bb/
>>>>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>>>>> >     <http://kbd_2.5.1.bb/
>>>>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
>>>>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>>>>> >      >>
>>>>> >      >>   SRC_URI[sha256sum] =
>>>>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>>>>> >      >>
>>>>> >      >> +# Compiling 64 bit time for 32 bit host is broken
>>>>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>>>>> >      >> +
>>>>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>>>>> >     d)} \
>>>>> >      >>                     "
>>>>> >      >>
>>>>> >      >> --
>>>>> >      >> 2.36.1
>>>>> >      >>
>>>>> >      >>
>>>>> >      >>
>>>>> >      >>
>>>>> >
>>>>
>>>>
>>>> 
>>>>
>>> [4. ATT00001.txt --- text/plain; ATT00001.txt]...
>
> [4. ATT00001.txt --- text/plain; ATT00001.txt]...



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 17:56                   ` Ola x Nilsson
@ 2022-11-08 18:38                     ` Alexander Kanavin
  2022-11-09  7:44                       ` Ola x Nilsson
  2022-11-09 15:42                       ` Alexandre Belloni
  0 siblings, 2 replies; 23+ messages in thread
From: Alexander Kanavin @ 2022-11-08 18:38 UTC (permalink / raw)
  To: Ola x Nilsson; +Cc: Niko Mauno, openembedded-core

Thanks. But: face, meet palm.

"If _TIME_BITS is undefined, the bit size of time_t is architecture
dependent. Currently it defaults to 64 bits on most architectures.
Although it defaults to 32 bits on some traditional architectures
(i686, ARM), this is planned to change and applications should not
rely on this. "

No one needs to know or care about this, they should just set it to 64
for all targets, break all the badly written userspace and move on.

Anyway, rather than add exceptions all over the core layers, I'd
suggest that you set it to 64, 'bitbake world' with all of meta-oe,
then send fixes upstream for everything that breaks. Rinse, repeat.
Then when the 'planned to change' actually happens we should be ready
for it.

Alex




On Tue, 8 Nov 2022 at 18:58, Ola x Nilsson <ola.x.nilsson@axis.com> wrote:
>
>
> And here is a link to the documentation for the _TIME_BITS Feature Test
> Macro
> https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fTIME_005fBITS
>
> The docs for _FILE_OFFSET_BITS is just above.
>
> /Ola
>
> On Tue, Nov 08 2022, Ola x Nilsson wrote:
>
> > Sorry, that link did not explain the -D_USE_TIME_BITS=64 flag.
> >
> > I was sure I had read official docs of this somewhere but now I can only
> > find https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#Detailed_implementation
> >
> > /Ola
> >
> > On Tue, Nov 08 2022, Ola x Nilsson wrote:
> >
> >> As far as I can tell from glibc's documentation, this is how you are
> >> supposed to do it.  glibc chose to always support both 32 and 64 bit
> >> APIs for time and file offset and make the normal int size the default.
> >> musl chose to switch to 64bit altogether.
> >>
> >> https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
> >>
> >> /Ola
> >>
> >> On Tue, Nov 08 2022, Alexander Kanavin wrote:
> >>
> >>> I suppose what I want to say is - perhaps this should be discussed
> >>> with upstreams first? Things should 'just work' without having to set
> >>> some magic flags in an external configuration.
> >>>
> >>> Alex
> >>>
> >>> On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
> >>> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
> >>> wrote:
> >>>>
> >>>> Is this a recommendation somewhere official?
> >>>>
> >>>> Alex
> >>>>
> >>>> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
> >>>>>
> >>>>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
> >>>>> makes sense to set said compiler flags globally to ensure user space
> >>>>> wide Y2038 compliance. So I encountered this compiler error while
> >>>>> building poky reference images with additional effective
> >>>>>
> >>>>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
> >>>>>
> >>>>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
> >>>>>
> >>>>> -Niko
> >>>>>
> >>>>> On 8.11.2022 13.50, Alexander Kanavin wrote:
> >>>>> > So you need to set -D_TIME_BITS=64
> >>>>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
> >>>>> > the defaults work?
> >>>>> >
> >>>>> > Alex
> >>>>> >
> >>>>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
> >>>>> > <mailto:niko.mauno@vaisala.com>> wrote:
> >>>>> >
> >>>>> >     I have not studied the issue, but in order to reproduce this error I
> >>>>> >     add
> >>>>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
> >>>>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
> >>>>> >     -D_FILE_OFFSET_BITS=64".
> >>>>> >
> >>>>> >     -Niko
> >>>>> >
> >>>>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
> >>>>> >      > We do build for 32 bit arm targets, so is this seen only in specific
> >>>>> >      > circumstances? What are they?
> >>>>> >      >
> >>>>> >      > Alex
> >>>>> >      >
> >>>>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
> >>>>> >     lists.openembedded.org
> >>>>> >     <http://lists.openembedded.org/
> >>>>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
> >>>>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
> >>>>> >      >>
> >>>>> >      >> For now add exemption in order to avoid following failure during
> >>>>> >      >> do_compile()
> >>>>> >      >>
> >>>>> >      >>    |
> >>>>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
> >>>>> > syntax error in VERSION script
> >>>>> >      >>    | collect2: error: ld returned 1 exit status
> >>>>> >      >>
> >>>>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
> >>>>> >     <mailto:niko.mauno@vaisala.com>>
> >>>>> >      >> ---
> >>>>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
> >>>>> >     <http://kbd_2.5.1.bb/
> >>>>> >      >>   1 file changed, 3 insertions(+)
> >>>>> >      >>
> >>>>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
> >>>>> >     <http://kbd_2.5.1.bb/
> >>>>> >      >> index aa3ab6e121..b623aecd36 100644
> >>>>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
> >>>>> >     <http://kbd_2.5.1.bb/
> >>>>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
> >>>>> >     <http://kbd_2.5.1.bb/
> >>>>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
> >>>>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
> >>>>> >      >>
> >>>>> >      >>   SRC_URI[sha256sum] =
> >>>>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
> >>>>> >      >>
> >>>>> >      >> +# Compiling 64 bit time for 32 bit host is broken
> >>>>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> >>>>> >      >> +
> >>>>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
> >>>>> >     d)} \
> >>>>> >      >>                     "
> >>>>> >      >>
> >>>>> >      >> --
> >>>>> >      >> 2.36.1
> >>>>> >      >>
> >>>>> >      >>
> >>>>> >      >>
> >>>>> >      >>
> >>>>> >
> >>>>
> >>>>
> >>>>
> >>>>
> >>> [4. ATT00001.txt --- text/plain; ATT00001.txt]...
> >
> > [4. ATT00001.txt --- text/plain; ATT00001.txt]...
>


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
  2022-11-08 10:51 ` Ola x Nilsson
  2022-11-08 16:38   ` Khem Raj
@ 2022-11-09  6:33   ` Niko Mauno
  2022-11-09 15:47   ` Alexandre Belloni
  2 siblings, 0 replies; 23+ messages in thread
From: Niko Mauno @ 2022-11-09  6:33 UTC (permalink / raw)
  To: Ola x Nilsson, openembedded-core; +Cc: niko.mauno

On related note, in this RFC series I was basing on reference set in 
https://github.com/lmajewski/meta-y2038/blob/master/conf/distro/y2038.inc#L8 
where the author has opted to use TARGET_CPPFLAGS.

-Niko

On 11/8/22 12:51, Ola x Nilsson wrote:
> 
> I'm working on the same thing, but I put GLIBC_64BIT_TIME_CPPFLAGS in
> TARGET_CC_ARCH instead to make sure they applied everywhere.
> 
> I'd be interested to hear what others think is the best place to put
> these flags.
> 
> I'm also looking at QA tests to make sure that no application or shared
> object is still using 32bit time or file functions from glibc.
> 
> /Ola
> 
> On Tue, Nov 08 2022, Niko Mauno via lists.openembedded.org wrote:
> 
>> Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
>> time on 32 bit host applications when glibc is used. Prerequisites
>> are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.
>>
>> Example of impact on 32 bit 'qemuarm' machine running
>> core-image-minimal. Before this change:
>>
>>    root@qemuarm:~# /bin/busybox date
>>    Sun Nov  6 06:09:39 UTC 2022
>>    root@qemuarm:~# /sbin/hwclock.util-linux -w
>>    root@qemuarm:~# /sbin/hwclock.util-linux
>>    2022-11-06 06:09:49.994249+00:00
>>    root@qemuarm:~# /bin/busybox date -s 2040-01-01
>>    date: invalid date '2040-01-01'
>>    root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
>>    Sun Jan  1 00:00:00 UTC 2040
>>    root@qemuarm:~# /sbin/hwclock.util-linux -w
>>    root@qemuarm:~# /sbin/hwclock.util-linux
>>    1931-03-04 06:26:23.000000+00:00
>>    root@qemuarm:~#
>>
>> After this change:
>>
>>    root@qemuarm:~# /bin/busybox date
>>    Sun Nov  6 06:02:20 UTC 2022
>>    root@qemuarm:~# /sbin/hwclock.util-linux -w
>>    root@qemuarm:~# /sbin/hwclock.util-linux
>>    2022-11-06 06:02:27.989730+00:00
>>    root@qemuarm:~# /bin/busybox date -s 2040-01-01
>>    Sun Jan  1 00:00:00 UTC 2040
>>    root@qemuarm:~# /sbin/hwclock.util-linux -w
>>    root@qemuarm:~# /sbin/hwclock.util-linux
>>    2040-01-01 00:00:20.992954+00:00
>>    root@qemuarm:~#
>>
>>  From here on, the adding of new flags can be disabled on recipe or
>> global level by resetting the value of associated variable containing
>> the CPPFLAGS specific for 64 bit time
>>
>>    GLIBC_64BIT_TIME_CPPFLAGS = ""
>>
>> which can be useful e.g. when working around failure to compile a
>> component due to lack of 64 bit time support on 32 bit build in the
>> component's source code.
>>
>> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
>> ---
>>   meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
>>   meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
>>   meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
>>   3 files changed, 7 insertions(+)
>>
>> diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
>> index f48d16939e..95770298e9 100644
>> --- a/meta/conf/distro/include/tclibc-glibc.inc
>> +++ b/meta/conf/distro/include/tclibc-glibc.inc
>> @@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
>>   
>>   CXXFLAGS += "-fvisibility-inlines-hidden"
>>   
>> +GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>> +TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
>> +
>>   LIBC_DEPENDENCIES = "\
>>   		     glibc \
>>   		     glibc-dbg \
>> diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
>> index 8bda2ccad6..b3fafa0ea4 100644
>> --- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
>> +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
>> @@ -5,3 +5,5 @@ require gcc-sanitizers.inc
>>   # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
>>   ARM_INSTRUCTION_SET:armv4 = "arm"
>>   ARM_INSTRUCTION_SET:armv5 = "arm"
>> +
>> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>> diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
>> index c34580b4ff..7734d0fbb0 100644
>> --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
>> +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
>> @@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
>>   
>>   # error: use of undeclared identifier '_STAT_VER'
>>   COMPATIBLE_HOST:libc-musl = 'null'
>> +
>> +GLIBC_64BIT_TIME_CPPFLAGS = ""
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172959): https://lists.openembedded.org/g/openembedded-core/message/172959
> Mute This Topic: https://lists.openembedded.org/mt/94880624/3618026
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [niko.mauno@iki.fi]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 18:38                     ` Alexander Kanavin
@ 2022-11-09  7:44                       ` Ola x Nilsson
  2022-11-09 15:42                       ` Alexandre Belloni
  1 sibling, 0 replies; 23+ messages in thread
From: Ola x Nilsson @ 2022-11-09  7:44 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Niko Mauno, openembedded-core


Doing the rince and repeat thing, yes.

Some of us may not have the luxury to wait for glibc to reach
'eventually'.  Whether OpenEmbedded should carry this option and how are
other discussions.  I'm open to carrying this as a plugin layer.

For what it's worth I would prefer if glibc at least had a configuration
option to force 64-bit only. 

/Ola

On Tue, Nov 08 2022, Alexander Kanavin wrote:

> Thanks. But: face, meet palm.
>
> "If _TIME_BITS is undefined, the bit size of time_t is architecture
> dependent. Currently it defaults to 64 bits on most architectures.
> Although it defaults to 32 bits on some traditional architectures
> (i686, ARM), this is planned to change and applications should not
> rely on this. "
>
> No one needs to know or care about this, they should just set it to 64
> for all targets, break all the badly written userspace and move on.
>
> Anyway, rather than add exceptions all over the core layers, I'd
> suggest that you set it to 64, 'bitbake world' with all of meta-oe,
> then send fixes upstream for everything that breaks. Rinse, repeat.
> Then when the 'planned to change' actually happens we should be ready
> for it.
>
> Alex
>
>
>
>
> On Tue, 8 Nov 2022 at 18:58, Ola x Nilsson <ola.x.nilsson@axis.com> wrote:
>>
>>
>> And here is a link to the documentation for the _TIME_BITS Feature Test
>> Macro
>> https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fTIME_005fBITS
>>
>> The docs for _FILE_OFFSET_BITS is just above.
>>
>> /Ola
>>
>> On Tue, Nov 08 2022, Ola x Nilsson wrote:
>>
>> > Sorry, that link did not explain the -D_USE_TIME_BITS=64 flag.
>> >
>> > I was sure I had read official docs of this somewhere but now I can only
>> > find https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#Detailed_implementation
>> >
>> > /Ola
>> >
>> > On Tue, Nov 08 2022, Ola x Nilsson wrote:
>> >
>> >> As far as I can tell from glibc's documentation, this is how you are
>> >> supposed to do it.  glibc chose to always support both 32 and 64 bit
>> >> APIs for time and file offset and make the normal int size the default.
>> >> musl chose to switch to 64bit altogether.
>> >>
>> >> https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
>> >>
>> >> /Ola
>> >>
>> >> On Tue, Nov 08 2022, Alexander Kanavin wrote:
>> >>
>> >>> I suppose what I want to say is - perhaps this should be discussed
>> >>> with upstreams first? Things should 'just work' without having to set
>> >>> some magic flags in an external configuration.
>> >>>
>> >>> Alex
>> >>>
>> >>> On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
>> >>> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
>> >>> wrote:
>> >>>>
>> >>>> Is this a recommendation somewhere official?
>> >>>>
>> >>>> Alex
>> >>>>
>> >>>> On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@vaisala.com> wrote:
>> >>>>>
>> >>>>> My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
>> >>>>> makes sense to set said compiler flags globally to ensure user space
>> >>>>> wide Y2038 compliance. So I encountered this compiler error while
>> >>>>> building poky reference images with additional effective
>> >>>>>
>> >>>>>    TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
>> >>>>>
>> >>>>> declaration in meta/conf/distro/include/tclibc-glibc.inc.
>> >>>>>
>> >>>>> -Niko
>> >>>>>
>> >>>>> On 8.11.2022 13.50, Alexander Kanavin wrote:
>> >>>>> > So you need to set -D_TIME_BITS=64
>> >>>>> > -D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
>> >>>>> > the defaults work?
>> >>>>> >
>> >>>>> > Alex
>> >>>>> >
>> >>>>> > On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@vaisala.com
>> >>>>> > <mailto:niko.mauno@vaisala.com>> wrote:
>> >>>>> >
>> >>>>> >     I have not studied the issue, but in order to reproduce this error I
>> >>>>> >     add
>> >>>>> >     'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
>> >>>>> >     current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
>> >>>>> >     -D_FILE_OFFSET_BITS=64".
>> >>>>> >
>> >>>>> >     -Niko
>> >>>>> >
>> >>>>> >     On 8.11.2022 11.14, Alexander Kanavin wrote:
>> >>>>> >      > We do build for 32 bit arm targets, so is this seen only in specific
>> >>>>> >      > circumstances? What are they?
>> >>>>> >      >
>> >>>>> >      > Alex
>> >>>>> >      >
>> >>>>> >      > On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
>> >>>>> >     lists.openembedded.org
>> >>>>> >     <http://lists.openembedded.org/
>> >>>>> >      > <niko.mauno=vaisala.com@lists.openembedded.org
>> >>>>> >     <mailto:vaisala.com@lists.openembedded.org>> wrote:
>> >>>>> >      >>
>> >>>>> >      >> For now add exemption in order to avoid following failure during
>> >>>>> >      >> do_compile()
>> >>>>> >      >>
>> >>>>> >      >>    |
>> >>>>> >     .../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
>> >>>>> > syntax error in VERSION script
>> >>>>> >      >>    | collect2: error: ld returned 1 exit status
>> >>>>> >      >>
>> >>>>> >      >> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com
>> >>>>> >     <mailto:niko.mauno@vaisala.com>>
>> >>>>> >      >> ---
>> >>>>> >      >>   meta/recipes-core/kbd/kbd_2.5.1.bb
>> >>>>> >     <http://kbd_2.5.1.bb/
>> >>>>> >      >>   1 file changed, 3 insertions(+)
>> >>>>> >      >>
>> >>>>> >      >> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >>>>> >     <http://kbd_2.5.1.bb/
>> >>>>> >      >> index aa3ab6e121..b623aecd36 100644
>> >>>>> >      >> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >>>>> >     <http://kbd_2.5.1.bb/
>> >>>>> >      >> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
>> >>>>> >     <http://kbd_2.5.1.bb/
>> >>>>> >      >> @@ -18,6 +18,9 @@ SRC_URI =
>> >>>>> >     "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>> >>>>> >      >>
>> >>>>> >      >>   SRC_URI[sha256sum] =
>> >>>>> >     "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>> >>>>> >      >>
>> >>>>> >      >> +# Compiling 64 bit time for 32 bit host is broken
>> >>>>> >      >> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>> >>>>> >      >> +
>> >>>>> >      >>   PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
>> >>>>> >     d)} \
>> >>>>> >      >>                     "
>> >>>>> >      >>
>> >>>>> >      >> --
>> >>>>> >      >> 2.36.1
>> >>>>> >      >>
>> >>>>> >      >>
>> >>>>> >      >>
>> >>>>> >      >>
>> >>>>> >
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>> [4. ATT00001.txt --- text/plain; ATT00001.txt]...
>> >
>> > [4. ATT00001.txt --- text/plain; ATT00001.txt]...
>>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc
  2022-11-08 18:38                     ` Alexander Kanavin
  2022-11-09  7:44                       ` Ola x Nilsson
@ 2022-11-09 15:42                       ` Alexandre Belloni
  1 sibling, 0 replies; 23+ messages in thread
From: Alexandre Belloni @ 2022-11-09 15:42 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Ola x Nilsson, Niko Mauno, openembedded-core

On 08/11/2022 19:38:06+0100, Alexander Kanavin wrote:
> Thanks. But: face, meet palm.
> 
> "If _TIME_BITS is undefined, the bit size of time_t is architecture
> dependent. Currently it defaults to 64 bits on most architectures.
> Although it defaults to 32 bits on some traditional architectures
> (i686, ARM), this is planned to change and applications should not
> rely on this. "
> 
> No one needs to know or care about this, they should just set it to 64
> for all targets, break all the badly written userspace and move on.
> 

Note that this may build but not run properly as there is no way to know
whether userspace stores a time_t in an int at some point.

> Anyway, rather than add exceptions all over the core layers, I'd
> suggest that you set it to 64, 'bitbake world' with all of meta-oe,
> then send fixes upstream for everything that breaks. Rinse, repeat.
> Then when the 'planned to change' actually happens we should be ready
> for it.
> 

So we may not be ready unless the rinse/repeat also includes runtime
testing.

On Monday, I was suggesting to RP that we should probably have a poky
distro with _TIME_BITS set to 64 and run that on the autobuilders.
I don't think we can just add the flag and be done and this is a flag
day and may break existing users.
I'm usually getting customers to define their own distro and stop
depending on poky but it is not the case of everyone.

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts
  2022-11-08 10:51 ` Ola x Nilsson
  2022-11-08 16:38   ` Khem Raj
  2022-11-09  6:33   ` Niko Mauno
@ 2022-11-09 15:47   ` Alexandre Belloni
  2 siblings, 0 replies; 23+ messages in thread
From: Alexandre Belloni @ 2022-11-09 15:47 UTC (permalink / raw)
  To: Ola x Nilsson; +Cc: openembedded-core, niko.mauno

On 08/11/2022 11:51:58+0100, Ola x Nilsson wrote:
> 
> I'm working on the same thing, but I put GLIBC_64BIT_TIME_CPPFLAGS in
> TARGET_CC_ARCH instead to make sure they applied everywhere.
> 


I would not provide a feature to allow building a recipe without a 64
bits time_t, it is going to build but will fail to run properly so it is
way better to fail at compile time.

> I'd be interested to hear what others think is the best place to put
> these flags.
> 
> I'm also looking at QA tests to make sure that no application or shared
> object is still using 32bit time or file functions from glibc.
> 
> /Ola
> 
> On Tue, Nov 08 2022, Niko Mauno via lists.openembedded.org wrote:
> 
> > Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
> > time on 32 bit host applications when glibc is used. Prerequisites
> > are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.
> >
> > Example of impact on 32 bit 'qemuarm' machine running
> > core-image-minimal. Before this change:
> >
> >   root@qemuarm:~# /bin/busybox date
> >   Sun Nov  6 06:09:39 UTC 2022
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2022-11-06 06:09:49.994249+00:00
> >   root@qemuarm:~# /bin/busybox date -s 2040-01-01
> >   date: invalid date '2040-01-01'
> >   root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
> >   Sun Jan  1 00:00:00 UTC 2040
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   1931-03-04 06:26:23.000000+00:00
> >   root@qemuarm:~#
> >
> > After this change:
> >
> >   root@qemuarm:~# /bin/busybox date
> >   Sun Nov  6 06:02:20 UTC 2022
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2022-11-06 06:02:27.989730+00:00
> >   root@qemuarm:~# /bin/busybox date -s 2040-01-01
> >   Sun Jan  1 00:00:00 UTC 2040
> >   root@qemuarm:~# /sbin/hwclock.util-linux -w
> >   root@qemuarm:~# /sbin/hwclock.util-linux
> >   2040-01-01 00:00:20.992954+00:00
> >   root@qemuarm:~#
> >

Be careful because there is no guarantee hwclock is testing what you
want to test. The actual result depends on the RTC which may fail before
2038 anyway.

Note that if your system is using systemd, it will anyway fail in 2038.

> > From here on, the adding of new flags can be disabled on recipe or
> > global level by resetting the value of associated variable containing
> > the CPPFLAGS specific for 64 bit time
> >
> >   GLIBC_64BIT_TIME_CPPFLAGS = ""
> >
> > which can be useful e.g. when working around failure to compile a
> > component due to lack of 64 bit time support on 32 bit build in the
> > component's source code.
> >
> > Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> > ---
> >  meta/conf/distro/include/tclibc-glibc.inc        | 3 +++
> >  meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
> >  meta/recipes-devtools/pseudo/pseudo_git.bb       | 2 ++
> >  3 files changed, 7 insertions(+)
> >
> > diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
> > index f48d16939e..95770298e9 100644
> > --- a/meta/conf/distro/include/tclibc-glibc.inc
> > +++ b/meta/conf/distro/include/tclibc-glibc.inc
> > @@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
> >  
> >  CXXFLAGS += "-fvisibility-inlines-hidden"
> >  
> > +GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
> > +TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
> > +
> >  LIBC_DEPENDENCIES = "\
> >  		     glibc \
> >  		     glibc-dbg \
> > diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > index 8bda2ccad6..b3fafa0ea4 100644
> > --- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
> > @@ -5,3 +5,5 @@ require gcc-sanitizers.inc
> >  # sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
> >  ARM_INSTRUCTION_SET:armv4 = "arm"
> >  ARM_INSTRUCTION_SET:armv5 = "arm"
> > +
> > +GLIBC_64BIT_TIME_CPPFLAGS = ""
> > diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> > index c34580b4ff..7734d0fbb0 100644
> > --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> > +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> > @@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
> >  
> >  # error: use of undeclared identifier '_STAT_VER'
> >  COMPATIBLE_HOST:libc-musl = 'null'
> > +
> > +GLIBC_64BIT_TIME_CPPFLAGS = ""
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#172959): https://lists.openembedded.org/g/openembedded-core/message/172959
> Mute This Topic: https://lists.openembedded.org/mt/94880624/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-11-09 15:47 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  0:08 [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Niko Mauno
2022-11-08  0:08 ` [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc Niko Mauno
2022-11-08  9:14   ` [OE-core] " Alexander Kanavin
2022-11-08 11:48     ` Niko Mauno
2022-11-08 11:50       ` Alexander Kanavin
2022-11-08 12:04         ` Niko Mauno
2022-11-08 12:18           ` Alexander Kanavin
     [not found]           ` <17259B3874804FB3.24550@lists.openembedded.org>
2022-11-08 12:57             ` Alexander Kanavin
2022-11-08 14:56               ` Ola x Nilsson
2022-11-08 15:00                 ` Ola x Nilsson
     [not found]                 ` <1725A47F2FC9966F.2170@lists.openembedded.org>
2022-11-08 17:56                   ` Ola x Nilsson
2022-11-08 18:38                     ` Alexander Kanavin
2022-11-09  7:44                       ` Ola x Nilsson
2022-11-09 15:42                       ` Alexandre Belloni
2022-11-08 16:40     ` Khem Raj
2022-11-08 16:45       ` Alexander Kanavin
2022-11-08  0:08 ` [RFC PATCH 3/3] pulseaudio: " Niko Mauno
2022-11-08 10:17   ` [OE-core] " Peter Kjellerstedt
2022-11-08  3:30 ` [OE-core] [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts Khem Raj
2022-11-08 10:51 ` Ola x Nilsson
2022-11-08 16:38   ` Khem Raj
2022-11-09  6:33   ` Niko Mauno
2022-11-09 15:47   ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.