Nicolas Vasilache via llvm-dev
2021-Dec-01 14:40 UTC
[llvm-dev] Properly configuring vscode for LLVM development
Hi everyone, I am trying to use vscode for cmake development and so far I have been only moderately successful. I think I have most of the things right (including clangd and autocomplete) but I still have a few issues: 1. I am not able to configure vscode + cmake such that the project only rebuilds incrementally. As a consequence a tiny change retriggers compilation of the whole thing. Since I configured ccache I get close to 100% hits but this still takes ~1-2 minutes instead of a few seconds by using cmake -Ninja on the command line. (I think) I have been careful to not trigger spurious stuff (e.g.) "cmake.generator": "Ninja", "cmake.clearOutputBeforeBuild": false, "cmake.configureOnEdit": false, "cmake.exportCompileCommandsFile": false, "cmake.autoSelectActiveFolder": false, "cmake.useCMakePresets": "never", but to no avail .. The other 2 may be related to my not investing the time to dig further until I have a proper solution to point 1. 2. I am not sure how to set the tests for easily pinpointing particular errors, running a single test through the IDE and fixing it inline. Maybe we are spoiled but our internal Google setup makes it very easy to do such things. 3. I am not sure how to set up the integrated debugger to have a clicky debugging nice setup. I have some old recollections circa VC++ 6.0 ish where these things were quite nice to navigate and I am hoping to Some additional details that may be of relevanceL A. I am on a Linux boc (and running through a remote connection from my mac laptop). B. I am using a third-party project and I am making use of some MLIR side features to build stuff together with LLVM. In particular: "cmake.sourceDirectory": "${workspaceFolder}/../llvm-project/llvm", Note that this is not a problem in my CLI-only setup where things behave like I expect them Does anyone know of a good setup I could replicate? If you're replying to this, please +1 me in the conversation because email is hard. Thanks much! -- N -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211201/74bcd69e/attachment.html>
Stella Laurenzo via llvm-dev
2021-Dec-01 14:51 UTC
[llvm-dev] Properly configuring vscode for LLVM development
On Wed, Dec 1, 2021, 6:41 AM Nicolas Vasilache via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi everyone, > > I am trying to use vscode for cmake development and so far I have been > only moderately successful. > > I think I have most of the things right (including clangd and > autocomplete) but I still have a few issues: > > 1. I am not able to configure vscode + cmake such that the project only > rebuilds incrementally. As a consequence a tiny change retriggers > compilation of the whole thing. Since I configured ccache I get close to > 100% hits but this still takes ~1-2 minutes instead of a few seconds by > using cmake -Ninja on the command line. > (I think) I have been careful to not trigger spurious stuff (e.g.) > > "cmake.generator": "Ninja", > "cmake.clearOutputBeforeBuild": false, > "cmake.configureOnEdit": false, > "cmake.exportCompileCommandsFile": false, > "cmake.autoSelectActiveFolder": false, > "cmake.useCMakePresets": "never", > > but to no avail .. > > The other 2 may be related to my not investing the time to dig further > until I have a proper solution to point 1. >This is a big between cmake/ninja/debian distros/vscode that is quite unfortunate. I root caused it a year ago here, and the quick fix for vscode config is noted just after my response: https://gitlab.kitware.com/cmake/cmake/-/issues/17330 (Ftr - I don't use vscode cmake integration. I'm too addicted to having command line control)> 2. I am not sure how to set the tests for easily pinpointing particular > errors, running a single test through the IDE and fixing it inline. Maybe > we are spoiled but our internal Google setup makes it very easy to do such > things. >I think this is screaming for an extension for lit that to my knowledge does not exist. Probably not the right person to comment on that because... CLI bias again.> 3. I am not sure how to set up the integrated debugger to have a clicky > debugging nice setup. I have some old recollections circa VC++ 6.0 ish > where these things were quite nice to navigate and I am hoping to >My life improved substantially when I switched to one of the lldb plugins from the default provided gdb plugin. Especially for llvm, gdb is just too slow to launch. I don't love hand coding launch configs in json but it is serviceable, and that is the one manual step (basically just the path to binary and args), and it should be clicky from there. I believe there are various things floating around to make llvm types a bit nicer in the debugger but I just squint :/> Some additional details that may be of relevanceL > A. I am on a Linux boc (and running through a remote connection from my > mac laptop). > B. I am using a third-party project and I am making use of some MLIR side > features to build stuff > together with LLVM. In particular: > "cmake.sourceDirectory": "${workspaceFolder}/../llvm-project/llvm", > Note that this is not a problem in my CLI-only setup where things behave > like I expect them > > Does anyone know of a good setup I could replicate? > > If you're replying to this, please +1 me in the conversation because email > is hard. > > Thanks much! > > -- > N > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211201/a93ce9d8/attachment.html>
Kai Plociennik via llvm-dev
2021-Dec-06 08:13 UTC
[llvm-dev] Properly configuring vscode for LLVM development
Hello Nicolas, thanks for your email, I also use VS Code on Linux (Ubuntu) for LLVM development and had trouble when setting up everything correctly. In the end, I did not use the CMake tools extension but wrote a bash script for configuring LLVM (calling cmake with the necessary options) and one for building and installing. Then I defined a run task in VS Code which calls the latter. Since GDB startup is really slow, I added "gdb-add-index" for libLLVM and libclang, since then startup time is acceptable. I also did some changes to my c_cpp_properties.json and further changes to tasks.json and launch.json to get decent debugger experience, e.g. skipping standard library files and have nice compiler error reporting with clickable links in the VS code console. When I read in the previous comments to your post about pretty printer setup, I remembered that I also had a hard time to get that work. The solution for me was to add source ${env:SPU_LLVM_INSTALL_DIR}/../llvm/utils/gdb-scripts/prettyprinters.py as setup command to my run configuration. Maybe using LLDB would have been better, but I have to admit that compared to my previous development experience with Visual Studio and C# I had so much things to configure and do so much research to get things working that I finally was glad after weeks to get everything running and did not want to experiment any further. Hence, I think maybe it would be a good idea to help developes have a quick start by providing condensed, ready to use information and scripts on the LLVM official website? I think this might help developers. If you want, I can send you my configuration files if this helps. Best regards, Kai On 01.12.21 15:40, Nicolas Vasilache via llvm-dev wrote:> Hi everyone, > > I am trying to use vscode for cmake development and so far I have been > only moderately successful. > > I think I have most of the things right (including clangd and > autocomplete) but I still have a few issues: > > 1. I am not able to configure vscode + cmake such that the project only > rebuilds incrementally. As a consequence a tiny change retriggers > compilation of the whole thing. Since I configured ccache I get close to > 100% hits but this still takes ~1-2 minutes instead of a few seconds by > using cmake -Ninja on the command line. > (I think) I have been careful to not trigger spurious stuff (e.g.) > > "cmake.generator": "Ninja", > "cmake.clearOutputBeforeBuild": false, > "cmake.configureOnEdit": false, > "cmake.exportCompileCommandsFile": false, > "cmake.autoSelectActiveFolder": false, > "cmake.useCMakePresets": "never", > > but to no avail .. > > The other 2 may be related to my not investing the time to dig further > until I have a proper solution to point 1. > > 2. I am not sure how to set the tests for easily pinpointing particular > errors, running a single test through the IDE and fixing it inline. > Maybe we are spoiled but our internal Google setup makes it very easy to > do such things. > > 3. I am not sure how to set up the integrated debugger to have a clicky > debugging nice setup. I have some old recollections circa VC++ 6.0 ish > where these things were quite nice to navigate and I am hoping to > > Some additional details that may be of relevanceL > A. I am on a Linux boc (and running through a remote connection from my > mac laptop). > B. I am using a third-party project and I am making use of some MLIR > side features to build stuff > together with LLVM. In particular: > "cmake.sourceDirectory": "${workspaceFolder}/../llvm-project/llvm", > Note that this is not a problem in my CLI-only setup where things behave > like I expect them > > Does anyone know of a good setup I could replicate? > > If you're replying to this, please +1 me in the conversation because > email is hard. > > Thanks much! > > -- > N > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Dr. Kai Plociennik Fraunhofer-Institut für Techno- und Wirtschaftsmathematik ITWM Competence Center High Performance Computing Fraunhofer-Platz 1 67663 Kaiserslautern Tel: +49 (0)631 31600 4081 mail: kai.plociennik at itwm.fraunhofer.de www.itwm.fraunhofer.de