News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compling on a remote machine

Started by erezz, December 29, 2011, 04:54:36 PM

Previous topic - Next topic

erezz

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:


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


and I got this error:

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

erezz

Of course, my home dir is mounted via nfs on the remote build machine.

oBFusCATed

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!]

erezz

What is a script? A BASH script? Something else?


oBFusCATed

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!]

erezz

I moved it to a script and put the full path to the script in "Build project/target". I get the same error:


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

oBFusCATed

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!]

Jenna

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.

erezz

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:

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:


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

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

Jenna

Make sure your makefile is executable and
Quote from: jens 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.

erezz

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:



-------------- 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)



Jenna

Quote from: jens 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.

Make sure these settings are correct in the projects properties.