Instability with configure_file()
We have a build of Zephyr running in CI (Azure DevOps.) We are running a build that sometimes fails, but then on re-run, it sometimes passes. The failure, when it happens, points to either one of these lines in a CMakeLists.txt
configure_file(${CMAKE_CURRENT_LIST_DIR}/SEGGER_RTT_Conf.h ${CMAKE_CURRENT_LIST_DIR}/../../../../modules/debug/segger/Config/SEGGER_RTT_Conf.h)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vendor-prefixes.txt" "${CMAKE_CURRENT_LIST_DIR}/../../../../zephyr/dts/bindings/vendor-prefixes.txt")
There are 4 builds that all use this CMakeLists.txt
file and all want the files copied. Typically what is observed is that one of these build jobs complains like so:
CMake Error at /__w/1/imx/imx-application/soc/arm/imx8mp_m7/CMakeLists.txt:6 (configure_file):
No such file or directory
But the rest of the build jobs pass. But have also seen a case where one build job show:
CMake Error at /__w/1/imx/imx-application/soc/arm/imx8mp_m7/CMakeLists.txt:6 (configure_file):
No such file or directory
and the next shows:
CMake Error at /__w/1/imx/imx-application/soc/arm/imx8mp_m7/CMakeLists.txt:7 (configure_file):
No such file or directory
then the rest of the jobs pass.
This makes me suspect that there is some kind of race condition going on here between the file being copied and some other action. We have other cases where we use configure_file()
and have not seen any issues from that but in all these cases we run it with COPYOPNLY.
I think using COPYONLY
will likely remove this failure for us as we are not using the transformation tags in any of these files, but I would not expect it to give this failure either way.
Always when I have logged into the server after seeing this failure all files have been copied and contain what is expected.