Bug 15124

Summary: cmake-native fails to prepend c++ compiler after pulling the newest kirkstone/master with gcc13 on host
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jakub <malyjak>
Component: devtools / tool chainAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: High CC: meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, randy.macleod
Version: 4.0.10   
Target Milestone: 4.3 M1   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jakub 2023-05-19 14:31:18 UTC
Before I had no issues compiling my project using kirkstone branches but after updating today to the newest commits (after more than half year) I'm getting this error while building cmake-native from the poky recipe:

```
ERROR: cmake-native-3.22.3-r0 do_configure: ExecutionError('/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/temp/run.do_configure.1423904', 7, None, None)
ERROR: Logfile of failure stored in: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/temp/log.do_configure.1423904
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/user/Projects/yocto/poky/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-core/zlib/zlib_1.2.11.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-extended/xz/xz_5.2.6.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-extended/zstd/zstd_1.5.2.bb:do_populate_sysroot', 'virtual:native:/home/user/Projects/yocto/poky/meta/recipes-support/curl/curl_7.82.0.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['quilt-native', 'ncurses-native', 'zlib-native', 'bzip2-native', 'xz-native', 'zstd-native', 'curl-native', 'openssl-native', 'libtool-native', 'gettext-minimal-native', 'perl-native', 'texinfo-dummy-native', 'make-native', 'gdbm-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_configure
| ---------------------------------------------
| Source directory: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/cmake-3.22.3
| Binary directory: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/build
| Prefix directory: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/recipe-sysroot-native/usr
| System:           Linux
| Generator:        Unix Makefiles
| Doing parallel make: 8
|
| ---------------------------------------------
| CMake 3.22.3, Copyright 2000-2021 Kitware, Inc. and Contributors
| C compiler on this system is: gcc -isystem/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/recipe-sysroot-native/usr/include -O2 -pipe
| ---------------------------------------------
| Error when bootstrapping CMake:
| Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
| Please specify one using environment variable CXX.
| The C++ flags are "-isystem/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/recipe-sysroot-native/usr/include -O2 -pipe".
| They can be changed using the environment variable CXXFLAGS.
| See cmake_bootstrap.log for compilers attempted.
| ---------------------------------------------
| Log of errors: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/build/Bootstrap.cmk/cmake_bootstrap.log
| ---------------------------------------------
| WARNING: /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/temp/run.do_configure.1423904:143 exit 7 from '/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/cmake-3.22.3/configure --verbose --prefix=/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/recipe-sysroot-native/usr --parallel=8 -- -DCMAKE_LIBRARY_PATH=/home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/recipe-sysroot-native/usr/lib -DBUILD_CursesDialog=1 -DCMAKE_USE_SYSTEM_LIBRARIES=1-DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 -DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=0 -DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 -DHAVE_SYS_ACL_H=0 -DCURL_LIBRARIES=-lcurl'
| WARNING: Backtrace (BB generated script):
|       #1: do_configure, /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/temp/run.do_configure.1423904, line 143
|       #2: main, /home/user/Builds/swupdate-rpi/tmp/work/x86_64-linux/cmake-native/3.22.3-r0/temp/run.do_configure.1423904, line 150
ERROR: Task (/home/user/Projects/yocto/poky/meta/recipes-devtools/cmake/cmake-native_3.22.3.bb:do_configure) failed with exit code '1'
```

It seems like gcc is properly prepended to CFLAGS but for some reason g++ isn't in case of CXXFLAGS. My build system is:

```
OS: Garuda Linux x86_64
Host: VMware Virtual Platform
Kernel: 6.3.2-zen1-1-zen
```

And it has:
```
gcc (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
```
g++ (GCC) 13.1.1 20230429
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

All was working just well yesterday before the pull.
I also tried to rebuild from scratch but the same error is being generated.
Comment 1 Jakub 2023-05-24 11:26:46 UTC
I found no change in the Poky / OE repository that would break it. As I assumed, this is OS specific bug. I switched back to supported Ubuntu LTS for building yocto and everything works as well. Please close this issues since it's for unsupported host.

Best,

Jakub
Comment 2 Randy MacLeod 2023-05-25 14:41:32 UTC
This is a general problem encountered when the host gcc is version 13.
Comment 3 Richard Purdie 2023-06-08 09:35:01 UTC
Resolved with an upgrade to uninative: https://git.yoctoproject.org/poky/commit/?id=6ebe71a52eae6b539560aa6a1ea12964dd10ed1e