Author Topic: Compiling on a remote linux system without Uniwin  (Read 7287 times)

Offline scary_jeff

  • Single posting newcomer
  • *
  • Posts: 3
Compiling on a remote linux system without Uniwin
« on: November 11, 2009, 04:11:37 pm »
Hi

I was originally going to post this as a reply to http://forums.codeblocks.org/index.php/topic,6289.0.html which came up in my search for a way to use remote compiling with C::B, but that thread is very old.

I didn't want to use Uniwin because it seemed like a bad/slow idea to have two copies of the source. I couldn't find a better solution on the forum, so here is mine. Note that it assumes a custom makefile, and is for remote compiling where C::B is on a windows system, and the remote compilation is on a linux system.

Step 1: Download and install Xming (windows X server) from http://sourceforge.net/projects/xming/ . It will sit in the systray.

Step 2: Open or create your project, and choose any compiler you have installed that actually works (i.e. doesn't give you an 'invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]' message when you try to build). The easiest way to achieve this is to use the C::B installer that includes MinGW. It doesn't matter if your remote compiler is completely different to the one you choose here.

Step 3: In the project properties, "Project Settings", select "This is a custom Makefile", <OK>. Now in the project build options, "'Make' Commands", enter: [  $make -X -ssh RemoteUser@RemoteIP -pw RemotePassword make all -C /path/to/remote/makefile/  ]*. The 'make all' is specific to my Makefile. You can obviously modify this for the different build types implemented in your Makefile. I set all the make commands to be the same, with the exception of "Clean project/target", where I used 'make clean', which is implemented in my Makefile. Do this for all the build profiles (in my case, "Debug" and "Release"). <OK>.

Step 4 (nightly builds only): If you are using a C::B build newer than January 2009, you may need to fill in the "Ask if rebuild is needed" make command in the "'Make' Commands" tab. This is the same command as in step 3, but with make -q in place of make all. For the 11/11/09 nightly build, I had to use make-q (i.e. without the space) for this to work. You must also change "Settings", "Compiler and debugger", "Global compiler settings", "Other settings", "Compiler logging" to "Full command line", or else you will receive a "Nothing to be done." message when you try to build.

Step 5: In "Settings", "Compiler and debugger", "Global compiler settings", "Toolchain executables", change the "Make program" to "plink.exe", and add the path to it in the "Additional paths" tab (in my case "C:\Program Files\Xming").

Step 6: Build the project. The first time you do this, you will be prompted with a "PuTTY Security Alert". Click "Yes" and the remote server will be added to your list of trusted hosts**.

* Your remote password is stored in plaintext, not everyone will like this! Also, the path to the remote makefile is relative to the root of the remote machine, for example /home/jeff/myproject.

** If you have used PuTTY before, this can go wrong. If you are being prompted for a username and password, delete the registry key "HKEY_CURRENT_USER/Software/Simon Tatham/PuTTY". Note that this could mess up your PuTTY configurations (it might not; I didn't check).

I hope this is useful to someone!
« Last Edit: November 13, 2009, 01:56:17 pm by scary_jeff »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Compiling on a remote linux system without Uniwin
« Reply #1 on: November 11, 2009, 04:21:31 pm »
Hi
Thanks for sharing! Please put this in the C::B WiKi so it does not get lost. Just "near" the article about UniWin.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline scary_jeff

  • Single posting newcomer
  • *
  • Posts: 3
Re: Compiling on a remote linux system without Uniwin
« Reply #2 on: November 12, 2009, 01:29:56 pm »
OK, I think I'll wait until someone else has got this working, to make sure my instructions are correct.

edit: ok, I added it to the wiki. http://wiki.codeblocks.org/index.php?title=Using_Xming_for_remote_compilation
« Last Edit: November 13, 2009, 05:00:41 pm by scary_jeff »