cmake: CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES contains a corrupted include path
We are running our yocto build system with CMake version 3.22.3. We are getting sporadic build errors during the compilation phase, as shown below.
| /home/builder/bs-workspace/node0/master/qemux86-64/build/tmp/work/core2-64-poky-linux/hsm-tool/1.0.0+gitrAUTOINC+f7cf2c4b0d-r0/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.
When we debugged and found that,
In build/CMakeFiles/3.22.3/CMakeCXXCompiler.cmake file, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES variable has corrupted include path like below,
/home/builder/src/base/build_idc23/tmp/work/cortexa76-cortexa55-poky-linux/camera-provider/23.52.3+gitrAUTOINC+c5697a9772-r0/reGNU assembler version 2.38 (aarch64-poky-linux) using BFD version (GNU Binutils) 2.38.20220708
We looked into the CMakeOutput.log under build/CMakeFiles/ in more detail and discovered that, while Detecting CXX compiler ABI info, the include path is corrupt with assembler version print. like below,
/home/builder/src/base/build_idc23/tmp/work/cortexa76-cortexa55-poky-linux/camera-provider/23.52.3+gitrAUTOINC+c5697a9772-r0/reGNU assembler version 2.38 (aarch64-poky-linux) using BFD version (GNU Binutils) 2.38.20220708cipe-sysroot/usr/include
In working case, the print is like below,
/home/builder/src/base/build_idc23/tmp/work/cortexa76-cortexa55-poky-linux/camera-provider/23.52.3+gitrAUTOINC+c5697a9772-r0/recipe-sysroot/usr/include
GNU assembler version 2.38 (aarch64-poky-linux) using BFD version (GNU Binutils) 2.38.20220708
We were occasionally experiencing this problem.