Question

I am running mintty on cygwin in Windows 7. I have mintty.exe set to always "Run as administrator". I am trying to run cmake from within mintty to build a Visual Studio 11 solution.

However, when cmake tries to do a test compile it fails, because CL.exe does not have enough privileges to run. I have set cmake.exe, devenv.exe, and all CL.exe I could find on my disk to always "Run as administrator", but it didn't help.

When I run the same cmake command from a Windows command line launched with administrator privileges it succeeds. This tells me that cmake and CL executables are set up correctly, but somehow calling them from mintty / cygwin launches them without the administrator rights.

Any ideas on how I can set up cygwin to launch all external executables using the "Run as administrator" setting?

EDIT: Some more information about the combinations I tried and their results.

Running cmake (non-admin) in cmd (non-admin) produces Could not COPY_FILE errors described here. The proposed solution is to run devenv.exe and cmake.exe as admin.

Running cmake (non-admin) in cmd (admin) works. I get the admin prompt when the command line is opened, no prompt to run cmake.

Running cmake (admin) in cmd (non-admin) works. A new command window pops up and I get the admin prompt to run cmake.

Running cmake (admin) in cmd (admin) works. I get the admin prompt when the command line is opened, no prompt to run cmake.

Running cmake (non-admin) in mintty (non-admin) produces the same result as non-admin cmake in non-admin cmd.

Running cmake (non-admin) in mintty (admin) produces a different error (described here) which basically boils down to cl.exe not running as administrator. I get the admin prompt when starting mintty.

Running cmake (admin) in mintty (non-admin) results in Permission denied for the cmake executable.

Running cmake (admin) in mintty (admin) produces the same result as non-admin cmake and admin mintty.

Was it helpful?

Solution

(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

OK, I managed to "solve" it. The problem was I was always running Visual Studio 11 as administrator. (I did that so I could attach the debugger to a running process with admin privileges, which I need for work.) When VS11 was always run as admin, it required cmake to be run as admin, which in turn required cmd or mintty to be run as admin.

Now why this worked with cmd and not mintty, i.e. why the admin escalation didn't get all the way through to cl.exe I don't know.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top