MantisBT - CMake
View Issue Details
0008386CMakeCMakepublic2009-01-15 18:022011-06-06 18:25
Ted Berg 
David Cole 
normalminoralways
closedno change required 
CMake-2-6 
CMake 2.8.4 
0008386: duplicate manifest entries on link
Attached test case builds a trivial DLL which includes a manifest file as part of the libraries resource file. Linking fails with the following error:
CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:2, language:0x0409
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
FINAL LINK failed. with 1123

Some way to prevent CMake from automatically adding a manifest would be helpful.

It appears that the manifest tool (mt.exe) allows for multiple manifests. I don't know enough about this tool/process to say, but there may be a more general case for this particular issue.
No tags attached.
related to 0010704closed David Cole don't GenerateManifest flag (/Manifest:NO) doesn't work with VS 2010 
zip testcase.zip (2,051) 2009-01-15 18:02
https://public.kitware.com/Bug/file/1993/testcase.zip
Issue History
2009-01-15 18:02Ted BergNew Issue
2009-01-15 18:02Ted BergFile Added: testcase.zip
2009-01-15 18:41Bill HoffmanStatusnew => assigned
2009-01-15 18:41Bill HoffmanAssigned To => David Cole
2011-02-08 11:46David ColeNote Added: 0025327
2011-02-08 12:17David ColeRelationship addedrelated to 0010704
2011-02-08 12:18David ColeNote Added: 0025330
2011-02-08 12:19David ColeNote Added: 0025331
2011-02-08 12:20David ColeNote Added: 0025332
2011-02-08 12:20David ColeStatusassigned => resolved
2011-02-08 12:20David ColeFixed in Version => CMake 2.8.4
2011-02-08 12:20David ColeResolutionopen => no change required
2011-02-08 12:20David ColeNote Edited: 0025332bug_revision_view_page.php?bugnote_id=25332#r192
2011-06-06 18:25David ColeStatusresolved => closed
2011-06-06 18:25David ColeNote Added: 0026706

Notes
(0025327)
David Cole   
2011-02-08 11:46   
You can avoid the manifest automatically added by the linker by passing "/MANIFEST:NO" with the link flags.

In your CMakeLists.txt file:

  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")

Alternatively, you can use the "mt.exe" tool to merge your own manifest.xml file with the automatically generated one as a post-build step.

I am trying this out with VS 2008 and VS 2010 right now, and it works as I expect it to (avoiding building in a manifest) with VS 2008. But I'm having trouble getting VS 2010 to honor the "/MANIFEST:NO" flag. I'll report back again once I've figured that out...
(0025330)
David Cole   
2011-02-08 12:18   
When the related issue 0010704 is fixed, then you will be able to use the technique in my previous note with the Visual Studio 2010 generator as well.
(0025331)
David Cole   
2011-02-08 12:19   
One final workaround, I'll mention. You can simply re-number the manifest resource in your rc file (use a 3 instead of a 2) and you'll get 2 manifest resources in the final dll. (Also avoids the error you're seeing.)
(0025332)
David Cole   
2011-02-08 12:20   
Resolving this as "no change required" since there are several ways in which you can work-around this problem, including setting the flags properly so that the linker does not automatically generate a manifest resource.

Feel free to re-open if you think there's still a problem here... Or ask for advice on the CMake mailing list. Many more eyes are on the mailing list than on this bug tracker.

(0026706)
David Cole   
2011-06-06 18:25   
Closing resolved issues that have not been updated in more than 3 months.