Can I build and debug c++ programs on remote machine? - c++

I am on windows XP want to build the programs on linux remote pc
i have eclipse Ganymede, CDT, RSE installed on remote machine... but how to configure all this?
am I doing correct? could anybody suggest

You could access your remote machine using VNC or similar remote desktop infrastructures. That would allow you to work with Eclipse (edit, build, run, debug, etc) as you would in your local machine.
If bandwidth is too narrow or you don't manage the Linux box, you could access via SSH or telnet and work in console mode (with Emacs/Vim, gdb and all that stuff).

Take a look at https://github.com/ericwoodruff/rmake you would configure your IDE and edit code locally but it uses rsync to build on the remote machine. I've used it at HP to build C++ programs across multiple platforms, linux->windows, windows->linux. It works in the command line and I've used an eclipse builder to invoke it as well. If you enable --no-decorate Eclipse can even parse the build output into the problems view.

Related

How to write native C++ in VS 2022, using Linux for build and test

I need a native C++ app to make from scratch. It has to run on linux (CentOS). I want to use VS2022 to write and test. I have Hyper-V VM with CentOS.
I tried to google a solution but there are only posts for using WSL.
Can someone please describe steps to connect VS to Linux VM instead of WSL so I can build and run the app on the VM.
This article describes the process: https://devblogs.microsoft.com/cppblog/linux-development-with-c-in-visual-studio/
add workload to the VS using VS Installer (Linux and embedded..)
create project of correct type
add SSH credentials in the project Properties (also can be added/removed/edited in Tools-Options-Cross Platform)

CLion: "Remote GDB Server" targeting Windows

Is it possible to run a remote debug session targeting Windows with CLion?
The docs say that I can do any system that has gdbserver:
Remote OS: any supporting gdbserver and SSH
However, when I try to run my remote app, I get an error:
10:53 PM Build finished in 3 sec, 44 ms
10:53 PM Error running 'remote'
1: 'env' is not recognized as an internal or external command,
operable program or batch file.
I can't find a place where I could see the whole command that CLion runs that causes this error.
Here is my configuration:
After some investigation, I have come to the conclusion that it is impossible to remote debug a Windows app with CLion 2021.3.1 (regardless of Host platform).
CLion does not support remote debugging when targeting Windows OS using GDB Server (hence targeting Windows is impossible) due to:
CLion does not handle cases when SSH Server is using a non-Unix shell like CMD.exe or PowerShell. Commands like exec, env, chmod can’t be handled. This can be circumvented by using a Unix shell:
a. Unfortunately, connection fails for MSYS2 Bash and Git Bash when Windows OpenSSH Server is configured to use one as a default shell.
b. Windows WSL SSH Server works. Connection is established, Unix commands are recognized. WSL must be installed. It is not easy to configure WSL when Windows itself is running on virtual machine.
c. MinGW64 SSH Server. Didn’t test it.
Uploading binaries via SFTP fails when OpenSSH Service is used. Can be circumvented with 1.b..
CLion doesn’t consider the binary’s file extension. It always assumes that the binary is built for Linux, hence the attempt to transfer fails, when a binary has an .exe extension (fails to find test, though test.exe was built). This is a major bug that prevents remote debugging targeting Windows. There are, however, ways to work around:
a. Manual renaming before running debug. Unacceptable.
b. Adding a conditional custom CMake command. May work but pollutes the CMakeLists.txt
CLion can’t connect to MinGW GDB Server it has started. Connection times out. However, if the Server was started from a terminal, CLion connects successfully and is able to run debug as intended. This can ONLY be worked around MANUALLY:
a. In Edit Configurations… one must put a stub command in GDB Server:, for example ‘sleep’. In GDB Server args: ‘5’. This will give a time to manually run the gdbserver.exe command via an SSH connection in Terminal.
These issues were reproduced for CLion versions for Windows 10 and Ubuntu 20.04.
3. and 4. are very serious and prevent from remote debugging targeting Windows as it was intended to be done.
This happens when CLion connects to the Server it has started:
This is a work around:
As can be seen from the screenshots, with this approach GDB’s console does not catch the output. You must switch to Terminal to see it.

How can I comfortably design a Linux based terminal application from my Windows laptop?

I have a Centos 6.4 (minimal) system configured like a “NAS drive.”
I would like to design a Linux based terminal application on my Window laptop, then build/run it from my “NAS Drive.” It is annoying to keep switching to Putty, running the build script then testing the program itself!
The source code is stored/edited over a Samba share so everything’s already in the right place.
Is there a c++ editor for Windows that can build/run the application with the touch of a button (F9)? Or a batch script or something for Windows that automates a series of SSH commands?
If I was in your shoes, I'd use eclipse with cdt and cygwin.

How Remote Development of C++ works in Netbeans?

Hi we want to use remote development features of netbeans but while trying out on our setup its very slow. I want to understand its feasibility of integrating our build environment with netbeans.
Our setup would be normally:
1. Windows 7 Professional 64bit where we install netbeans
2. RHEL 5.5 64bit linux where we have tools and sources
Normally we directly connect to that machine through PuTTY and use VIM to edit sources and gmake to compile and build projects. Now when I created the "New Remote Project with existing sources" and try to use it It took more time to load the project.
So Can anybody tell me how actually this remote compilation works??
Because we have some GBs of sources here on linux box and I want to know is it possible for smooth development with this big data??
Simple steps. Read this tutorial. You just need a SSH-server on your Linux.
The process is easy, your Netbeans connects to the SSH-server and searches for compilation tools then uses them to build your projects.
The second issue is creating a shared folder that your Windows and Linux able to access to it. I suggest you first create a shared folder on your Windows and use Samba client on your Linux.

Problems running remote C++ program in Netbeans

Here is the scenario.
I have a C++ application using CMake that has been setup on Ubuntu server machine. I have setup a remote development interface to it using Netbeans 6.9 on client machine, and I have been able to build it.
The problem is that (as per the setup of CMake script) the executables from the program are going to another directory in the server. When I try to run the program, Netbeans asks me for executables which I can't spot out on client machine (as they are residing on server machine).
Is there a way I can get the executables on local machine OR have a way to give their location to my Netbeans application.
Thanks for your help.