MantisBT - CMake
View Issue Details
0011460CMakeCMakepublic2010-11-14 08:092011-04-04 12:00
Robert Lenhardt 
Bill Hoffman 
normalminoralways
closedfixed 
CMake 2.8.3 
CMake 2.8.4 
0011460: VS2010 Generator does not add preprocessor defintions to resource compiler
The VS2010 Generator does not add pp defs to Rescources, unlike the previous VS Generators. This breaks projects which parametrize rc files with the preprocessor.
I added a patch which takes the pp defs for the current config and adds them to the rc compiler.
No tags attached.
has duplicate 0011324closed David Cole Compile definitions options not applied to resource files with vc++ 2010 generator 
patch rcpp.patch (691) 2010-11-14 08:09
https://public.kitware.com/Bug/file/3496/rcpp.patch
zip VSResource.zip (987) 2010-11-15 15:49
https://public.kitware.com/Bug/file/3501/VSResource.zip
Issue History
2010-11-14 08:09Robert LenhardtNew Issue
2010-11-14 08:09Robert LenhardtFile Added: rcpp.patch
2010-11-15 08:12David ColeNote Added: 0023255
2010-11-15 15:49Robert LenhardtFile Added: VSResource.zip
2010-11-15 15:51Robert LenhardtNote Added: 0023269
2010-11-15 18:00David ColeAssigned To => David Cole
2010-11-15 18:00David ColeStatusnew => assigned
2010-11-15 18:00David ColeTarget Version => CMake 2.8.4
2010-12-08 15:30Bill HoffmanAssigned ToDavid Cole => Bill Hoffman
2010-12-20 17:31Bill HoffmanNote Added: 0024303
2010-12-21 05:02Robert LenhardtNote Added: 0024306
2010-12-21 05:06Robert LenhardtNote Edited: 0024306bug_revision_view_page.php?bugnote_id=24306#r61
2010-12-21 08:34Bill HoffmanNote Added: 0024308
2010-12-21 09:19David ColeNote Added: 0024309
2010-12-21 09:25Bill HoffmanNote Added: 0024310
2010-12-21 18:16Robert LenhardtNote Added: 0024317
2010-12-21 18:49David ColeNote Added: 0024318
2010-12-21 21:02Bill HoffmanNote Added: 0024319
2010-12-22 15:48Bill HoffmanNote Added: 0024323
2010-12-22 15:48Bill HoffmanStatusassigned => resolved
2010-12-22 15:48Bill HoffmanResolutionopen => fixed
2011-01-17 14:33David ColeRelationship addedhas duplicate 0011324
2011-04-04 12:00David ColeNote Added: 0026076
2011-04-04 12:00David ColeStatusresolved => closed

Notes
(0023255)
David Cole   
2010-11-15 08:12   
Here's another case where a lack of a test is a contributing factor to the bug going unobserved by CMake developers.

If there were a test that added an *.rc file, and the rc file depended on definitions being correct, then the test would fail on Visual Studio 2010 dashboard submissions.
(0023269)
Robert Lenhardt   
2010-11-15 15:51   
I added a test which includes an rc file which #errors if definitions are not passed to rc compiler. You can add

    ADD_TEST(VSResource ${CMAKE_CTEST_COMMAND}
      --build-and-test
      "${CMake_SOURCE_DIR}/Tests/VSResource"
      "${CMake_BINARY_DIR}/Tests/VSResource"
      --build-two-config
      --build-generator ${CMAKE_TEST_GENERATOR}
      --build-project VSResource
      --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
      --test-command VSResource)
    LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSResource")


to Tests/CMakeLists.txt to include it in the Cmake Test Suite.
(0024303)
Bill Hoffman   
2010-12-20 17:31   
OK, so the test passes with VS2010, however, with VS9 it crashes the linker:
65: 2>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
65: 2>Copyright (C) Microsoft Corporation. All rights reserved.
65: 2>Linking...
65: 2>LINK : C:\Users\hoffman\Work\My Builds\CMake-vside\Tests\VSResource\Debug\VSResource.exe not found or not built by the last incremental link; performing full link
65: 2>Embedding manifest...
65: 2>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
65: 2>Copyright (C) Microsoft Corporation. All rights reserved.
65: 2>LINK : fatal error LNK1000: Internal error during IncrBuildImage
65: 2> Version 9.00.21022.08
65: 2> ExceptionCode = C0000005
65: 2> ExceptionFlags = 00000000
65: 2> ExceptionAddress = 0041FCF7 (003A0000) "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\link.exe"
65: 2> NumberParameters = 00000002
65: 2> ExceptionInformation[ 0] = 00000000
65: 2> ExceptionInformation[ 1] = 00FFD670
65: 2>CONTEXT:
65: 2> Eax = 4003779C Esp = 005FEBFC
65: 2> Ebx = 40008178 Ebp = 005FEC24
65: 2> Ecx = 00FFD670 Esi = 40037624
65: 2> Edx = 005FEC14 Edi = 003AD6C0
65: 2> Eip = 0041FCF7 EFlags = 00010246
65: 2> SegCs = 00000023 SegDs = 0000002B
65: 2> SegSs = 0000002B SegEs = 0000002B
65: 2> SegFs = 00000053 SegGs = 0000002B
65: 2> Dr0 = 00000000 Dr3 = 00000000
65: 2> Dr1 = 00000000 Dr6 = 00000000
65: 2> Dr2 = 00000000 Dr7 = 00000000
65: 2>Build log was saved at "file://c:\Users\hoffman\Work\My [^] Builds\CMake-vside\Tests\VSResource\VSResource.dir\Debug\BuildLog.htm"
65: 2>VSResource - 1 error(s), 0 warning(s)
65: ========== Build: 1 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
1/1 Test 0000065: VSResource .......................***Failed 2.84 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 2.90 sec

The following tests FAILED:
         65 - VSResource (Failed)
Errors while running CTest
(0024306)
Robert Lenhardt   
2010-12-21 05:02   
(edited on: 2010-12-21 05:06)
This is a known (and very annoying) bug in the VS2008 linker with an existing hotix, see http://code.msdn.microsoft.com/KB948127 [^] . You can also try to link again after the crash -- the linker should switch to nonincremental linking.

I think the crash has nothing to do with resources or with cmake -- it did show up on a VS2008 installation in a virtual machine in my case, another installation did not show the linker bug.

(0024308)
Bill Hoffman   
2010-12-21 08:34   
Yes, but I can not go installing the hot fix on all the machines that run cmake dashboards, and anyone that happens to build and run make test. Is there some code way around this problem? It seems hard to believe that any project with a resource will causes the linker to crash if incremental linking is on...
(0024309)
David Cole   
2010-12-21 09:19   
So if this is a VS9 only crash, then we simply don't run this test on VS9 dashboards. We have plenty of coverage on other versions of VS already. If that's the only thing holding this up, just make the test conditional.
(0024310)
Bill Hoffman   
2010-12-21 09:25   
It is a good test, and I don't want it to be specific to one vs version. If we had this test from the start this bug would not exist because it would have been implemented the first time. I would really like to add the test with the fix and have it work over all generators.
(0024317)
Robert Lenhardt   
2010-12-21 18:16   
I just googled around for VS2008 error LNK1000, it does seem to happen

- only on Win 7 64bit versions
- only when rebuilding solutions

It has nothing to do with resources or cmake.

For details see http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/801ba6d7-a284-4b5d-a75b-3652138d6dff [^] .

So i think disabling incremental linking for VS2008 on Win7 64bit should be ok for the test.
(0024318)
David Cole   
2010-12-21 18:49   
Simply unconditionally disabling incremental linking for this one test sounds like the best way forward.

As a test, it will always be a clean build anyhow, so incremental linking is somewhat pointless.
(0024319)
Bill Hoffman   
2010-12-21 21:02   
Sure, I can try that. However, something smells bad about this... I just have a hard time believing that VS 9 is that broken. I have built lots and lots of code with resources and without, and have never seen this.... It is not even re-linking... This is a crash on the first link.
(0024323)
Bill Hoffman   
2010-12-22 15:48   
OK, I disabled incremental linking for this test and pushed the branch to next. Thanks for the patch and test!
(0026076)
David Cole   
2011-04-04 12:00   
Closing resolved issues that have not been updated in more than 3 months.