Remote c++ development suggestions.
from sacredfire@programming.dev to programming@programming.dev on 13 Mar 11:40
https://programming.dev/post/26856106

I just started a new job where I have to ssh into a remote linux vm to work on a qt driven c++ project. I don’t really have a lot of leeway on what can be added to the remote environment, and I don’t think local development is possible. The vm has vim and qtcreator.

I’m from a Java background and I’m learning c++ for this role, while I’m comfortable in vim, I’d really like to have a tool that can give me autocomplete, jump to definition and linting. I know these things can be set up in neovim, but I asked about having that put on the box and was not given a good reaction.

I also know tools like vscode and possibly clion can be set up to do remote work via ssh. Does anyone have experience with this and suggestion on a good setup?

#programming

threaded - newest

drew_belloc@programming.dev on 13 Mar 12:09 next collapse

About a year or 2 ago i used doom emacs to ssh into my home server, it’s almost the same as opening a file in my own computer so the experience is really seamless

rollmagma@lemmy.world on 13 Mar 12:47 collapse

That doesn’t really solve his issue because what he wants depends on having servers (lint, lsp) running local to the codebase/machine. Anything with emacs will be a major pain unless it’s a really small project.

drew_belloc@programming.dev on 13 Mar 13:49 next collapse

Yeah you have a point

brian@programming.dev on 15 Mar 12:50 collapse

not sure what you’re talking about but there’s two things here.

TRAMP is great and you can run the lsp on the remote machine without installing anything assuming the linters and lsp are already installed. for comparison, vscode remote downloads and runs a shim thing when you connect.

I use doom emacs at work for large codebases all the time and haven’t run into any problems. why does it only work for really small projects?

rollmagma@lemmy.world on 15 Mar 15:52 next collapse

Well, OP mentions he cannot install software on the machine, so I think that already blocks anything depending on lsp.

My experience is mostly from doing linux kernel programming on remote baremetal machines. I use ccls + eglot locally and have fiddled a lot with tramp, which is really good when it does work, but also tends to trip over bad connections.

I’ve also wrote all sorts of elisp hacks to be able to access the remote machine via tramp but have all code navigation commands apply to a local repository replica where the lsp server runs. My use case was similar to OP but the machines were not x86_64, so there wasn’t even any lsp ported.

So yeah, my gut feeling having dealt with similar issues is that it’s not worth it, YMMV.

rollmagma@lemmy.world on 15 Mar 15:53 collapse

Oh and lsp-mode is super opinionated, it does a million things you don’t want or need, so I wouldn’t recommend that.

Lemmist@lemm.ee on 13 Mar 12:09 next collapse

I don’t understand your problem. You have qtcreator. It is a nice IDE that can do anything C++ related. Why don’t you use it?

sacredfire@programming.dev on 13 Mar 13:12 collapse

I’ve been using it via vnc, and was having a hard time with it. Perhaps I need to configure it correctly. Out of the box, jump to definition wasn’t working great and there doesn’t seem to be linting set up. Probably this is just me not knowing anything about c++ development and needing to do more research.

Lemmist@lemm.ee on 13 Mar 13:21 collapse

Well, new IDE. Of course it won’t work exactly as you wish right from the start. But it is an IDE and can do anything IDE should.

heavydust@sh.itjust.works on 13 Mar 12:09 next collapse

I’m interested to know why it’s done like that. It seems awful. Do you have some SCM like git? Do you have restrictions like working for the army? So many questions.

I’m asking because I’ve seen that a lot in the past and it was always due to bad practices that no one wanted or could change.

bluGill@fedia.io on 13 Mar 14:32 collapse

We have a similar setup where I work (enough different to think they don't work with me, but who knows). It was done like that in our case because we ship embedded linux. Because we are building on linux and targeting linux we kept running into problems with people linking local system libraries that were not compatible with the target even though they had the same name. We eventfully wrote out own package management tool which locked things down so you can't make that mistake - the same month we hit 1.0 conan did their first public release, if canan has been 2 years sooner we would have just contributed to that instead and saved a ton of effort, but now we have too many sunk costs in our current tools and so it isn't worth changing to a new one.

otter@lemmy.ca on 13 Mar 12:36 next collapse

Depending on what restrictions you have, you could try VSCode? That’s what students were told to do at my university for remote C / C++ development off the school’s servers

code.visualstudio.com/docs/remote/ssh

I’m not familiar with the others, but for vscode

  • click the symbol that looks like >< in the bottom left
  • potentially install the remote SSH add-on if it asks for it
  • log in
  • open the left sidebar and tell it to open the folder you are developing in
sacredfire@programming.dev on 13 Mar 13:00 collapse

I think some people here are using vscode, I’ve not been a huge fan of it in the past but I should probably look into their workflow.

sfxrlz@lemmy.dbzer0.com on 13 Mar 14:23 collapse

You can add a vscode-vim plugin and use it mostly like vim.

Skydancer@pawb.social on 13 Mar 12:37 next collapse

Vim has its own plugin system that can provide all of the things on your list. Most people used to use a plugin manager like vim-plug or pathogen, but plugins can also be installed manually.

With vim 8 there is built in plugin management. Just open the editor and type

:help packages

Plugins (including the plugin managers which are plugins themselves) get installed in your user’s home directory, so you can install them yourself without affecting other users or involving the sysadmins who are giving you pushback on installing other applications system-wide.

sacredfire@programming.dev on 13 Mar 13:16 collapse

Interesting, I’ll probably still have to ask for permission to pull anything from the outside onto the vm, but hopefully will get less push back if it’s for a tool already installed and in use.

rollmagma@lemmy.world on 13 Mar 12:48 next collapse

cscope? ccls? clangd? Surely there’s something there that the other people in the team are using.

onlinepersona@programming.dev on 13 Mar 15:03 next collapse

A few questions:

  • why do you have to SSH into a remote box?
  • do you know how the VM was created? can you recreate the dependencies?
  • which OS are you on?
  • you mention qtcreator - do you have remote desktop session?

I ask these questions because my preliminary solutions without knowing all the details would be

  • recreate the VM locally, install the tools you need
  • mount the project on your machine with sshfs, use the tools you require locally
  • use the VM as a proxy if you’re using it to access an internal git to clone the repo to your local machine and use local tools there
  • create a remote desktop session and forward it locally either via ssh x11 forwarding or connect to it via some RDP client like remmina, krdc, or whatever your OS uses

qtcreator has code completion btw, so you can use it for your development tasks.

Anti Commercial-AI license

sacredfire@programming.dev on 14 Mar 11:05 collapse

The application is very resource heavy and is also designed for specific hardware, it can’t be run on the windows laptops we are provided. There are security concerns as well, which limit what I am allowed to do.

Currently I’m using vnc viewer to open a shell where I can run applications like qtcreator and get a gui interface. I’m sure I could run a local ide and ssh into the vm with it, but I know that can be tricky getting proper code coverage for jump to references to work. I guess I’ll try it and see what happens!

onlinepersona@programming.dev on 14 Mar 11:49 collapse

Sshfs should work with a local IDE like CLion from Jetbrains (although that’s pay to use, it’s the best C++ IDE I know of).

Out of curiosity, what’s wrong with qtcreator in VNC viewer? Qtcreator should provide code completion, going to definitions, expanding macros, and so on.

Anti Commercial-AI license

sacredfire@programming.dev on 14 Mar 14:25 collapse

Ok that is good to know. As for qtcreator, it’s probably fine, just the first time I’ve used it and it didn’t have any of those features working correctly. And I already am familiar with jetbrains tools from Java development. I’ll just have to get it set up correctly. I know for sure I’ll be using it for its UI editing features.

Tempy@programming.dev on 16 Mar 11:40 collapse

If you are on Linux locally, you could try using sshfs, to “mount” the remote system to your local one and use your local dev tools. Though I suspect that would be against the spirit of what company is hoping for.