diff options
author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-01-25 13:44:19 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-01-25 09:36:50 -0800 |
commit | a91f294b1e55cb6caa3c8b8b6c94b0d05ed9bc22 (patch) | |
tree | 85909bb528af23c07801b8a80edc39748c36d79a /meta-python/recipes-devtools/python/python3-posix-ipc | |
parent | a921c95a5778411ce69ea567a20035e0c154a7a5 (diff) | |
download | meta-openembedded-a91f294b1e55cb6caa3c8b8b6c94b0d05ed9bc22.tar.gz |
python3-posix-ipc: use correct C compiler to detect system features
During compilation, prober.py (called from setup.py) uses "cc" to
compile some simple code, to detect if the used features are available.
However during cross-compilation we don't use "cc", but some other
compiler for cross-compiling.
Due to this, the feature detection can fail (maybe it fails always?),
as the correct C compiler for Yocto is not cc, but the content of
CC environment variable.
To solve this, instead of using cc always, take the C compiler from the CC
environment variable when it is available, and fall back to cc only
when this environment variable is not set.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-posix-ipc')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-posix-ipc/0001-Use-default-cc-from-environment-variable.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-posix-ipc/0001-Use-default-cc-from-environment-variable.patch b/meta-python/recipes-devtools/python/python3-posix-ipc/0001-Use-default-cc-from-environment-variable.patch new file mode 100644 index 0000000000..86829869a2 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-posix-ipc/0001-Use-default-cc-from-environment-variable.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | From 2db4d9974052e28f25252b3204a73dd25de1dd89 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gyorgy Sarvari <skandigraun@gmail.com> | ||
3 | Date: Sat, 25 Jan 2025 13:09:00 +0100 | ||
4 | Subject: [PATCH] Use default cc from environment variable | ||
5 | |||
6 | In case the system uses a custom c compiler instead of cc | ||
7 | (e.g. for cross-compiling), probing system features can | ||
8 | fail or can misidentify the features due to the incorrect C compiler. | ||
9 | |||
10 | Instead of using only "cc" for probing features, check if the CC environment | ||
11 | variable has a custom C compiler set. If it is present, use that instead of | ||
12 | "cc". If it is not present, fall back to "cc". | ||
13 | |||
14 | Upstream-Status: Submitted [https://github.com/osvenskan/posix_ipc/pull/56] | ||
15 | --- | ||
16 | prober.py | 7 +++++-- | ||
17 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/prober.py b/prober.py | ||
20 | index 48432b7..ace6d3b 100644 | ||
21 | --- a/prober.py | ||
22 | +++ b/prober.py | ||
23 | @@ -52,14 +52,17 @@ def print_bad_news(value_name, default): | ||
24 | def does_build_succeed(filename, linker_options=""): | ||
25 | # Utility function that returns True if the file compiles and links | ||
26 | # successfully, False otherwise. | ||
27 | - # Two things to note here -- | ||
28 | + # Three things to note here -- | ||
29 | # - If there's a linker option like -lrt, it needs to come *after* | ||
30 | # the specification of the C file or linking will fail on Ubuntu 11.10 | ||
31 | # (maybe because of the gcc version?) | ||
32 | # - Some versions of Linux place the sem_xxx() functions in libpthread. | ||
33 | # Rather than testing whether or not it's needed, I just specify it | ||
34 | # everywhere since it's harmless to specify it when it's not needed. | ||
35 | - cmd = "cc -Wall -o ./prober/foo ./prober/%s %s -lpthread" % (filename, linker_options) | ||
36 | + # - In case the used C compiler is not cc, take it from the CC environment | ||
37 | + # variable | ||
38 | + cc = os.getenv("CC", "cc") | ||
39 | + cmd = "%s -Wall -o ./prober/foo ./prober/%s %s -lpthread" % (cc, filename, linker_options) | ||
40 | |||
41 | p = subprocess.Popen(cmd, shell=True, stdout=STDOUT, stderr=STDERR) | ||
42 | |||
43 | -- | ||
44 | 2.48.1 | ||
45 | |||