Re: [cmake-developers] ninja bug on windows

2012-03-14 Thread Bill Hoffman

On 3/13/2012 10:39 PM, Peter Collingbourne wrote:

Maybe another time we can think about ways to improve PCH support,
but for now I guess we can add an OR Ninja to this test and add
OBJECT_OUTPUTS support to the Ninja generator.

I tried making that blog active for ninja and a I get a new error:


122: ninja: ERROR: 'PCH\foo_precompiled.pch', needed by 
'CMakeFiles\foo.dir\foo1.c.obj', missing and no known rule to make it



So, Ninja is not handling OBJECT_OUTPUTS and OBJECT_DEPENDS correctly?


  SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES
OBJECT_OUTPUTS ${PCH_DIR}/foo_precompiled.pch)

  # These source files use the precompiled header.
  SET_SOURCE_FILES_PROPERTIES(${foo_SRCS} PROPERTIES
OBJECT_DEPENDS ${PCH_DIR}/foo_precompiled.pch)

-Bill
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] ninja bug on windows

2012-03-14 Thread Peter Collingbourne
On Wed, Mar 14, 2012 at 10:52:22AM -0400, Bill Hoffman wrote:
 On 3/13/2012 10:39 PM, Peter Collingbourne wrote:
 Maybe another time we can think about ways to improve PCH support,
 but for now I guess we can add an OR Ninja to this test and add
 OBJECT_OUTPUTS support to the Ninja generator.
 I tried making that blog active for ninja and a I get a new error:


 122: ninja: ERROR: 'PCH\foo_precompiled.pch', needed by  
 'CMakeFiles\foo.dir\foo1.c.obj', missing and no known rule to make it


 So, Ninja is not handling OBJECT_OUTPUTS and OBJECT_DEPENDS correctly?


   SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES
 OBJECT_OUTPUTS ${PCH_DIR}/foo_precompiled.pch)

   # These source files use the precompiled header.
   SET_SOURCE_FILES_PROPERTIES(${foo_SRCS} PROPERTIES
 OBJECT_DEPENDS ${PCH_DIR}/foo_precompiled.pch)

The Ninja generator is handling OBJECT_DEPENDS correctly but not
OBJECT_OUTPUTS.  Adding support shouldn't be too difficult -- we
just need to output a phony build statement creating a dependency
from any OBJECT_OUTPUTS to the object file.

Thanks,
-- 
Peter
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] ninja bug on windows

2012-03-13 Thread Bill Hoffman

On 3/13/2012 5:58 PM, Peter Kümmel wrote:


Not perfect because you tested it on an old build ;)

OK, I did a clean build tree, and it works now, thanks.



I just checked in a fix for
LinkDirectory

The remaining failing tests on windows are:
BuildDepends, ModuleDefinition, Plugin, and PrecompiledHeader


BuildDepends  - not sure what is up with this one, but it fails on the 
OSX as well.


ModuleDefinition - this one is because enable exports is not implemented 
for ninja yet, the properties for that are done like this:


SET_TARGET_PROPERTIES(example_exe PROPERTIES
  ENABLE_EXPORTS 1
  OUTPUT_NAME example
  # Test placing exe import library in unique directory.
  ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/exe
  )

Plugin - fails for the same reason as ModuleDefinition


PrecompiledHeader - This one seems to be a dependency problem.

The first time you run it you get this:

122: Run Build Command:C:/cygwin/bin/ninja.exe
[3/4] Building C object CMakeFiles\foo.dir\foo1.c.obj
122: FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe   /nologo /DWIN32 
/D_WINDOWS /W3 /Zm1000 /D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1 
/Yufoo_precompiled.h /FIfoo_precompiled.h /FpC:/Users/hoffman/Work/My 
Builds/cmake-ninja/Tests/PrecompiledHeader/PCH/foo_precompiled.pch 
/FoCMakeFiles\foo.dir\foo1.c.obj /Fdfoo.pdb -c C:\Users\hoffman\Work\My 
Builds\cmake\Tests\PrecompiledHeader\foo1.c

122:
122: foo1.c
122: C:\Users\hoffman\Work\My 
Builds\cmake\Tests\PrecompiledHeader\foo1.c : fatal error C1083: Cannot 
open precompiled header file: 'C:/Users/hoffman/Work/My 
Builds/cmake-ninja/Tests/PrecompiledHeader/PCH/foo_precompiled.pch': 
Permission denied
[3/4] Building C object CMakeFiles\foo.dir\foo_precompile.c.obj  out: 
foo_precom[3/4] Building C object CMakeFiles\foo.dir\foo2.c.obj 
  out: foo2.c

122: ninja: build stopped: subcommand failed.
1/1 Test #122: PrecompiledHeader ***Failed1.96 sec

If I run the test again, it passes.   Might be that ninja is doing more 
in parallel than gmake, nmake or visual studio.



-Bill
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] ninja bug on windows

2012-03-13 Thread Peter Collingbourne
On Tue, Mar 13, 2012 at 07:08:31PM -0400, Bill Hoffman wrote:
 PrecompiledHeader - This one seems to be a dependency problem.

 The first time you run it you get this:

 122: Run Build Command:C:/cygwin/bin/ninja.exe
 [3/4] Building C object CMakeFiles\foo.dir\foo1.c.obj
 122: FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe   /nologo /DWIN32  
 /D_WINDOWS /W3 /Zm1000 /D_DEBUG /MDd /Zi  /Ob0 /Od /RTC1  
 /Yufoo_precompiled.h /FIfoo_precompiled.h /FpC:/Users/hoffman/Work/My  
 Builds/cmake-ninja/Tests/PrecompiledHeader/PCH/foo_precompiled.pch  
 /FoCMakeFiles\foo.dir\foo1.c.obj /Fdfoo.pdb -c C:\Users\hoffman\Work\My  
 Builds\cmake\Tests\PrecompiledHeader\foo1.c
 122:
 122: foo1.c
 122: C:\Users\hoffman\Work\My  
 Builds\cmake\Tests\PrecompiledHeader\foo1.c : fatal error C1083: Cannot  
 open precompiled header file: 'C:/Users/hoffman/Work/My  
 Builds/cmake-ninja/Tests/PrecompiledHeader/PCH/foo_precompiled.pch':  
 Permission denied
 [3/4] Building C object CMakeFiles\foo.dir\foo_precompile.c.obj  out:  
 foo_precom[3/4] Building C object CMakeFiles\foo.dir\foo2.c.obj   
 out: foo2.c
 122: ninja: build stopped: subcommand failed.
 1/1 Test #122: PrecompiledHeader ***Failed1.96 sec

 If I run the test again, it passes.   Might be that ninja is doing more  
 in parallel than gmake, nmake or visual studio.

Yes, it is a dependency problem.  Neither the Makefile nor Ninja
generators can easily generate correct dependencies for PCH,
because the PCH output file name only appears in the compiler flags.
The CMakeLists.txt for this test contains a hack to add correct
dependency information for the Makefile generator:

 # Setup dependencies for precompiled header creation and use.  The VS
 # IDE takes care of this automatically.
 IF(${CMAKE_GENERATOR} MATCHES Makefile)
   # This source file creates the precompiled header as a side-effect.
   SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES
 OBJECT_OUTPUTS ${PCH_DIR}/foo_precompiled.pch)
 
   # These source files use the precompiled header.
   SET_SOURCE_FILES_PROPERTIES(${foo_SRCS} PROPERTIES
 OBJECT_DEPENDS ${PCH_DIR}/foo_precompiled.pch)
 ENDIF(${CMAKE_GENERATOR} MATCHES Makefile)

Maybe another time we can think about ways to improve PCH support,
but for now I guess we can add an OR Ninja to this test and add
OBJECT_OUTPUTS support to the Ninja generator.

Thanks,
-- 
Peter
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] ninja bug on windows

2012-03-10 Thread Peter Collingbourne
On Fri, Mar 09, 2012 at 02:10:45PM -0500, Bill Hoffman wrote:
 I am seeing that ninja always wants to relink the executables for me  
 every time it is run.  The output is this:

 $ ninja
 [1/9] Linking C static library  
 Utilities\cmlibarchive\libarchive\cmlibarchive.lib
 [2/9] Linking CXX executable bin\cmake.exe
 [3/9] Linking CXX executable bin\cmw9xcom.exe
 [4/9] Linking CXX executable bin\cpack.exe
 [5/9] Linking CXX executable bin\ctest.exe
 [6/9] Linking CXX executable Tests\CMakeLib\CMakeLibTests.exe
 [7/9] Generating ../Docs/ctest.txt
 [8/9] Generating ../Docs/cpack.txt
 [9/9] Generating ../Docs/cmake.txt

 Looks like the problem is libarchive getting recreated each time.

This seems to be a problem with the response file support in the
Windows branch of Ninja.  That branch of Ninja will always relink
any target (in this case cmlibarchive.lib) in the case where the
list of object files exceeds the command line length limit, because
it causes Ninja to use a response file with a different generated
name every time.  You can see this for yourself by examining the
.ninja_log file which contains the commands invoked by Ninja:

40  351 0   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja390.tmp cd.
751 54480   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\njaC0F.tmp cd.
681 69000   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja4F81.tmp cd.
616916264   0   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja4F95.tmp cd.
50  24430   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja8.tmp cd.
51  361 0   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja11.tmp cd.
50  351 0   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja19.tmp cd.
40  381 0   Utilities\cmlibarchive\libarchive\cmlibarchive.lib  
cmd.exe /c cd.  C:\PROGRA~1\MICROS~1.0\VC\bin\link.exe /lib /nologo  
@C:\DOCUME~1\peter\LOCALS~1\Temp\nja21.tmp cd.

The Ninja master branch avoids this problem by using a fixed name per
target for response files.  So I guess we will need to wait until we
move to master.

Thanks,
-- 
Peter
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


[cmake-developers] ninja bug on windows

2012-03-09 Thread Bill Hoffman
I am seeing that ninja always wants to relink the executables for me 
every time it is run.  The output is this:


$ ninja
[1/9] Linking C static library 
Utilities\cmlibarchive\libarchive\cmlibarchive.lib

[2/9] Linking CXX executable bin\cmake.exe
[3/9] Linking CXX executable bin\cmw9xcom.exe
[4/9] Linking CXX executable bin\cpack.exe
[5/9] Linking CXX executable bin\ctest.exe
[6/9] Linking CXX executable Tests\CMakeLib\CMakeLibTests.exe
[7/9] Generating ../Docs/ctest.txt
[8/9] Generating ../Docs/cpack.txt
[9/9] Generating ../Docs/cmake.txt

Looks like the problem is libarchive getting recreated each time.

-Bill


--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers