[CMake] Ninja fails, Make succeeds...

Mikael Lyngvig mikael at lyngvig.org
Tue Jun 26 19:37:52 EDT 2012


FYI: On Linux (using CMake v2.8.8 and a recent Ninja), the Ninja build
works as expected.  Just like it used to do on Windows.  I now suspect the
problem is related to the CMake version I use (cmake version
2.8.8.20120605).  I picked it up somewhere I don't recall and that's
probably the cause of the problem.  I'll try downloading the most recent
binary pre-release and see if that doesn't fix the problem.

If so, I apologize for any wasted time.


Cheers,
Mikael

2012/6/27 David Cole <david.cole at kitware.com>

> On Tue, Jun 26, 2012 at 6:40 PM, Mikael Lyngvig <mikael at lyngvig.org>
> wrote:
> > Ohh, sorry.  Ninja says:
> >
> > [117/325] Building CXX object Driver/CMakeFiles/Driver.dir/Driver.cpp.obj
> > FAILED: c:\Mingw64\bin\c++.exe   -DNDEBUG
> > -DBR0_BUILD_ASSERT=BR0_BUILD_ASSERT_DELETE
> > -DBR0_BUILD_CHARSET=BR0_BUILD_CHARSET_ASCII
> > -DBR0_BUILD_ENDIAN=BR0_BUILD_ENDIAN_LITTLE
> > -DBR0_BUILD_MODE=BR0_BUILD_MODE_SHIP
> > -DBR0_BUILD_TARGET=BR0_BUILD_TARGET_WINDOWS -Wall -Wno-long-long
> -pedantic
> > -I.. -Ic:/Synology/clang-3.2-WIN64/include    -static-libgcc -MMD -MT
> > Driver/CMakeFiles/Driver.dir/Driver.cpp.obj -MF
> > "Driver/CMakeFiles/Driver.dir/Driver.cpp.obj.d" -o
> > Driver/CMakeFiles/Driver.dir/Driver.cpp.obj -c
> > C:/Dropbox/Source/braceless/src/Driver/Driver.cpp
> > C:/Dropbox/Source/braceless/src/Driver/Driver.cpp:11:42: fatal error:
> > Braceless0/Backend/Backend.hpp: No such file or directory
> > compilation terminated.
> > [117/325] Building CXX object Driver/CMakeFiles/Driver.dir/Setup.cpp.obj
> > ninja: build stopped: subcommand failed.
> >
> > The problem is that the file Driver.cpp depends on Backend.hpp having
> been
> > created.  But Driver.cpp should not be compiled until the second-last
> item
> > in the list of objects to make ([324/325]).
> >
> > So, somehow, Ninja picks up the target Driver.obj and builds it way too
> > early.  With GNU Make, everything goes according to plan, but with Ninja,
> > there's some sort of confusion somewhere.
> >
> >
> > Cheers,
> > Mikael
> >
> > 2012/6/27 David Cole <david.cole at kitware.com>
> >>
> >> On Tue, Jun 26, 2012 at 6:30 PM, Mikael Lyngvig <mikael at lyngvig.org>
> >> wrote:
> >> > No, I delete the entire build tree (I build out of the source tree,
> >> > btw).
> >> >
> >> > The procedure is as follows:
> >> >
> >> >    rem foo contains the source code
> >> >    md foo-build
> >> >    cd foo-build
> >> >    cmake -G Ninja ..\foo
> >> >    ninja
> >> >    rem fails as described earlier
> >>
> >>
> >> But you didn't really describe the failure.
> >>
> >> What is the error output? (from cmake or from ninja?)
> >>
> >>
> >> >
> >> >     cd ..
> >> >     rd /s /q foo-build
> >> >     md foo-build
> >> >     cd foo-build
> >> >     cmake -G "MinGW Makefiles" ..\foo
> >> >     make
> >> >     rem succeeds as described earlier
> >> >
> >> > Thank you for your reply.  If you need source, I can send you a zip
> >> > archive
> >> > as it is an incomplete open source project.
> >> >
> >> >
> >> > Cheers,
> >> > Mikael
> >> >
> >> >
> >> > 2012/6/27 David Cole <david.cole at kitware.com>
> >> >>
> >> >> You can't switch generators in the same build tree without deleting
> >> >> absolutely everything and starting over.
> >> >>
> >> >> Is that what you're trying to do?
> >> >>
> >> >> If you want a make build tree and a ninja build tree, you'll need two
> >> >> separate build trees....
> >> >>
> >> >>
> >> >> HTH,
> >> >> David
> >> >>
> >> >>
> >> >> On Tue, Jun 26, 2012 at 4:45 PM, Mikael Lyngvig <mikael at lyngvig.org>
> >> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I am a fan of Ninja.  Since I started using it, everything's been
> >> >> > built
> >> >> > much, much faster than before.  Among other things because I use
> >> >> > CMake
> >> >> > to
> >> >> > publish headers to the binary directory so as to allow me to
> include
> >> >> > the
> >> >> > headers with a relative path without having to move all my headers
> to
> >> >> > a
> >> >> > central include directory (I want my source files and headers to be
> >> >> > in
> >> >> > the
> >> >> > same directory).  Ninja does this very fast, whereas GNU Make takes
> >> >> > forever
> >> >> > to publish my header files.
> >> >> >
> >> >> > However, I have a puzzling problem: Out of the blue, Ninja started
> >> >> > failing
> >> >> > to build my project.  If I remake the project with 'cmake -G "MinGW
> >> >> > Makefiles"', it takes ages to build but it succeeds.  If I do
> 'cmake
> >> >> > -G
> >> >> > Ninja', it quickly aborts because it seems that either CMake or
> Ninja
> >> >> > wants
> >> >> > to build one of the last targets at a very early point in the build
> >> >> > phase.
> >> >> >  I have an executable, driver.exe, which is supposed to be built as
> >> >> > the
> >> >> > very
> >> >> > last item.  With Ninja, however, it pops up around 20 percent into
> >> >> > the
> >> >> > build
> >> >> > and the build fails because the dependent libraries are nowhere to
> be
> >> >> > found
> >> >> > (they haven't been built yet).  I have tried clearing the binaries
> >> >> > directory
> >> >> > (rd /s /q foo & md foo) and so on a number of times, but Ninja
> >> >> > insists
> >> >> > on
> >> >> > trying to build this final executable at a very early stage.
> >> >> >
> >> >> > Any ideas?  I suppose the problem is caused by one of these three
> >> >> > things:
> >> >> >
> >> >> >    1. An error on my part.  Very likely.
> >> >> >    2. An error in CMake's generation of Ninja scripts.  Not
> unlikely
> >> >> > due
> >> >> > to
> >> >> > the still fairly immature support for Ninja.
> >> >> >    3. An error in Ninja.  Highly unlikely as Ninja builds tons and
> >> >> > tons
> >> >> > of
> >> >> > projects all over the world each day and nobody seem to have run
> into
> >> >> > this
> >> >> > problem before.
> >> >> >
> >> >> > How do you locate the problem?
> >> >> >
> >> >> > Thanks in advance!
> >> >> >
> >> >> >
> >> >> > Cheers,
> >> >> > Mikael
> >> >> > -- Love Thy Frog!
> >> >> >
> >> >> > --
> >> >> >
> >> >> > Powered by www.kitware.com
> >> >> >
> >> >> > Visit other Kitware open-source projects at
> >> >> > http://www.kitware.com/opensource/opensource.html
> >> >> >
> >> >> > Please keep messages on-topic and check the CMake FAQ at:
> >> >> > http://www.cmake.org/Wiki/CMake_FAQ
> >> >> >
> >> >> > Follow this link to subscribe/unsubscribe:
> >> >> > http://www.cmake.org/mailman/listinfo/cmake
> >> >
> >> >
> >
> >
>
> What does your add_custom_command look like that generates Backend.hpp?
>
> (offline for a while, next response much later... :-)
>



-- 
-- Love Thy Frog!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120627/35e92f7c/attachment.htm>


More information about the CMake mailing list