vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Early exception if Ninja missing

Open KoeMai opened this issue 8 years ago • 8 comments

Brief Issue Summary

I have a Windows PC were visual studio is installiert but no Ninja. If I scan for kits the extension crash because no Ninja Installation is found.

Expected:

I think it would be nice if all configuration parts like "scan for kits" or "reset extension state" are usable without a running Cmake instance.

Developer Tools Log

/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Overwriting 
extension 
C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta2 
with 
C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4.
e._logMessageInConsole @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 
[C:\Users\mm\.vscode\extensions\ms-vscode.cpptools-0.14.5]: 
Command `workbench.action.gotoSymbol` appears multiple times in the 
`commands` section.
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 
[C:\Users\mm\.vscode\extensions\ms-vscode.cpptools-0.14.5]: 
Command `workbench.action.showAllSymbols` appears multiple times in the 
`commands` section.
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.351Z [debug] [main] Safe constructing 
new CMakeTools instance
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [kit] Constructing KitManager
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [variant] Constructing 
VariantManager
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [main] Constructing new 
CMakeTools instance
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [main] Starting CMakeTools 
second-phase init
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [rollbar] Checking Rollbar 
permissions
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.366Z [debug] [rollbar] Rollbar 
enabled? false
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.442Z [info] [variant] Loaded new set of 
variants
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.448Z [debug] [kit] Second phase init 
for KitManager
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.450Z [debug] [kit] Re-read kits file 
from prior session
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.452Z [debug] [kit] Re-reading kits file 
C:\Users\mm\AppData\Roaming\CMakeTools\cmake-kits.json
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.473Z [info] [kit] Loading new set of kits
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.474Z [info] [kit] Successfully loaded 7 
kits
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.475Z [debug] [kit] Active kit set to null
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.476Z [debug] [main] Starting CMake driver
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:07.693Z [debug] [cms-client] Started new 
CMake Server instance with PID 4052
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
rejected promise not handled within 1 second
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:10 
[vector-of-bool.cmake-tools] Accessing CMake driver too early!: Error: 
Accessing CMake driver too early!
at new CMakeTools 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\cmake-tools.js:75:44)
at Function.create 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\cmake-tools.js:280:22)
at activate 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\extension.js:24:42)
at Function.t._callActivateOptional (c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:505872)
at Function.t._callActivate (c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:505617)
at c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:504970
at Object.g [as _notify] (c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:65424)
at Object.enter (c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:68771)
at n.Class.derive._oncancel._run (c:\Program Files\Microsoft VS 
Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:70599)
at n.Class.derive._oncancel._completed (c:\Program Files\Microsoft 
VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:70040)
e.onUnexpectedError @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:10
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
Received message from cmake-server:
{"supportedProtocolVersions":[{"isExperimental":true,"major":1,"minor":1}],"type":"hello"}

/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:08.708Z [debug] [driver] Trying to detect 
generator supported by system
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:08.708Z [error] [cms-client] None of 
preferred generators available on the system.
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
Activating extension `vector-of-bool.cmake-tools` failed: Unable to 
determine CMake Generator to use.
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
Activating extension `vector-of-bool.cmake-tools` failed: Unable to 
determine CMake Generator to use
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
Here is the error stack: Error: Unable to determine CMake Generator to use
at onHello 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\cms-client.js:262:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:109:7)
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Unknown CMake 
generator "Ninja"
e.doShow @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Unknown CMake 
generator "Unix Makefiles"
e.doShow @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Activating 
extension `vector-of-bool.cmake-tools` failed: Unable to determine CMake 
Generator to use.
e._logMessageInConsole @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
[CMakeTools] 2017-12-30T07:05:08.726Z [fatal] [rollbar] Unhandled 
exception: Unhandled Promise rejection: scanForKits Error: Unable to 
determine CMake Generator to use {}
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Unable to 
determine CMake Generator to use
e.doShow @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] 
Error: Unable to determine CMake Generator to use
at onHello 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\cms-client.js:262:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:109:7)
t.log @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:10 Unable to 
determine CMake Generator to use: Error: Unable to determine CMake 
Generator to use
at onHello 
(C:\Users\mm\.vscode\extensions\vector-of-bool.cmake-tools-0.11.0-beta4\out\src\cms-client.js:262:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:109:7)
e.onUnexpectedError @ /C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:10
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 WARNING: Promise 
with no error callback:98
/C:/Program Files/Microsoft VS 
Code/resources/app/out/vs/workbench/workbench.main.js:9 Object

### Platform and Versions


- **Operating System**: Windows
- **CMake Version**: 3.9
- **VSCode Version**: 1.19
- **CMake Tools Extension Version**: 0.11 beta4
- **Compiler/Toolchain**: Visual C++ 2015

KoeMai avatar Dec 30 '17 07:12 KoeMai

I have commits of https://github.com/KoeMai/vscode-cmake-tools/commit/5e37d0420f4dcb2928b7a849baed05d6bb494a78 which fix the ninja problem and to problems of the generator selection of #274.

I would bring them as pull reject when the test commits are mainline.

KoeMai avatar Jan 17 '18 21:01 KoeMai

If Ninja is missing and there is a preferredGenerator on the kit, does it not fall back to try the generator on the kit? That was the original idea of adding the preferredGenerator to the kit: People who want to use Ninja generally use it exclusively, while people without it want to use the VS generator for their selected VS version.

vector-of-bool avatar Jan 24 '18 03:01 vector-of-bool

In my case I had a visual studio only on the PC, I got always the error that ninja is missing and then it used the 'preferedGenerator' from kit. I think that the exclusively use is more compiler dependent. For gcc and clang I think is it like your wrote. I'm not sure if it is the expected behavior for switching between IAR, Visual Studio or Gcc/clang. The feedback looks like that they expect the compiler prefered build system or they do not want to choice.

If you like then I can write some tests to verify the your expected behavior.

May be we get a feedback for the users and their use cases.

KoeMai avatar Jan 24 '18 04:01 KoeMai

If you actually see an error message about missing Ninja and falling back to VS, I think that's a problem, but falling back to the preferredGenerator is still the proper case.

vector-of-bool avatar Jan 24 '18 04:01 vector-of-bool

If I open an empty folder and try to build or scan for kits I get this output: unbenanntemptyfolder

If I open a project with CMake File and selected Kit I get this output: unbenannt

KoeMai avatar Jan 24 '18 06:01 KoeMai

I have already a branch with the bugfix. But before cleanup of this branch and merge I would like to add tests for configure, build to the CI. This will allow me the write a test to trigger the problem.

KoeMai avatar Feb 28 '18 15:02 KoeMai

@KoeMai, would you say this issue is finished?

vector-of-bool avatar Mar 21 '18 04:03 vector-of-bool

Yes, it is finished.

KoeMai avatar Mar 21 '18 20:03 KoeMai