-
Notifications
You must be signed in to change notification settings - Fork 468
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
cmake-tools not generating configuration for intellisense, and compile_commands.json is empty #2048
Comments
Did you compare how you run cmake in your terminal with the command that we run on your behalf? If you check the Output window with the "CMake/Build" logging channel selected, do you see something like:
or:
|
Here is the command that cmake-tools ran:
And here is the command I run manually:
Also, here is my settings.json:
The cmake-tools command is adding some additional flags, but I don't think those are relevant to the compile commands getting generated. |
Could it be an issue with the working directory? If you run your command with ${workspaceFolder} as the cwd, do you get the same problem? I'm assuming you run your command from the hpvm/build folder, so probably not, but I'd still like to rule it out. Or could it also be an issue with the /snap? We haven't done any work to support snaps yet. There is an issue #838 discussing that, but it appears you already have the workaround. |
One other idea... Can you replace the ":STRING" with ":BOOL" for the ON|OFF settings in our generated command, run that in the terminal and see if it fixes it? |
Are you referring to running the manual cmake in ${workspaceFolder}? As for the snap issue, I did read somewhere that if you use |
Yes, run the command our extension generates in the ${workspaceFolder}. But also try the idea I suggested about the same time you wrote your response (change :STRING -> :BOOL for the ON|OFF settings) |
OK I tried a couple of things. I tried to run my command from the workspace folder instead of from hpvm/build and it worked fine (compile_commands.json was populated). I also tried to run my command with the full cmake path (/snap/cmake/current/bin/cmake) instead of just cmake and it worked fine as well. I then tried to run the command that your tool generates manually (without changing STRING to BOOL) and it still worked fine! But when I reran CMAKE:Configure compile_commands.json was empty again 😕 That's puzzling... I briefly looked at the temp compile_commands.json that gets generated while cmake is running, and that one looked like it was not empty, but for some reason when cmake completed the final file was empty. |
BTW, I thought I read in an old issue that cmake-tools should be able to provide the configuration to cpptools without even needing compile commands. So even then, something is not working. |
Correct, compile_commands.json should not be needed for IntelliSense configuration (I'd still like to figure out what's wrong with the compile_commands.json though). If you are only generating it for configurations, then remove |
OK. I removed the
And yes, I would also like the compile commands to work because I alternate between two setups (depending on which client machine I'm working on, both connect to the ubuntu machine through ssh), vscode and a vim setup that uses youcompleteme, so I need the compile commands to be correct for when I use youcompleteme on my vim setup. |
This log doesn't show a source file being open in the editor. Can you open a .c or .cpp file and then run the command again? |
That's weird, I did have one open. I reran it and the output is different now:
|
Ok, it looks like configurations are not being sent. We'll need to grovel through other logs. Can you set:
and reload? Can you share the CMake/Build log first (you don't need to build, just do the configure step)? If that doesn't turn up anything, then I'll follow up and ask for the C++ log. |
OK I found a few errors on my end and figured out the problem with the compile commands.
|
And for the C/C++ Log
|
I'm sorry, I won't be able to respond for the rest of the day. I will try to look later tonight, but I am starting some time off until Monday, so please be patient with my response time. |
No worries! TYT. I got intellisense partially working with compile_commands.json now so I should be fine for the time being. |
Ok, that's a good start and I'm glad that you're in a better state already. The next step to understanding what's wrong with IntelliSense for the configuration provider is going to be in the |
This is the json file that contains
|
Hmm... I'm stumped. I see the "includes" in there, but they're not showing up in the translation unit configuration from the C++ log. Is this an open source project that I can clone? I see: https://gitlab.engr.illinois.edu/llvm/hpvm-release. Is that it? EDIT: I don't see hpvm-optimizer in there, so maybe not. |
@bobbrow Sorry for not replying sooner, I've been really busy. The project you found is related to this, but the files I'm working with are not open source yet so there isn't one that you can clone. Is there any other way we can try to figure out what's going on? |
I built a VSIX with some additional logging. Please follow the steps below to use it:
|
Not sure what happened. I ran install from vsix and now vscode keeps showing a message saying "Cannot reconnect. Please reload window". I am using ssh-remote. How do I undo the install from vsix, because I cannot do anything on vscode right now with the reconnect message popping up every few minutes. |
You can delete the |
Any idea what might've caused the problem? I removed |
I'm not sure how that could have happened. I just added logging code. Maybe it was too much? Were you able to see it at all before the disconnect? |
Sure. I wasn't able to make the change to write the log to a file yesterday because things got busy at work. I might have some time today to put out another test VSIX. |
I just learned that the standard logger actually writes everything to a file in your temp folder before trying to write it to an output stream regardless of the The updated VSIX is here: https://github.com/microsoft/vscode-cmake-tools/suites/3670491284/artifacts/89276733 |
If you can:
I will take a look and see if it has enough information to see what it going wrong. |
Hi @bobbrow I finally got a chance to try this again with the new VSIX. It is still causing my vscode to crash, but I have been able to get the log.txt as you mentioned. For some reason though, I am unable to attach the file into the comment here. (I get a message in the bottom of the comment window saying "is not included in the list" in red.) Any ideas? |
How did you try to attach it? Did you drag and drop the file in the text box? |
Yes. Could it be that the file is too large? |
Can you try to access the log.txt through this link: https://uillinoisedu-my.sharepoint.com/:t:/g/personal/aejjeh_illinois_edu/ESNxATD-j8dMh6OOm6clFqABFU9xYdzBot-BU5Use019uA?e=4UyuGe ? |
I can access that, but none of the logging I added is showing up and it looks like you had a successful build. Is the correct version of the extension installed? This is the one: I think it should be version 1.8.1-eee1c7e. You might need to disable the auto-update setting for VS Code ( |
I confirmed the extension under |
Sorry, the logging still isn't showing up there so I suspect it is crashing before we get the code model. I'll try instrumenting a few other locations. |
Actually, if you could zip up all the json files in the |
Here you go: cmake.tar.gz |
Sigh. Another dead end. When I load a fake folder with those json files and create a file with the same path as yours, the extension reads the json files just fine and sends the configuration for the file as expected: The only thing I hit along the way was permission issues creating a folder like that at the root. Is it possible CMake Tools doesn't have access to the json files (or any other of the affected files here?) |
That shouldn't be the case. I want to test it out on a local linux machine rather than using remote SSH. I will set up the repository and vscode on my Ubuntu machine and see what happens. How can I determine if/when cpp tools is actually getting the configuration from CMake Tools and not from the compile_commands.json? |
If you run the |
I have a new VSIX with a new logging command that will hopefully help us. It can be found here: https://github.com/microsoft/vscode-cmake-tools/suites/3885617265/artifacts/96792132 If you install this, a new command |
OK so I was able to set up the repo locally and test it out on a local vscode instead of using the remote ssh. First, here is the output of
Next, I installed the new VSIX there and ran
|
Thanks for sharing the log. cpptools asked for a configuration for |
Oh, this happened to be the file I am working with right now. Here is the output of grepping for the file name in the directory:
|
Not sure if this may be a cause of the issues, but the source tree I'm using uses symbolic links. The project I'm working on is a sub-project of LLVM so our project's installer clones the LLVM repository then symlinks all our files into the llvm source tree. What cmake is seeing is the symlinks in the LLVM source tree, what I actively edit/open in vscode is the files in the main repo (which are the source of the symlink). |
@bobbrow any update on this issue? Also, I just started getting a weird error which might be related to some of the changes we did:
Can I tell cmake-tools to ignore specific folders to avoid it trying to create build information for unnecessary files like in this case? |
Holy cow, how do you get a target name that long? 👀 Can you open a new issue for that? We should be able to swallow the exception. I'm still kind of stuck without a repro for this issue, so I don't have any more updates right now. I'm thinking about a modification to the Log Diagnostics command that might help determine whether the problem is symlink related though. I just haven't had time to implement it yet. |
@adelejjeh, we released CMake Tools 1.9.1 today with several bug fixes that may address your scenario as well. Upgrade this extension in VSCode and let us know if this is not completely fixed and also if you encounter any other issues. |
And if it doesn't work, there's a new feature in the |
This issue has been closed automatically because it needs more information and has not had recent activity. |
Brief Issue Summary
CMake Tools not generating configuration for cpp intellisense, and the
compile_commands.json
file it generates is empty. I know this is an issue with the extension because I am able to generate acompile_commands.json
file when runcmake
manually in the terminal.Expected:
When I configure my project with cmake, cpptools should be able to receive the configuration and use it for intellisense. I have the following line in my
c_cpp_properties.json
:Also, the generated compile_commands.json should not be empty.
Apparent Behavior:
cpptools is unable to get the configuration from cmake-tools, so it tries to parse the
compile_commands.json
but issues an error saying unable to parse it. When I checked the contents of the compile commands, the file was empty. I am currently manually runningcmake
after I build in vscode to recreate thecompile_commands.json
for intellisense to work.CMake Tools Log
N.A.
Developer Tools Log
Platform and Versions
Other Notes/Information
The text was updated successfully, but these errors were encountered: