View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015523CMakeCMakepublic2015-04-20 09:042016-02-01 09:10
ReporterNorbert Pfeiler 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015523: ninja AUTORCC with AUTOGEN_TARGET_DEPENDS generated resources
DescriptionWith the changes from http://www.cmake.org/Bug/view.php?id=15459, [^]
using AUTOGEN_TARGET_DEPENDS to generate files to be added as resource by AUTORCC adds rcc error messages for the not-yet-existing files to the generated makefile.
Steps To Reproducetry to build the attached test case with ninja
TagsNo tags attached.
Attached Files7z file icon cmake_generated_resource_test.7z [^] (664 bytes) 2015-04-20 09:04

 Relationships
related to 0015459closedBrad King autogen broken for ninja generator 
related to 0015520closedKitware Robot AUTORCC fails with multiple .qrc files in the same target 
related to 0015644closedBrad King AUTORCC not generating files with Qt 5.1 

  Notes
(0038547)
Brad King (manager)
2015-04-20 10:01

AFAIK this is impossible to implement correctly because Ninja does not support build-time detection of build rule outputs.
(0038548)
Brad King (manager)
2015-04-20 10:04

Related Ninja issue:

 https://github.com/martine/ninja/issues/760 [^]

Basically there is no way to have Ninja run rules and recognize that files on which other rules depend have changed unless they are explicitly listed as outputs of the rules that generate them. With generated files CMake has no way to know these outputs up front when generating the build.ninja file, and Ninja offers no way to tell it later.
(0038549)
Brad King (manager)
2015-04-20 10:06

Related thread on Ninja mailing list about build-time output detection:

 Adding Ninja features needed for Fortran
 https://groups.google.com/forum/#!topic/ninja-build/tPOcu5EWXio [^]
(0038550)
Norbert Pfeiler (reporter)
2015-04-20 11:11

> With generated files CMake has no way to know these outputs up front when generating the build.ninja file

Isn’t the output explicitly specified in add_custom_command?

I’m not sure I follow…
The current issue is, that, instead of adding a dependency to a non-existing file for which a build rule exists, an error message is added.
It would even work if erroneous paths would not be added at all, because I add them via AUTOGEN_TARGET_DEPENDS explicitly.
(0038551)
Brad King (manager)
2015-04-20 11:32

Re 0015523:0038550: The problem is not the output of the custom command that generates the resources. The problem is the "cmake -E cmake_autogen" command that needs to run at the start of every build. That command may update several files as side effects that are also dependencies of later build rules. Ninja wants these to be listed as explicit outputs of the rule that runs cmake_autogen but we don't know these outputs until build time if the .qrc files are generated, and Ninja offers no facility to tell it later.
(0038552)
Norbert Pfeiler (reporter)
2015-04-20 11:42

I’m not generating *.qrc files here. Just files which are listed inside of one.
(0038553)
Brad King (manager)
2015-04-20 11:43

Sorry, I jumped to the assumption that this issue is about generated .qrc files. The actual problem is that the warning message rcc generates about missing resource files is treated as a listed resource.

The problem is that the cmQtAutoGenerators methods use RunSingleCommand to run 'rcc --list' which merges its stdout/stderr together.
(0038554)
Norbert Pfeiler (reporter)
2015-04-20 11:45

Under Windows 10 there are also messages about »untested Windows version 10 detected« which get listed there. I think this is the same issue.
(0038564)
Brad King (manager)
2015-04-20 15:56

With the attached cmake_generated_resource_test.7z I cannot get this to work even with the Unix Makefiles generator. Unless the generated file has already been created, on the first "make" I get:

make[2]: *** No rule to make target 'CMakeFiles/cmake_generated_resource_test.dir/qrc_resources.cpp', needed by 'CMakeFiles/cmake_generated_resource_test.dir/CMakeFiles/cmake_generated_resource_test.dir/qrc_resources.cpp.o'. Stop.
(0038565)
Norbert Pfeiler (reporter)
2015-04-20 16:06
edited on: 2015-04-20 16:28

cmake --version && make --version && mkdir build && cd build && cmake .. && make
cmake version 3.2.20150420-g73ff2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
GNU Make 4.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> [^]
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mobile/Downloads/cmake_generated_resource_test/build
Scanning dependencies of target cmake_generated_resource_test_automoc
[ 16%] Generating ../foo.txt
[ 33%] Automatic moc and rcc for target cmake_generated_resource_test
[ 33%] Built target cmake_generated_resource_test_automoc
Scanning dependencies of target cmake_generated_resource_test
[ 50%] Building CXX object CMakeFiles/cmake_generated_resource_test.dir/main.cpp.o
[ 66%] Building CXX object CMakeFiles/cmake_generated_resource_test.dir/cmake_generated_resource_test_automoc.cpp.o
[ 83%] Building CXX object CMakeFiles/cmake_generated_resource_test.dir/CMakeFiles/cmake_generated_resource_test.dir/qrc_resources.cpp.o
[100%] Linking CXX executable cmake_generated_resource_test
[100%] Built target cmake_generated_resource_test

(0038566)
Brad King (manager)
2015-04-20 16:30

In 0015523:0038564 I was testing a local change to cmQtAutoGenerators to separate stdout and stderr so that the rcc warning messages would be ignored. It turns out that cmQtAutoGenerators is depending on seeing the stderr lines to recognize the

 RCC: Error in '.../resources.qrc': Cannot find file 'foo.txt'

line and take that as a dependency.
(0038572)
Brad King (manager)
2015-04-21 09:38

Fixed and test added:

 QtAutogen: Process 'rcc --list' stdout and stderr separately
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=258ba828 [^]
(0038755)
Norbert Pfeiler (reporter)
2015-05-17 20:28

I just want to add that the windows 10 thing i mentioned (http://www.cmake.org/Bug/view.php?id=15523#c38554 [^]) is fixed with this too.
(0040401)
Robert Maynard (manager)
2016-02-01 09:10

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-04-20 09:04 Norbert Pfeiler New Issue
2015-04-20 09:04 Norbert Pfeiler File Added: cmake_generated_resource_test.7z
2015-04-20 10:00 Brad King Relationship added related to 0015459
2015-04-20 10:01 Brad King Note Added: 0038547
2015-04-20 10:02 Brad King Relationship added related to 0015520
2015-04-20 10:04 Brad King Note Added: 0038548
2015-04-20 10:06 Brad King Note Added: 0038549
2015-04-20 11:11 Norbert Pfeiler Note Added: 0038550
2015-04-20 11:32 Brad King Note Added: 0038551
2015-04-20 11:42 Norbert Pfeiler Note Added: 0038552
2015-04-20 11:43 Brad King Note Added: 0038553
2015-04-20 11:44 Brad King Assigned To => Stephen Kelly
2015-04-20 11:44 Brad King Status new => assigned
2015-04-20 11:45 Norbert Pfeiler Note Added: 0038554
2015-04-20 15:56 Brad King Note Added: 0038564
2015-04-20 16:06 Norbert Pfeiler Note Added: 0038565
2015-04-20 16:28 Norbert Pfeiler Note Edited: 0038565
2015-04-20 16:30 Brad King Note Added: 0038566
2015-04-20 16:43 Brad King Assigned To Stephen Kelly => Brad King
2015-04-20 16:43 Brad King Target Version => CMake 3.3
2015-04-21 09:38 Brad King Note Added: 0038572
2015-04-21 09:38 Brad King Status assigned => resolved
2015-04-21 09:38 Brad King Resolution open => fixed
2015-04-21 09:38 Brad King Fixed in Version => CMake 3.3
2015-05-17 20:28 Norbert Pfeiler Note Added: 0038755
2015-07-09 11:50 Brad King Relationship added related to 0015644
2016-02-01 09:10 Robert Maynard Note Added: 0040401
2016-02-01 09:10 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team