diff options
| author | Philip Lorenz <philip.lorenz@bmw.de> | 2024-11-07 08:58:01 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-11-18 06:59:35 -0800 |
| commit | 582da2a157567f4169c675f09a381b343bec9688 (patch) | |
| tree | cc6c95aefb110c17020b959ba739a4d1db45e54f /meta/recipes-devtools | |
| parent | b7d43e74a0a6b412d286399dcd433873aee79ee0 (diff) | |
| download | poky-582da2a157567f4169c675f09a381b343bec9688.tar.gz | |
cmake: Fix sporadic issues when determining compiler internals
When `-pipe` is enabled, GCC passes data between its different
executables using pipes instead of temporary files. This leads to issues
when cmake attempts to infer compiler internals via the `-v` parameter
as each executable will print to `stderr` in parallel.
In turn this may lead to compilation issues down the line as for example
the system include directories could not be determined properly which
may then propagate to issues such as:
recipe-sysroot/usr/include/c++/11.3.0/cstdlib:75:15: fatal error:
stdlib.h: No such file or directory
| 75 | #include_next <stdlib.h>
| | ^~~~~~~~~~
| compilation terminated.
| ninja: build stopped: subcommand failed.
| WARNING: exit code 1 from a shell command.
Fix this stripping `-pipe` from the command line used to determine
compiler internals.
(From OE-Core rev: ef5c060a939416b4034be1b8b81f9035b23534b7)
Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/cmake/cmake.inc | 3 | ||||
| -rw-r--r-- | meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch | 52 |
2 files changed, 54 insertions, 1 deletions
diff --git a/meta/recipes-devtools/cmake/cmake.inc b/meta/recipes-devtools/cmake/cmake.inc index ab9f459c05..a52506a8ea 100644 --- a/meta/recipes-devtools/cmake/cmake.inc +++ b/meta/recipes-devtools/cmake/cmake.inc | |||
| @@ -17,7 +17,8 @@ LIC_FILES_CHKSUM = "file://Copyright.txt;md5=9d3d12c5f3b4c1f83650adcc65b59c06 \ | |||
| 17 | CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" | 17 | CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" |
| 18 | 18 | ||
| 19 | SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \ | 19 | SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \ |
| 20 | " | 20 | file://0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch \ |
| 21 | " | ||
| 21 | 22 | ||
| 22 | SRC_URI[sha256sum] = "72b7570e5c8593de6ac4ab433b73eab18c5fb328880460c86ce32608141ad5c1" | 23 | SRC_URI[sha256sum] = "72b7570e5c8593de6ac4ab433b73eab18c5fb328880460c86ce32608141ad5c1" |
| 23 | 24 | ||
diff --git a/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch b/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch new file mode 100644 index 0000000000..7ffcc95ac3 --- /dev/null +++ b/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From bd94bbdc35a9da4c73d538e0cc55bc95944f620d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Philip Lorenz <philip.lorenz@bmw.de> | ||
| 3 | Date: Mon, 3 Jun 2024 13:19:24 +0200 | ||
| 4 | Subject: [PATCH] CMakeDetermineCompilerABI: Strip -pipe from compile flags | ||
| 5 | |||
| 6 | When `-pipe` is enabled, GCC passes data between its different | ||
| 7 | executables using pipes instead of temporary files. This leads to issues | ||
| 8 | when cmake attempts to infer compiler internals via the `-v` parameter | ||
| 9 | as each executable will print to `stderr` in parallel. | ||
| 10 | |||
| 11 | For example we have observed the following outputs in our builds which | ||
| 12 | sporadically lead to build failures as system include directories were | ||
| 13 | not detected reliably: | ||
| 14 | |||
| 15 | Parsed CXX implicit include dir info from above output: rv=done | ||
| 16 | found start of include info | ||
| 17 | found start of implicit include info | ||
| 18 | add: [.../usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.4.0/include] | ||
| 19 | add: [.../usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.4.0/include-fixed] | ||
| 20 | add: [.../usr/include/c++/11.4.0] | ||
| 21 | add: [.../usr/include/c++/11.4.0/x86_64-poky-linux] | ||
| 22 | add: [.../usr/include/c++/11.4.0/backward] | ||
| 23 | add: [.../usr/lib/x86_64-poky-linux/11.4.0/include] | ||
| 24 | add: [...GNU assembler version 2.38 (x86_64-poky-linux) using BFD version (GNU Binutils) 2.38.20220708] | ||
| 25 | add: [/usr/include] | ||
| 26 | end of search list found | ||
| 27 | |||
| 28 | Fix this issue by stripping the `-pipe` parameter from the compilation | ||
| 29 | flag when determining the toolchain configuration. | ||
| 30 | |||
| 31 | Upstream-Status: Backport [3.32.0, 71be059f3f32b6791427893a48ba4815a19e2e78] | ||
| 32 | Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de> | ||
| 33 | --- | ||
| 34 | Modules/CMakeDetermineCompilerABI.cmake | 5 +++++ | ||
| 35 | 1 file changed, 5 insertions(+) | ||
| 36 | |||
| 37 | diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake | ||
| 38 | index efc18f93c2..f2e40479b1 100644 | ||
| 39 | --- a/Modules/CMakeDetermineCompilerABI.cmake | ||
| 40 | +++ b/Modules/CMakeDetermineCompilerABI.cmake | ||
| 41 | @@ -43,6 +43,11 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) | ||
| 42 | |||
| 43 | # Avoid failing ABI detection on warnings. | ||
| 44 | string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}") | ||
| 45 | + # Avoid passing of "-pipe" when determining the compiler internals. With | ||
| 46 | + # "-pipe" GCC will use pipes to pass data between the involved | ||
| 47 | + # executables. This may lead to issues when their stderr output (which | ||
| 48 | + # contains the relevant compiler internals) becomes interweaved. | ||
| 49 | + string(REGEX REPLACE "(^| )-pipe( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}") | ||
| 50 | |||
| 51 | # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables | ||
| 52 | # and set them to "C" that way GCC's "search starts here" text is in | ||
