-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad CMake executable "C:\Program Files\CMake\bin\cmake.exe". #685
Comments
Hey, it looks like a broken cmake path, or wrong cmake executable or missing Flfiles to start cmake. What happens if you call What does the |
It does look that way, doesn't it? cmake -version from the vscode terminal works fine.
I have also tried resetting this settings to the default, which is just "cmake". That doesn't work either. I have done all this for user settings and workspace settings. No luck. Bear in mind, this was working fine for months, and just started failing with this error one day. I don't recall changing any settings right before it happened. |
Sorry, I can not reconstruct your problem. There are no debug information to detect the return code or output of |
Thanks. I'm going to try this soon -- hopefully next week. |
I have also faced on same problem. My environment is below. Ubuntu 18.04 TLS And, my error log in vscode is below.
|
I installed cmake again like below.
After that, it seems that vscode recognize cmake and cmake-tools also recognize cmake. |
It seems that my problem depends on vscode. |
@nackdai your environment says you put cmake in |
Sorry, I miss-typed in my first comment.
In that case, it seems that cmake is detected automatically. What difference are there between 1. and 2.? |
The extension uses |
In above case, cmake tools ran after I set cmake path directly like below. [Settings]->[Extensions]->[CMake Tools Configuration]->[CMake:Cmake Path] |
I finally got around to playing with this today. I started with a fresh install of windows 10 (I was required to upgrade), cmake, VS code, the plugin -- everything. I still got this error. I wondered if the plugin might not like a cmake path with spaces in it, since my path did. I tried uninstalling / reinstalling cmake in c:\cmake, and the problem went away. |
The extension does work with a version of CMake that has spaces in the path, so I think there's some other variable causing the problem. Can you share your settings? |
Sure. It's a fresh VS.code install. I haven't set very much. The difference between working and not was where cmake was installed.
|
What do you get when you run |
(For context, I'm trying to emulate the code path that you're going through. Something seems to have failed around this point where we are detecting your CMake version. Note that this code has changed a little bit in version 1.2.0 which is being released this week, but I am testing on 1.1.3 to try to figure out your issue.) |
That matches the version on the cmake install packages that I used for both "c:\program files\cmake" and "c:\cmake". I did just notice that I used their .msi for the program files one, and the zip file for the c:\cmake one, which works. There could be a difference there, but it seems unlikely. |
If you're using a custom cmake path, I didn't see it in the settings you've shared. How are you specifying |
You're right. I'm not currently setting Now that it is working, I see it log the following in the output: On the settings page, I can leave it with the default Cmake Path, "cmake", and it works. I can also enter "c:\cmake\cmake-3.16.0-rc2-win64-x64\bin\cmake.exe", which appears in the json as However, I'm pretty sure I tried all of this before when cmake was in "c:\program files\cmake", and I could not get it to work. I do have cmake.exe in my path, and at one point I had to set 'CMAKE_ROOT`. But I don't think those help the plugin find the binary. Are you not able to reproduce the problem with cmake installed under "c:\program files"? |
Correct, I cannot repro the problem with cmake installed under C:\Program Files. And the extension does not check CMAKE_ROOT when looking for the binary. |
I tried re-installing from the msi to "C:\program files\cmake\bin\cmake.exe". I can type that into the command line with quotes, and the shell finds and runs it fine. The extension does not find it. If I point the extension at my "c:\cmake\cmake-3.16.0-rc2-win64-x64\bin\cmake.exe", it works. If I rename that folder (It's from the zip, not the msi) to "C:\cmake good\cmake-3.16.0-rc2-win64-x64\bin\cmake.exe" the extension finds it. This rules out my theory of spaces being a problem. That leaves the possibility of the .msi being "bogus" somehow. If I install the msi into c:\cmake, the extension finds it. If I copy the .zip contents to "C:\Program Files\cmakeb\cmake-3.16.0-rc2-win64-x64\bin\cmake.exe" and point the extension at it, it finds it. That seems to rule it down to something very special about "C:\Program Files\cmake\bin\cmake.exe". After a fresh install of windows and cmake, I can't imagine what would be special about it. It seems to be something very specific about "C:\Program Files\cmake\bin." I tried moving the zip contents to "C:\Program Files\cmake\cmake-3.16.0-rc2-win64-x64\bin\cmake.exe". It finds it. That's a little different than the "specific" broken path. I take that same zip contents and put them in "C:\Program Files\cmake\bin\cmake.exe", and the extension cannot find it. I rename the "bin" folder "bina", as follows: "C:\Program Files\cmake\bina\cmake.exe". The extension can find it. Every test, I tried running the same path on the command line, and it worked, (just to double check for a typo) This seems to imply that it doesn't matter if it's from the zip or the msi. All that matters is if it is installed to c:\Program Files\cmake\bin. It won't find it there. Anywhere else, and it will find it. This is pretty absurd. This is a fresh install of Windows 10. Before, I was seeing this (although I didn't test all these cases) on Windows 7. That is one specific "bug". I don't know what else I can try. That is all I have time for at the moment. At least I have a workaround. |
What does your |
I'm also experiencing this issue on Ubuntu: I installed vscode/cmake from snap packages
But I got this error from the vscode extension:
I checked my path
I checked my cmake
|
@hdf89shfdfs Regarding |
I also encountered this problem when using the Remote Development Extension. It does not work with the path set to be |
If it helps, I have the same problem on KDE Neon (Linux). I uninstalled Cmake tools, reinstalled, no luck,
The error that pops up is: There is no This is on a fresh machine, fresh install of VSCode, no customized settings, just installed the extension and tried to open an existing project. CMakeTools extension version: 1.5.3 VS Code Info:Version: 1.51.1 |
I'm sorry, we haven't been able to reproduce this problem. |
I faced the same problem on windows. I fixed it by : |
Also on windows. Confirmed that cmake.cmakePath is gone and "cmake" is in the extension settings. Still not working. Was there anything else you had to do for this? |
@Eight9inerEcho, do you have the same problem on a small project that you create from scratch, for example with the command "CMake: Quick Start" in the palette? |
I really think this is a problem with VS code having the wrong path for the Cmake executable. How can I find out where the Cmake executable was installed by the toolchain so I can point to in manually? |
About finding the exact cmake executable installed by the toolchain, I don't know how to do that other than searching on your system for all cmake and trying to guess which one. Maybe there is documentation about that particular toolchain or if you run it again may give some path indication. I am still thinking of what else can happen here. |
mark |
Thanks, this solves my problem. |
Glad to hear that you are unblocked @Bill0412. I'll wait to hear from other users on this thread, hopefully they will be able to use the same command and be unblocked. Then I will close his report. |
I'm on a M1 mac and I get the same error. I installed cmake via brew and it is placed under |
@wAuner, I understand that (and I have no idea why yet) the link command didn't work for you but did you also define "cmake.cmakePath"? Just double checking. |
Yes I’ve tried that too (to define it with the full path, although cmake already is in my path), but that didn’t help. Sometimes it finds it, sometimes not. Seems very unstable |
I was also getting the same error in ubuntu 20. I was able to find a consistent way to reproduce the issue.
How to fix:
I don't understand why the update setting screws up cmake. It will be nice if someone can dig into this. |
Brief Issue Summary
I had been using the extension for several months with little issue. One day, it stopped working. I get this error:
Bad CMake executable "C:\Program Files\CMake\bin\cmake.exe". Is it installed or settings contain the correct path (cmake.cmakePath)?
That path is correct, and I can still run cmake from the command line using that absolute path, as well as by the command line finding it in my PATH.
Expected:
Apparent Behavior:
CMake Tools Log
Platform and Versions
Other Notes/Information
I uninstalled cmake, reinstalled the latest version.
I uninstalled VS code, reinstalled the latest version.
I may have had other Cmake extensions installed at some point, but they are all removed now.
I already tried resetting the extension just now. No effect.
The text was updated successfully, but these errors were encountered: