On Mon, Feb 24, 2014 at 8:26 PM, Brad King <brad.king at kitware.com> wrote:> On 02/24/2014 10:02 AM, Alexey Samsonov wrote: > > Yes, 2.8.10.2 to be exact. > > Well, the upstream change I made to simplify this feature in > the future: > > ExternalProject: Add option to always run the build step > http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73e5c6ae > > includes a test that touches a file in the external project > source. It passes our test suite with the Ninja generator. > > Please see if you can reproduce this with CMake 'master' from > Git: >Yep, I can reproduce it with latest CMake and ninja: $ cmake --version cmake version 3.0.20140225-gcd8c $ ninja --version 1.4.0.git I configure LLVM with -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON (with applied patches http://llvm-reviews.chandlerc.com/D2868 and http://llvm-reviews.chandlerc.com/D2874) Then I run $ ninja compiler-rt twice. The first run builds the libraries, the second shows only: "ninja: no work to do." message.> > git clone git://cmake.org/cmake.git CMake && > mkdir CMake-build && > cd CMake-build && > ../CMake/bootstrap --parallel=8 && > make -j 8 && > bin/cmake --version > > Thanks, > -Brad > >-- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140225/f0efa6bd/attachment.html>
On 02/25/2014 03:28 AM, Alexey Samsonov wrote:> Then I run > $ ninja compiler-rt > twice. The first run builds the libraries, the second shows only: > "ninja: no work to do." message.I'm able to reproduce that, thanks. This is a subtle interaction between always-out-of-date rules and order-only dependencies. The problem is that the build.ninja file has the rule: build projects/compiler-rt/src/compiler-rt-stamp/compiler-rt-force-reconfigure: phony || bin/clang bin/llvm-config to express the always-out-of-date force-reconfigure rule. The Ninja documentation says: "If a phony build statement is written without any dependencies, the target will be considered out of date if it does not exist." However, the rule has dependencies because the Ninja generator implements add_dependencies by adding order-only dependencies to every individual rule in the dependent target on all dependencies. It looks like the Ninja generator needs to write a rule is always out of date but still has order-only dependencies. I think this will work: build projects/compiler-rt/src/compiler-rt-stamp/compiler-rt-force-reconfigure: phony | always || bin/clang bin/llvm-config build always: phony I've recorded this issue in the CMake issue tracker: http://www.cmake.org/Bug/view.php?id=14771 -Brad
Hi Brad, Thanks for investigating this. Do you think it makes sense to land my ExternalProject_Add patch so that others can experiment with it? I can add quit with a fatal_error/warning if the build tree rules are generated with Ninja. However, there is a problem with Unix Makefiles as well: parallelism doesn't work when I run "make check-compiler-rt -j8" in the original build tree, presumably because we call "cd /path/to/compiler-rt/build/tree && make check-all" there. On Tue, Feb 25, 2014 at 7:02 PM, Brad King <brad.king at kitware.com> wrote:> On 02/25/2014 03:28 AM, Alexey Samsonov wrote: > > Then I run > > $ ninja compiler-rt > > twice. The first run builds the libraries, the second shows only: > > "ninja: no work to do." message. > > I'm able to reproduce that, thanks. This is a subtle interaction > between always-out-of-date rules and order-only dependencies. > > The problem is that the build.ninja file has the rule: > > build > projects/compiler-rt/src/compiler-rt-stamp/compiler-rt-force-reconfigure: > phony || bin/clang bin/llvm-config > > to express the always-out-of-date force-reconfigure rule. The Ninja > documentation says: > > "If a phony build statement is written without any dependencies, > the target will be considered out of date if it does not exist." > > However, the rule has dependencies because the Ninja generator implements > add_dependencies by adding order-only dependencies to every individual > rule in the dependent target on all dependencies. > > It looks like the Ninja generator needs to write a rule is always out > of date but still has order-only dependencies. I think this will work: > > build > projects/compiler-rt/src/compiler-rt-stamp/compiler-rt-force-reconfigure: > phony | always || bin/clang bin/llvm-config > build always: phony > > I've recorded this issue in the CMake issue tracker: > > http://www.cmake.org/Bug/view.php?id=14771 > > -Brad >-- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140226/a8c08ea5/attachment.html>