Skip to contentSkip to conversation

glibc-locale: share source date epoch with glibc

PATCH New Dan McGregor 2 participants 4 messages Feb 28, 2025 – May 20, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 glibc-locale: share source date epoch with glibc

From: Dan McGregor <[email protected]>

Similar to [1], stash glibc's source date epoch file to be used by the locale generation. This isn't used within the recipe itself, but it does change the timestamps of the generated files to be consistent with the main glibc packages. It also changes the metadata in the resulting RPM to show the same build time as glibc.

[1]: https://git.openembedded.org/openembedded-core/commit/?id=b996293b4c8ab7ff3ed852045d17290df29205df

---
 meta/recipes-core/glibc/glibc-collateral.inc | 14 ++++++++++++++
 meta/recipes-core/glibc/glibc-package.inc    |  5 +++++
 2 files changed, 19 insertions(+)
meta/recipes-core/glibc/glibc-collateral.inc +14 -0
index 4f81f07da77..905e9338af4 100644
@@ -10,3 +10,17 @@ do_configure[noexec] = "1"
 do_compile[noexec] = "1"
 
 do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
+
+do_deploy_source_date_epoch[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
+do_deploy_source_date_epoch () {
+    mkdir -p ${SDE_DEPLOYDIR} ${SDE_DIR}
+    if [ -e "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt" ]; then
+        echo "Deploying SDE from glibc stash -> ${SDE_DEPLOYDIR}."
+        cp -p ${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt \
+            ${SDE_DEPLOYDIR}/__source_date_epoch.txt
+        cp -p ${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt \
+            ${SDE_FILE}
+    else
+        echo "SDE_FILE not found!"
+    fi
+}
meta/recipes-core/glibc/glibc-package.inc +5 -0
index 21f2200d19b..a6aee043453 100644
@@ -215,6 +215,10 @@ do_stash_locale () {
 			cp ${D}${bindir}/$i $target/
 		fi
 	done
+
+	# Stash the source date epoch file so RPMs have the
+	# same build time.
+	cp -a "${SDE_FILE}" $dest/__source_date_epoch.txt
 }
 
 addtask do_stash_locale after do_install before do_populate_sysroot do_package
@@ -238,6 +242,7 @@ stash_locale_cleanup () {
 	for i in ${bashscripts}; do
 		rm -f $cleanupdir${bindir}/$i
 	done
+	rm -f $cleanupdir/__source_date_epoch.txt
 	rm -f $cleanupdir${bindir}/localedef
 	rm -rf $cleanupdir${datadir}/i18n
 	rm -rf $cleanupdir${libdir}/gconv
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/1 go: install default go.env file

From: Dan McGregor <[email protected]>

The go tools require the GOPROXY and GOSUMDB environment variables set when using modules on a target system. These aren't set by default in the binaries, they require an environment file. Install the default one in the target case. In our -native toolchain we always set these values appropriately, so no need for it there.

---
 meta/recipes-devtools/go/go-target.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/go/go-target.inc +2 -1
index 981c7abd313..7e4139102e3 100644
@@ -34,6 +34,7 @@ do_install() {
 	cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
 	install -d ${D}${libdir}/go/src
 	cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
+	cp --preserve=mode,timestamps ${S}/go.env ${D}${libdir}/go/
 	find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
 	install -d ${D}${libdir}/go/bin
 	install -d ${D}${bindir}
@@ -46,7 +47,7 @@ do_install() {
 }
 
 PACKAGES = "${PN} ${PN}-dev"
-FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
+FILES:${PN} = "${libdir}/go/bin ${libdir}/go/go.env ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
 RDEPENDS:${PN} = "go-runtime"
 INSANE_SKIP:${PN} = "ldflags"
 
Signature · 1 line
2.47.0
#2 lore raw

PATCH 1/1 openssl-native(sdk): poision built in paths

In reply to Dan McGregor

From: Dan McGregor <[email protected]>

Long ago, in the OpenSSL 1.1 days changing CFLAGS worked to override hard-coded paths in the OpenSSL libraries. Even as far back as kirkstone this was no longer working.

Override make variables instead to poision the paths that get built into the native (and nativesdk) libraries so they become relocatable again.

While here, remove the -isystem<foo> compiler argument from the compiler command line stored in the library, just like we already remove the prefix-map and sysroot arguments.

---
 ...-sysroot-and-debug-prefix-map-from-co.patch | 18 +++++++++++-------
 .../openssl/openssl_3.4.1.bb                   |  4 ++--
 2 files changed, 13 insertions(+), 9 deletions(-)
meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch +11 -7
index b8672735abe..91a95d89290 100644
@@ -30,23 +30,26 @@ Update to fix buildpaths qa issue for '-ffile-prefix-map'.
 Signed-off-by: Khem Raj <[email protected]>
 
 ---
- Configurations/unix-Makefile.tmpl | 12 +++++++++++-
+ Configurations/unix-Makefile.tmpl | 16 +++++++++++++++-
  crypto/build.info                 |  2 +-
- 2 files changed, 12 insertions(+), 2 deletions(-)
+ 2 files changed, 16 insertions(+), 2 deletions(-)
 
-Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl
-===================================================================
---- openssl-3.0.4.orig/Configurations/unix-Makefile.tmpl
-+++ openssl-3.0.4/Configurations/unix-Makefile.tmpl
-@@ -502,13 +502,23 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 09303c4..011bda1 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -502,13 +502,27 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
                           '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  
 -# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
 +# *_Q variables are used for one thing only: to build up buildinf.h
  CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
++              $cppflags1 =~ s|-isystem/[^ ]+/usr/include||g;
                $cppflags2 =~ s|([\\"])|\\$1|g;
++              $cppflags2 =~ s|-isystem/[^ ]+/usr/include||g;
                $lib_cppflags =~ s|([\\"])|\\$1|g;
++              $lib_cppflags =~ s|-isystem/[^ ]+/usr/include||g;
                join(' ', $lib_cppflags || (), $cppflags2 || (),
                          $cppflags1 || ()) -}
  
@@ -54,6 +57,7 @@ Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl
 +              s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g;
 +              s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g;
 +              s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g;
++              s|-isystem/[^ ]+/usr/include ||g;
 +            }
 +            join(' ', @{$config{CFLAGS}}) -}
 +
meta/recipes-connectivity/openssl/openssl_3.4.1.bb +2 -2
index 1a054a36753..8da64aea6a3 100644
@@ -49,8 +49,8 @@ EXTRA_OECONF:append:class-native = " --with-rand-seed=os,devrandom"
 EXTRA_OECONF:append:class-nativesdk = " --with-rand-seed=os,devrandom"
 
 # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
-CFLAGS:append:class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
-CFLAGS:append:class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
+EXTRA_OEMAKE:append:task-compile:class-native = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"'
+EXTRA_OEMAKE:append:task-compile:class-nativesdk = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"'
 
 # This allows disabling deprecated or undesirable crypto algorithms.
 # The default is to trust upstream choices.
Signature · 1 line
2.47.0
#3 lore raw

Re: [OE-core] [PATCH] openssl-native(sdk): poision built in paths

Hi,

Am Freitag, dem 28.02.2025 um 14:32 -0600 schrieb Dan McGregor via lists.openembedded.org:

Quoted 6 lines

From: Dan McGregor <[email protected]>

Long ago, in the OpenSSL 1.1 days changing CFLAGS worked to override hard-coded paths in the OpenSSL libraries. Even as far back as kirkstone this was no longer working.

Quoted 7 lines

Override make variables instead to poision the paths that get built into the native (and nativesdk) libraries so they become relocatable again.

While here, remove the -isystem<foo> compiler argument from the compiler command line stored in the library, just like we already remove the prefix-map and sysroot arguments.

while this might be required to bypass some search path automatisms in openssl (to allow relocation), another effect of forcing the directory variables to be invalid is that it renders the generated native pkg-config file (libcrypto.pc) unusable:

  prefix=${pcfiledir}/../../../usr
  exec_prefix=${prefix}
  libdir=${exec_prefix}/lib
  includedir=${prefix}/include 
  enginesdir=${libdir}/../../../../../../../../../../../../../../../../not/builtin
  modulesdir=${libdir}/../../../../../../../../../../../../../../../../not/builtin

  Name: OpenSSL-libcrypto
  Description: OpenSSL cryptography library
  Version: 3.4.1
  Libs: -L${libdir} -lcrypto
  Libs.private: -ldl -pthread
  Cflags: -I${includedir}

This will prevent other native tools (like libp11-native) from installing their (.so) files into valid OpenSSL directories.

Haven't found a good solution for this, yet. But I'm also unsure if the relocation is actually an issue if it has been broken since kirkstone?

Maybe someone has experienced similar issues?

Thanks and regards

Enrico

Quoted 83 lines

---
 ...-sysroot-and-debug-prefix-map-from-co.patch | 18 +++++++++++------- .../openssl/openssl_3.4.1.bb                   |  4 ++--

 2 files changed, 13 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

prefix-map-from-co.patch b/meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot- and-debug-prefix-map-from-co.patch
index b8672735abe..91a95d89290 100644
--- a/meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map- from-co.patch
+++ b/meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map- from-co.patch

(quoted diff) +0 -0
@@ -30,23 +30,26 @@ Update to fix buildpaths qa issue for '-ffile-prefix-map'.


 ---
- Configurations/unix-Makefile.tmpl | 12 +++++++++++-
+ Configurations/unix-Makefile.tmpl | 16 +++++++++++++++- crypto/build.info                 |  2 +-
- 2 files changed, 12 insertions(+), 2 deletions(-)
+ 2 files changed, 16 insertions(+), 2 deletions(-)

meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch +5 -5
-Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl
-===================================================================
---- openssl-3.0.4.orig/Configurations/unix-Makefile.tmpl
-+++ openssl-3.0.4/Configurations/unix-Makefile.tmpl
-@@ -502,13 +502,23 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 09303c4..011bda1 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -502,13 +502,27 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),

                           '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)

 -# CPPFLAGS_Q is used for one thing only: to build up buildinf.h +# *_Q variables are used for one thing only: to build up buildinf.h CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
++              $cppflags1 =~ s|-isystem/[^ ]+/usr/include||g; $cppflags2 =~ s|([\\"])|\\$1|g;
++              $cppflags2 =~ s|-isystem/[^ ]+/usr/include||g; $lib_cppflags =~ s|([\\"])|\\$1|g;
++              $lib_cppflags =~ s|-isystem/[^ ]+/usr/include||g; join(' ', $lib_cppflags || (), $cppflags2 || (), $cppflags1 || ()) -}

meta/recipes-connectivity/openssl/openssl/0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch +1 -0
@@ -54,6 +57,7 @@ Index: openssl-3.0.4/Configurations/unix-Makefile.tmpl
  +              s|-fdebug-prefix-map=[^ ]+|-fdebug-prefix-map=|g;
  +              s|-fmacro-prefix-map=[^ ]+|-fmacro-prefix-map=|g;
  +              s|-ffile-prefix-map=[^ ]+|-ffile-prefix-map=|g;
++              s|-isystem/[^ ]+/usr/include ||g;
  +            }
  +            join(' ', @{$config{CFLAGS}}) -}

 +

meta/recipes- renamed from meta/recipes-connectivity/openssl/openssl_3.4.1.bb +0 -0

connectivity/openssl/openssl_3.4.1.bb
index 1a054a36753..8da64aea6a3 100644

meta/recipes-connectivity/openssl/openssl_3.4.1.bb +0 -0
@@ -49,8 +49,8 @@ EXTRA_OECONF:append:class-native = " --with-rand-seed=os,devrandom"

 EXTRA_OECONF:append:class-nativesdk = " --with-rand-seed=os,devrandom"

 # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.

meta/recipes-connectivity/openssl/openssl_3.4.1.bb +1 -2
-CFLAGS:append:class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
-CFLAGS:append:class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
+EXTRA_OEMAKE:append:task-compile:class-native = ' OPENSSLDIR="/not/builtin"

ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"' +EXTRA_OEMAKE:append:task-compile:class-nativesdk = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"'

 # This allows disabling deprecated or undesirable crypto algorithms. # The default is to trust upstream choices.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#212078): https://lists.openembedded.org/g/openembedded-core/message/212078
Mute This Topic: https://lists.openembedded.org/mt/111441623/3616721
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 4 lines
Pengutronix e.K.                           | Enrico Jörns                |
Embedded Linux Consulting & Support        | https://www.pengutronix.de/ |
Steuerwalder Str. 21                       | Phone: +49-5121-206917-180  |
31137 Hildesheim, Germany                  | Fax:   +49-5121-206917-9    |