Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
6.0
-
None
-
-
a1ccedeb440216dce87fad01746935a89fd8715e (qt/qtbase/dev)
Description
Failed change here https://codereview.qt-project.org/c/qt/qttools/+/295833
Regression culprit: https://codereview.qt-project.org/c/qt/qtbase/+/299372
Failure message:
FAILED: "C:/CMake/bin/cmcldeps.exe" RC C:\Users\qt\work\qt\qttools\src\assistant\help\Help_resource.rc src\assistant\help\CMakeFiles\Help.dir\Help_resource.rc.res.d src\assistant\help\CMakeFiles\Help.dir\Help_resource.rc.res "Note: including file: " "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe -DHelp_EXPORTS -DQHELP_LIB -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_HELP_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_HELP_LIB -DQT_MOC_COMPAT -DQT_NETWORK_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_SQL_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_USE_MATH_DEFINES -D_WIN64 -Ddeprecations -IC:\Users\qt\work\qt\qttools\src\assistant\help\Help_autogen\include -IC:\Users\qt\work\qt\qttools\include -IC:\Users\qt\work\qt\qttools\include\QtHelp -I\Users\qt\work\qt\qttools\src\assistant\help -IC:\Users\qt\work\qt\qttools\src\assistant\help -IC:\Users\qt\work\qt\qttools\include\QtHelp\6.0.0 -IC:\Users\qt\work\qt\qttools\include\QtHelp\6.0.0\QtHelp -IC:\Users\qt\work\install\include\QtCore -IC:\Users\qt\work\install\mkspecs\win32-msvc -IC:\Users\qt\work\install\include -IC:\Users\qt\work\install\include\QtGui -IC:\VulkanSDK\1.0.51.0\Include -IC:\Users\qt\work\install\include\QtSql -IC:\Users\qt\work\install\include\QtWidgets -IC:\Users\qt\work\install\include\QtCore\6.0.0 -IC:\Users\qt\work\install\include\QtCore\6.0.0\QtCore -IC:\Users\qt\work\install\include\QtNetwork -DWIN32 /fo src\assistant\help\CMakeFiles\Help.dir\Help_resource.rc.res C:\Users\qt\work\qt\qttools\src\assistant\help\Help_resource.rc cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release c1: fatal error C1083: Cannot open source file: 'C:\Users\qt\work\qt\qttools\src\assistant\help\Help_resource.rc': No such file or directory
Observations:
For some reason the add_custom_command that is supposed to copy Help_resources.rc.tmp to Help_resources.rc is not created in build.ninja, but ONLY for the Help target, for the UiTools target it's present.
Only some placeholder rule is generated which creates no file:
# Assume dependencies for generated source file.
build C$:\Users\qt\work\qt\qttools_b\src\assistant\help\Help_resource.rc: CUSTOM_COMMAND || cmake_object_order_depends_target_Help_RelWithDebInfo_rc_RelWithDebInfo
COMMAND = cmd.exe /c
restat = 1
The above placeholder is also present for the UiTools rc file, but there's also an additional rule that actually copies the file:
############################################# # Custom command for src\designer\src\uitools\UiTools_resource.rc build src\designer\src\uitools\UiTools_resource.rc: CUSTOM_COMMAND src\designer\src\uitools\UiTools_resource.rc.tmp COMMAND = cmd.exe /C "cd /D C:\Users\qt\work\qt\qttools_b\src\designer\src\uitools && C:\CMake\bin\cmake.exe -E copy_if_different C:/Users/qt/work/qt/qttools_b/src/designer/src/uitools/UiTools_resource.rc.tmp C:/Users/qt/work/qt/qttools_b/src/designer/src/uitools/UiTools_resource.rc" DESC = Generating UiTools_resource.rc restat = 1
Second observation is that the existence of two rules to create the same file is fundamentally incorrect, and if the output generated path is an absolute path, ninja will actually complain saying that duplicate rules are found.
But with in-source builds it seems that one rule uses relative paths and another rule uses an absolute path, and thus no warning is printed.
Third observation is that if the generator expression condition is removed from the target link libraries call, then the rule is correctly generated. So
# broken target_link_libraries(${target} PRIVATE "$<$<CONFIG:${cfg}>:${target}_${cfg}_rc>") # works target_link_libraries(${target} PRIVATE "${target}_${cfg}_rc")
We have no idea yet why the above behaviors are like they are, and why the Help target is special.
Presumably this is some issue in cmake itself.
Regular add custom commands don't seem to exhibit this strange behavior, it seems to be tied to usage of RC files on Windows.
Workaround:
Use an OBJECT library instead of an INTERFACE library. We have no idea why it helps though.