summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKéléfa Sané <kelefa.sane@smile.fr>2025-05-26 11:53:18 +0200
committerKhem Raj <raj.khem@gmail.com>2025-05-27 10:33:01 -0700
commitdf7e1b55d5f40129ebffa1cb1b9c0dcd099b6eaa (patch)
treee728203d5d6d2e960aa931e86b16108ea2ac38f5
parent3c4035cf2841855cf60ac1d57c5183c0cc5dc3bf (diff)
downloadmeta-openembedded-df7e1b55d5f40129ebffa1cb1b9c0dcd099b6eaa.tar.gz
crash: fix reproducibility
Fix reproducibility issue by retrieving the compiler version from the CC env variable, which define the compiler used in the build and not from the native gcc compiler install in the host machine. Signed-off-by: Kéléfa Sané <kelefa.sane@smile.fr> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rwxr-xr-xmeta-oe/conf/include/non-repro-meta-oe.inc3
-rw-r--r--meta-oe/recipes-kernel/crash/crash.inc1
-rw-r--r--meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch48
3 files changed, 49 insertions, 3 deletions
diff --git a/meta-oe/conf/include/non-repro-meta-oe.inc b/meta-oe/conf/include/non-repro-meta-oe.inc
index 894d7f330a..ae4fb1d194 100755
--- a/meta-oe/conf/include/non-repro-meta-oe.inc
+++ b/meta-oe/conf/include/non-repro-meta-oe.inc
@@ -7,9 +7,6 @@ KNOWN_NON_REPRO_META_OE = " \
7 asio-ptest \ 7 asio-ptest \
8 asio-src \ 8 asio-src \
9 cpuid-doc \ 9 cpuid-doc \
10 crash \
11 crash-dbg \
12 crash-src \
13 dhrystone \ 10 dhrystone \
14 dhrystone-dbg \ 11 dhrystone-dbg \
15 dhrystone-dev \ 12 dhrystone-dev \
diff --git a/meta-oe/recipes-kernel/crash/crash.inc b/meta-oe/recipes-kernel/crash/crash.inc
index aef77be1a0..45fc9cd1fd 100644
--- a/meta-oe/recipes-kernel/crash/crash.inc
+++ b/meta-oe/recipes-kernel/crash/crash.inc
@@ -27,6 +27,7 @@ SRC_URI = "git://github.com/crash-utility/${BPN}.git;branch=master;protocol=http
27 file://0003-Fix-build-failure-in-readline-lib.patch \ 27 file://0003-Fix-build-failure-in-readline-lib.patch \
28 file://0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch \ 28 file://0004-tools.c-do-not-use-keywords-nullptr-as-a-variable-in.patch \
29 file://0005-Fix-build-failure-on-32bit-machine-i686.patch \ 29 file://0005-Fix-build-failure-on-32bit-machine-i686.patch \
30 file://0001-Use-CC-env-var-to-get-compiler-version.patch \
30 " 31 "
31SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405" 32SRCREV = "f13853cef53f5c5463a51021edbc81977e2b1405"
32 33
diff --git a/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch b/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch
new file mode 100644
index 0000000000..773598def1
--- /dev/null
+++ b/meta-oe/recipes-kernel/crash/crash/0001-Use-CC-env-var-to-get-compiler-version.patch
@@ -0,0 +1,48 @@
1From 6ad5e9302057e157ab701880a8543ca59058df2d Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?K=C3=A9l=C3=A9fa=20San=C3=A9?= <kelefa.sane@smile.fr>
3Date: Fri, 16 May 2025 16:18:28 +0200
4Subject: [PATCH v2] Use CC env var to get compiler version
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The source file build_data.c generated at compilation time define a
10variable compiler_version which is obtained by calling "gcc --version"
11cmd. This call retrieve the native gcc compiler install on host build
12machine but not necessarily the compiler use to build the project (ex:
13cross compilation).
14
15The CC env variable commonly used in Makefile project define the
16compiler to use at build, so this is the appropriate way to retrieve the
17compiler version, when the CC env var is define.
18
19Upstream-Status: Submitted [https://lists.crash-utility.osci.io/archives/list/devel@lists.crash-utility.osci.io/thread/V3G3QH3YW6WZWD56TVTFQIHYLZ33UIJL/]
20
21Signed-off-by: Kéléfa Sané <kelefa.sane@smile.fr>
22---
23 configure.c | 12 +++++++++++-
24 1 file changed, 11 insertions(+), 1 deletion(-)
25
26diff --git a/configure.c b/configure.c
27index 4668c9a..4b65bd7 100644
28--- a/configure.c
29+++ b/configure.c
30@@ -1362,7 +1362,17 @@ make_build_data(char *target)
31
32 fp1 = popen("date", "r");
33 fp2 = popen("id", "r");
34- fp3 = popen("gcc --version", "r");
35+
36+ const char *cc_env = getenv("CC");
37+ if(NULL == cc_env) {
38+ fp3 = popen("gcc --version", "r");
39+ }
40+ else {
41+ char compiler_version_cmd[512];
42+
43+ snprintf(compiler_version_cmd, sizeof(compiler_version_cmd), "%s --version", cc_env);
44+ fp3 = popen(compiler_version_cmd, "r");
45+ }
46
47 if ((fp4 = fopen("build_data.c", "w")) == NULL) {
48 perror("build_data.c");