views:

3625

answers:

6

I have a Windows pc with Eclipse Ganymede installed, and a Linux pc where my C++ project files are located. I use Eclipse to edit the files through SMB, and would like to build the project using Eclipse as well. Currently I connect using putty to my linux machine, and run ./make from the appropriate directory. How would I run the same command within Eclipse and see the results in it? I have installed the RSE plugin, but still can't grasp how to do so.

Just to made myself clear - I can use VNC to work on Eclipse that is installed on my linux machine, but I prefer not do so. Eclipse through VNC is slow and not as responsive as the Eclipse installed on my windows machine.

Thanks, Rouli

+2  A: 

Have you tried remote desktop tools like e.g. nx to run eclipse locally on the machine that also holds the source?

That might be the easier solution. Plus, you have the same environment from any PC that runs that tool.

wr
Yes, I have eclipse on the linux machine, which I can access through, say, VNC. But it's nicer to work with Eclipse directly, not through remote desktop tools
r0u1i
As eclipse support execution of local scripts, you can do the following: ssh user@remotehost "cd path; make"
wr
A: 

Have you tried running Eclipse from the Linux machine with X11 forwarding ? You should have Eclipse installed on the Linux machine first.

Haven't tried it myself.

Liran Orevi
A: 

Like Liran Orevi said you can use x windows.

  1. Install the cygwin x server on your windows system.
  2. Enable remote connections to this X server using "xhost +" or similar (xhost + is not considered secure so don't do it on a public network but its ok for most cases)
  3. ssh on to the linux box
  4. set the DISPLAY environment variable eg "export DISPLAY=":0"
  5. run eclipse from the command line Eclipse should now appear on xserver on the windows system.

ssh can automate the forwarding, removing the need for xhost + and the DISPLAY env.

iain
Thanks for the detailed response.However, there must be a better way than running Eclipse through cygwin, no?After all, there's a way to debug remotely using gdbserver, why isn't there a way to run a simple makefile remotely and observe the build results on Eclipse?
r0u1i
+2  A: 

You can create a project on a remote machine using RSE. To do so you must have the RSE server component installed on the remote machine. Create a connection to the machine using the RSE Remote Systems view. Create a new C/C++ project and on the first page of the wizard uncheck the checkbox that says "use default location". This enables a dropdown of file system providers, choose RSE. Then when you click Browse you will get a dialog that lets you browse the remote system for the folder where you want your project to live.

There are a few issues with this approach. First of all when the CDT indexer wants to build the index it needs to parse all the files in your project, which means downloading all the files to your local machine. This can be slow if you have a large project or a slow connection.

Another issue is that when you restart eclipse the remote projects will be closed. This is because you don't have a connection to the remote machine yet so eclipse can't read the .project file. You will have to reopen your remote projects every time you start eclipse.

There is currently a project in the works called RDT (Remote Development Tools) which adds remote indexing capabilities to CDT. That means the indexer will live on the remote machine with your code, so the files don't have to be downloaded for the indexer. Its still in "alpha" status, but if you are adventurous and want to try it out go here.

Mike Kucera
Hi Mike,I don't have a problem accessing the files. Would this approach allow me to remotely build the project?
r0u1i
I don't think there is a way to remotely build. There are a couple things you could try. You could try to change the build command to use ssh. Also you can open a remote shell inside eclipse and run make from there. The RDT project does contain a remote builder but its very preliminary.
Mike Kucera
Does the RSE approach allow you to build the project remotly as well (in an integrated way, not dropping to a shell and run make)
nos
RDT (Remote Development Tools) provides a remote builder. It automatically calls make on the remote machine then displays the results in the eclipse console and problems views.
Mike Kucera
+3  A: 

I was in a similar situation, developing in a windows worstation, compiling in a linux server. This is what I ended doing:

  1. Setup a passwordless login to compiler server with putty, for example you can follow this tutorial.
  2. Create a login session with putty, make sure that in Connections/SSH/Auth is pointing to your private key.
  3. Modify eclipse make command to plink.exe -load "saved_session" make -C /remote/path/project (This settings is in Project/Properties/C++Build/Builder Settings/Build command). You can automate this with a batch file if you have to pass more parameters and/or execute more steps.

If you have stored a passphrase with your private key then you can use pageant.exe to load your key only once, so you dont have to type your passphrase every time.

Ismael
You don't need to use public key auth, you can supply the password to plink in the command line (with the -pw argument).
Dan Berindei
Although you don't *need* to use public key auth, supplying your login password on the command line and saving it to your eclipse build command is a pretty horrible idea from a security viewpoint.
RarrRarrRarr
A: 

PuTTY / Plink doesn't work for me. The console output ist:

** Build of configuration Release for project Test **

plink.exe -load 192.168.0.100 make all Unable to read from standard input: No process is on the other end of the pipe.

If I enter the same command in a console window (cmd.exe) it works. Any ideas?

Florian Mösch
When I tried this and ran into the same error, I found a suggestion to use plink 0.58 (http://davebrooks.wordpress.com/2007/03/20/). I found what looks like a snapshot of the putty site at 0.58 (http://putty.flyweb.cz/download.html), grabbed plink from there, and sure enough it works. (Relevant bug report: http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/win-plink-stdin-handle-invalid.html).
rakslice