MantisBT - CMake
View Issue Details
0013832CMakeCMakepublic2013-01-03 17:402016-06-10 14:31
Amine Khaldi 
Kitware Robot 
normalmajorhave not tried
closedmoved 
CMake 2.8.10.2 
 
0013832: VS 2010 generator lack the opt-out of setting incremental, UAC flags, default includes, default libs...etc
ReactOS codebase, especially drivers, get link errors because we explicitly set for example the /release flag, and the linker complains about it interfering with the incremental flag, that we never asked for. We can't find a way to completely remove such flags, so that we can have only what we explicitly ask for. This btw also applies to the default includes and libs folders.
No tags attached.
Issue History
2013-01-03 17:40Amine KhaldiNew Issue
2013-01-04 09:13Amine KhaldiNote Added: 0031982
2013-01-06 13:28Amine KhaldiNote Added: 0031989
2013-01-07 12:10Amine KhaldiNote Added: 0031996
2016-06-10 14:28Kitware RobotNote Added: 0042191
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0031982)
Amine Khaldi   
2013-01-04 09:13   
Examples that are spread all over the codebase:
17>LINK : fatal error LNK1295: '/MANIFESTUAC' not compatible with '/DRIVER' specification; link without '/MANIFESTUAC' (we never asked for manifest stuff)

21>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/RELEASE' specification (we didn't ask for incremental)

It would be great if we can somehow set/remove these configuration items.
(0031989)
Amine Khaldi   
2013-01-06 13:28   
For the runtime library flag, apparently since we don't set one at all, CMake doesn't generate the RuntimeLibrary tag, and VS defaults on the MultiThreadedDLL from what I saw, which is not what we asked for. Here's what "fix" it for me: http://pastebin.com/BUY5KtE2 [^] which basically sets an empty tag, thus preventing VS from setting the default (incorrect for us) one.

I don't know where are the default includes/libs, manifest, incremental..etc set.
(0031996)
Amine Khaldi   
2013-01-07 12:10   
Here's what we have so far, to be able to generate a fully working ReactOS build:

1. http://pastebin.com/w3nQvh9c [^]

* As you can see we added the lowercase version of some subsystem flags because we use the same value for both gcc and msvc builds, and having to do string uppercase for every single target (we have more than 900) would be impractical, compared to just recognizing this. The same applies to the Driver flag.

* We commented out SpecifySectionAttributes and MergeSections handling because we have more than one instance of these flags, and the current mapping retains only the *last* flag, so all the previous instances get lost, leading to invalid binaries.

2. http://pastebin.com/hPRzNQud [^]

* We need the default value for the CharacterSet tag to be NotSet, but the code has MultiByte as the default value, which leads to broken build for us.

* We need to have an empty RuntimeLibrary if we didn't set one, otherwise VS would set the DLL one as a default, causing broken build for us. The same applies for RandomizedBaseAddress and DataExecutionPrevention.

* Finally, there is this assumption about setting the /SUBSYSTEM flag, where if the module is marked as WIN32_EXECUTABLE the subsystem flag gets "WINDOWS" otherwise it gets "CONSOLE", and that overrides our subsystem values like Native for example, leading to invalid binaries.

Can you please review these changes in order to get proper solutions for the issues they tackle ? We prefer to continue using vanilla CMake instead of maintaining a set of trivial patches just to be able to use VS. Thank you in advance.

Please also note that the VS 11 generator has more issues than the VS 10 generator, for instance the fact that it's passing the temporary files of the asm compile custom command (the preprocessed temporary files) to the linker, which causes link issues like: E:\testing_2012\reactos\lib\sdk\crt\asm\chkstk_asm_msvcrtex_asm.tmp : fatal error LNK1107: invalid or corrupt file: cannot read at 0x6312 (which means this tmp file is being linked just as if it's an object, while the real objects aren't even passed to the linker command line)
(0042191)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.