Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

irony-install-server fails on Windows #264

Open alamaison opened 8 years ago

alamaison commented 8 years ago

When I run irony-install-server I get the following error in a buffer that appears. However, if I run the exact same command from the Windows command line, it works fine. Perhaps the way irony is passing the arguments to the shell is incorrect?

-*- mode: compilation; default-directory: "c:/Users/ALEXAN~1/AppData/Local/Temp/build-irony-server-0.2.0-cvs4/" -*-
Compilation started at Wed Dec 23 19:53:21

"cmake" "-DCMAKE_INSTALL_PREFIX=c:/Users/Alexander/.emacs.d/irony/" "c:/Users/Alexander/.emacs.d/elpa/irony-20151217.1058/server" && "cmake" --build . --use-stderr --config Release --target install
'cmake" "-DCMAKE_INSTALL_PREFIX' is not recognized as an internal or external command,
operable program or batch file.
Sarcasm commented 8 years ago

Try editing the command line manually to remove the quotes around cmake

alamaison commented 8 years ago

It works from the command line, with or without the quotes around cmake. It's however irony-mode passes the command to the shell that isn't working

3246251196 commented 8 years ago

Is this not because you have not told Emacs what to do when you invoke Shell?

It sounds like if you open emacs and M-x shell you will be taken to the Windows cmd rather than a bash environment. It also sounds like cmake cannot be found due to a bad PATH ?

alamaison commented 8 years ago

It sounds like if you open emacs and M-x shell you will be taken to the Windows cmd rather than a bash environment

That's true and is the expected behaviour. If I yank the 'erroneous' command into that shell, it runs fine. So the problem is with the way irony-install-server is passing the arguments. Notice that, for some reason the shell thinks it has been passed cmake" "-DCMAKE_INSTALL_PREFIX as the executable name.

3246251196 commented 8 years ago

Okay. I personally steer clear of cmd anyway and use something that gives me that more Unix like environment with mingw or cygwin and it seems to work when you invoke bash from one of these contexts.

If you can install server through cmd is not that all you need ? You now have irony server so you can start using completions? Perhaps irony-install-server sets up some variables that you need; I would have to check. But you can hack those around.

alamaison commented 8 years ago

If you can install server through cmd is not that all you need ?

Absolutely. But presumably someone else will encounter this bug one day and wish someone had reported it so it could be fixed.

Sarcasm commented 8 years ago

Did you really tried to remove the double quotes around cmake like I suggested? This is what I do, I think the shell command is started with a cmd wrapper that comes with emacs and it might have some parsing failure or something else.

I would try to replace :

"cmake" "-DCMAKE_INSTALL_PREFIX=c:/Users/Alexander/.emacs.d/irony/" "c:/Users/Alexander/.emacs.d/elpa/irony-20151217.1058/server" && "cmake" --build . --use-stderr --config Release --target install

By

cmake "-DCMAKE_INSTALL_PREFIX=c:/Users/Alexander/.emacs.d/irony/" "c:/Users/Alexander/.emacs.d/elpa/irony-20151217.1058/server" && "cmake" --build . --use-stderr --config Release --target install
alamaison commented 8 years ago

Did you really tried to remove the double quotes around cmake like I suggested?

Yes. Like I said, it works fine when I run it from the shell with or without the double quotes. I'm not reporting that the command fails in the shell, I'm reporting that it fails somewhere inside irony-install-server.

Sarcasm commented 8 years ago

I mean, when you type irony-install-server, you need to remove the double quotes around cmake.

alamaison commented 8 years ago

Sorry, I misunderstood.

Yes, you're right, removing the quotes round cmake in the command in the minibuffer makes it work.