Author Topic: Compling on a remote machine  (Read 7633 times)

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Compling on a remote machine
« on: December 29, 2011, 04:54:36 pm »
Hi,

I would like to compile my code on a remote machine, so I selected "Build options", selected "Make commands" tab and changed "Build project/target" to the following:

Code
ssh some_machine "cd /home/erezz/some_dir && make -j8"

and I got this error:
Code
 Using makefile: Makefile
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'.  Stop.
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings

What am I doing wrong?

Thanks,
Erez

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Compling on a remote machine
« Reply #1 on: December 29, 2011, 04:55:32 pm »
Of course, my home dir is mounted via nfs on the remote build machine.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compling on a remote machine
« Reply #2 on: December 29, 2011, 05:00:38 pm »
I don't think C::B can execute sh commands directly. Probably you can try to make a script and then execute the script instead of your ssh && make command.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Compling on a remote machine
« Reply #3 on: December 29, 2011, 05:08:28 pm »
What is a script? A BASH script? Something else?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compling on a remote machine
« Reply #4 on: December 29, 2011, 05:23:04 pm »
Yes, a shell script. Bash, pure old sh script, whatever.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Compling on a remote machine
« Reply #5 on: December 29, 2011, 05:33:04 pm »
I moved it to a script and put the full path to the script in "Build project/target". I get the same error:

Code
Using makefile: Makefile
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'.  Stop.
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings

It looks like it's looking for a Makefile. One more (probably important) thing - when I checked "This is a custom Makefile" in the project properties, I saw a warning that "the file must exist, no Makefile will be auto-generated". Do I need to create a Makefile and call my ssh command from it?

Thanks,
Erez

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compling on a remote machine
« Reply #6 on: December 29, 2011, 05:34:39 pm »
If you don't have a Makefile you can't get it to work this way.
You have to write a Makefile or use a makefile generator software.
Then you should call make in the same directory as the Makefile.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Compling on a remote machine
« Reply #7 on: December 29, 2011, 06:43:28 pm »
Maybe a little hacky, but this should work:

  • Place your script in the "Execution directory" of your makefile
  • use ./[your_script] as makefile
  • change the "Make" commands in the projects "Build options" to just $makefile
  • do this for all targets, or just for the projects and empty the commands for the targets
  • for compiling a single file or for cleaning you can use commandline parameters, similar to the makefile-targets


I tested it with a simple project on my debian machine.
Not tested with ssh, but this should not make a difference (at least if you do not need passwords).

With build script this might also be possible to do.

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Compling on a remote machine
« Reply #8 on: January 01, 2012, 01:40:19 pm »
I probably did something wrong...

I created a Makefile and placed it in the path that I found in the project properties under "Execution directory". The Makefile contains a single line:
Code
ssh some_remote_machine "cd some_dir && make -j8"

Now, I selected "Build options" for the project and set "Build project/target" for the project to "$makefile". I hit ctrl+f9 and got this:

Code
-------------- Build: Debug in my_proj_name ---------------

Using makefile: Makefile
Nothing to be done (all items are up-to-date).

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Compling on a remote machine
« Reply #9 on: January 01, 2012, 03:00:09 pm »
Make sure your makefile is executable and

Maybe a little hacky, but this should work:

  • Place your script in the "Execution directory" of your makefile
  • use ./[your_script] as makefile
  • change the "Make" commands in the projects "Build options" to just $makefile
  • do this for all targets, or just for the projects and empty the commands for the targets
  • for compiling a single file or for cleaning you can use commandline parameters, similar to the makefile-targets


I tested it with a simple project on my debian machine.
Not tested with ssh, but this should not make a difference (at least if you do not need passwords).

With build script this might also be possible to do.

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Compling on a remote machine
« Reply #10 on: January 01, 2012, 03:28:50 pm »
Now, "Build project/target", "Compile single file", "Clean project/target", "Ask if rebuild is needed" & "Silent build" for the project are set to "$makefile". I guess that this is what you meant when you wrote "change the "Make" commands in the projects "Build options" to just $makefile".

The "Make commands" for Debug & Release are empty.

the Makefile is executable.

When I hit ctrl+F9. I get this:

Code

-------------- Build: Debug in my_proj_name ---------------

Using makefile: Makefile
/bin/sh: Makefile: not found
Process terminated with status 127 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Compling on a remote machine
« Reply #11 on: January 01, 2012, 05:01:30 pm »
Maybe a little hacky, but this should work:

  • Place your script in the "Execution directory" of your makefile
  • use ./[your_script] as makefile
  • change the "Make" commands in the projects "Build options" to just $makefile
  • do this for all targets, or just for the projects and empty the commands for the targets
  • for compiling a single file or for cleaning you can use commandline parameters, similar to the makefile-targets


I tested it with a simple project on my debian machine.
Not tested with ssh, but this should not make a difference (at least if you do not need passwords).

With build script this might also be possible to do.

Make sure these settings are correct in the projects properties.