How to debug a linux C++ program from Windows with Eclipse? - c++

I use a headless (i.e. no screen) remote ubuntu server x64 for developping a C++ application (with no UI either).
I want to conveniently (IDE like, not command line) debug this program from windows (7/64), with Eclipse if possible. I have a windows share between the two and full root access on both machines.
So far I have heard of two solutions :
Remote gdb
Remote X server
I have worked on solution 1 : built a cross gdb, copied my program and libs on windows. I'm able to remote-gdb from cygwin command line, but not from eclipse (stuck at "launching... 85%" with no error message nor log)
I have also worked on solution 2 : installed xauth, set X forwarding, installed xming on my windows, set DISPLAY on the linux box. But no effect "can't open DISPLAY xxx" with no easy troubleshoot.
When googling for those problems, I only find outdated pages or different problems.
Did anyone do it ? Can you share advices or fresh pointers on how to remote debug a C++ linux app from Windows ?

I suggest to install an X11 server on your Windows machine (e.g. Xming perhaps?) and to do ssh -X with some X11 client applications (like emacs, ddd if needed, xterm) on your Linux server. Don't use a complex thing like Eclipse. You could just use emacs (remotely on the Linux server, displaying on the Windows desktop X11 server)...
Once emacs works well (running on the remote Linux server, displaying on the Windows desktop X11 server), you can run gdb inside it.
To get ssh -X working, you need to configure it appropriately. Maybe you forgot that step. To test it, just use ssh -X yourlinuxhost xterm, and work on configuration till that step works.
Of course you could also install Linux on your laptop or desktop, perhaps inside a virtual machine above your Windows.
NB. I never used Windows, but I do know that some X11 servers exist for it.

There is a eclipse plugin RSE (Remote System Explorer), it can pretty much do what you are expecting. The code base can be in linux server, eclipses uses telnet / ssh to login. Execution again can happen on a server, native gdb is used to debug.

You can use the following simple plugin for Eclipse.
http://marketplace.eclipse.org/content/direct-remote-c-debugging
It needs just ssh connection to the server and it cares about anything else

Related

Can I remote debug a C++ makefile project from a windows vm using Eclipse?

I am on a Windows VM which has eclipse installed.
I connect to a remote centos machine using putty (yes command line)
I work on a large C++ makefile project there.
I have learnt to use gdb within putty and everything is ok.
Is there any way I can use Eclipse present in my Windows to debug the C++ makefile project present in my remote CentOS machine ?
I have the following installed on my windows VM
Winscp
Putty
Eclipse
I wont be able to install anything else.
I also wont be able to install anything else into my centos machine unless I can justify the reason.
I believe this is NOT an exact duplicate.
I searched high and low for a solution to this, most answers seem to be for a different application or requires some additional installations or maybe the instructions are not clear.
Please provide me a step to step guide as I am new to Eclipse, and 2yrs old into linux.
Basically a windows programmer, I have seen a VS solution to remote debugging, but I wont be able to install VS into my remote machine so thats out of question.
So the above ... or ... any GUI (Visual Studio kind) type solution that would make the remote command line GDB ... a breeze.

Run visual simulation from OpenGL running on Ubuntu terminal from Windows

I built a simulation code using OpenGL X11 GLUT GLEW and bullet-physics on Linux. The code and the visuals run really nicely on a pure Linux environment.
Now, I built the code on a windows machine using an Ubuntu terminal (downloaded from Microsoft Store). When I run the code, I get a cannot connect to X server message
After some reading, I found (and learned) that on Windows you could install Xming as the visualization server, while exporting DISPLAY=localhost:0 on the Linux side. After doing this, I get the message: No appropriate visual found
How can I solve this? I tried what this question mentions: How can I run an OpenGL application installed on a linux machine from my windows machine?, but on the Putty section I got lost. If somebody could list some specific steps, I would highly appreciate it.
Windows does not have a X server nor client. You have several options:
Install a X server and client for Windows.
Run the program on Linux and connect to it via a X client for Windows.
Replace the X11 code with Windows code.
Use a library that abstracts you from details such as SDL.

Eclipse Remote Debugging CDT tutorial

TL;DR: is there a step by step tutorial to do remote code debugging using Eclipse Neon?
I have the source code in a Linux machine with a GCC dev environment. Normally, I ssh to the box, edit the file, and compile/debug using gdb, and it works, but it is a bit clunky for me.
I am now trying to debug the code from my Windows machine using the latest Eclipse version (Neon as of this writing).
I've tried following the instructions online (like this one), but they all seem to point towards (cross-)compiling the code locally, deploying it remotely and debugging there. This is not what I'm after. I essentially want to use Eclipse as a remote text editor+gdb interface, with the building and compiling being done in the remote system.
I've installed CDT, plus pretty much any plugin remotely related to remote development
Remote System Explorer
Remote Launch
GCC Cross compiler support
Remote (over TCF/TE) Run/Debug Launcher
Direct Remote C++ Debugging
TCF C/C++ Debugger
TM Terminal
So far, I can connect to the remote system, create a Remote Project and edit the source code.
I don't need Eclipse to compile the code (I can do that separately) but I'm unable to debug the code.
Using C/C++ Remote Application fails in many creative ways when trying to find gdb in the remote system.
Using GDB (DSF) Automatic Remote Debugging Launcher ends in a java.lang.NullPointerException, which also invalidates the configuration
Using Direct Remote Debugging Launcher asks about a remote workspace, then complains with "Error with command: gdb --version Cannot run program "gdb": Launching failed"
Remote Application complains about the Process/Image field. Setting it to the binary output doesn't enable the Debug button, so no dice.
TCF is dead in the water. It doesn't recognize the SSH connections I set up on RSE, it asks for the username password (I use public keys) and root password (?!) Even when entering that info, it fails to continue.
On a whim, I tried NetBeans, and followed the instructions here, and got it working in five minutes. The mode I'm following is the "Full Remote Development" according to NetBeans. The reason I'll still need to stick to Eclipse is that it is the dev environment that we use in the company, and it makes little sense to me to add another IDE to do something that Eclipse by all rights should do no problem.
What I find is that the walkthroughs for Eclipse I've found are either
Using plugins that are now either deprecated, not supported or have been completely reworked. Eclipse crashes and burns on these.
Trying to compile locally and deploy remotely, doing things like embedded even, but that's not what I'm looking for.
Using the Eclipse DStore client-server combo, which is essentially an alternative to SSH, but not what I'm looking for either.
I'm then hoping someone has written/found a tutorial that is relatively simple to follow (it is, after all, a relatively simple thing to do, as NetBeans has proven), and that works on any version of Eclipse.
I'll consider using an older version of Eclipse, but if so, please be specific in which version I should use, and which plugins I should install.

Can an IDE/Netbeans connect to a remote computer and compile/run/debug code on it?

I'm developing a program for a specific environment. That means it needs to run on the OS and compile using its compiler. I have a different environment at home (Windows 8) is there a way Netbeans can be used to connect to the target environment and use its compiler? It is enabled for remote login.
So basically right now I write code on my home computer, connect using Putty to the target computer, copy the source code over, compile it and run it. I'm trying to simplyfy this process so I only have to use Netbeans.
Why don't I just get same compiler and do everything locally? The target computer is running Linux and the program has a lot of system calls.
I know Aptana has a simillar feature, but Aptana is so crappy in general I don't want to use it.
Let me know if my question doesn't make sense and I'll try and reword it.
Yes, you can do remote development in NetBeans. It's described in its Help subsystem:

linux development on windows

We develop C++ code primarily on a headless linux x64 server with VI. We are provided with windows desktops and I was wondering how others in similar situation work? Do you just use windows to remote into linux box or is there a way to develop on windows.
Two solutions that come to my mind are:
Run a linux VM on windows desktop.
Cygwin. (not sure about it).
Any others?
There is a VIM port for windows. As an everyday user I can say that the experience is seamless, except for using windows path separators.
There are other options to consider:
MSYS supplies you with a set of GNU tools compiled natively for windows, including a shell, ssh/scp
MinGW gets you a Windows port of gcc.
UnxUtilx is another set of GNU tool ports, but with no recent activity.
As others have mentioned, putty gets you ssh/scp, purpose-built for windows.
The only C++ app I currently develop is Qt based and cross platform so I tend to develop in Windows using Visual Studio and then test on linux. For testing on linux I mostly use putty, vi and make but if I need to use a debugger I use nemiver and xming with putty exporting the x session to the PC for xming to render.
Do you just use windows to remote into linux box or is there a way to develop on windows. -- yes mostly I do that.
winscp is a tool that lets you do your text-editing locally in your editor of choice, whether it be emacs for windows or gedit or notepad, and save remotely.
When I worked in an environment like that, I installed Cygwin/X and putty on my windows box. You use putty to connect to the Linux box with the Connection --> SSH --> X11 --> "Enable X11 forwarding" turned on. You
Install Cygwin including Cygwin/X http://x.cygwin.com/ — download the installer, make sure the xinit package is selected in the things to install, and hit go!
Install PuTTY http://www.chiark.greenend.org.uk/~sgtatham/putty/ and enable X forwarding in your session settings. PuTTY will automagically set your DISPLAY environment variable correctly.
Start your X server on Windows (Start -> Programs -> Cygwin/X -> XWin Server ) — you may want to copy this to your Startup group so it runs whenever you log in.
Use PuTTY to connect to your *nix box and fire up an X Windows program — remember to "amp it off" http://www.catb.org/jargon/html/A/amp-off.html.
You can use whatever X programs are available on the Linux machine seamlessly on your local client desktop. You can do it with Eclipse or gvim or kate.
Another thing I've had good luck with is using Samba on the Linux box to share my source tree, and then mapping a drive in Windows to that share, using native Windows tools to edit it.