- Online Community Forums » Programming Questions » Remote Compiler

This thread is locked; no one can reply to it. rss feed Print
Remote Compiler
Chris Katko
Member #1,881
January 2002

Anyone ever setup a computer as a remote compiler? (On a local network, though I hear people do cloud VMs.)

That is:
- you hit compile. (run / run make)
- files get transferred to host
- host compiles
- host returns executable

I have a fairly crappy laptop and my build times are increasing to the point I can't rapidly develop like when I started. I've started splitting code into modules (in D) but it still uses a lot of RAM and I only have 2 GB of RAM (before Ubuntu takes over half!). If I have more than a couple chrome tabs open, it crushes to a halt when it hits the swap memory.

I'm not using a GUI editor to compile (though I might be able to do that anyway). I just run a build bash file. So I don't think that would be too hard as long as there was network file access.

The one open question is, how would I get compiler output? Hmm... I guess I could output back to a temporary file, and have my script write "build errors occurred!" and print the contents. Though I don't know how the bash file would know to wait till the compiler was done unless I looped until a temporary file was produced.

I know it's possible to cross-compile but I don't need that. I'm using the same build system on both. (Assuming library versions don't become an issue.) Linux.

“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Mark Oates
Member #1,146
March 2001

Ultimately the problem is the complexities of cross-compilation.

Otherwise it's a relatively trivial task to execute a build on a remote computer. A v1 really is as simple as:

git clone https://.../project.git
cd project
make project
cp -a bin/. /some-public-destination-folder/

Samuel Henderson
Member #3,757
August 2003

This won't really answer your question at all, however, we do something very similar only from Windows -> Linux.

So we develop our application using Visual Studio 2017 with the "Visual C++ For Linux" extension installed. This extension allows us to configure our projects so that they will be copied to, compiled & linked on a remote linux machine. Our solution has several projects set to be built as shared object libraries and an application that runs and uses these .so files for logic and graphics and whatnot.

It actually works fantastically well.

But of course, you are asking Linux->Linux, which I would imagine should not be too hard?

Paul whoknows: Why is this thread still open?
Onewing: Because it is a pthread: a thread for me to pee on.

Member #7,536
July 2006

I'm not aware of existing tools, but if one exists it would be better to use the rounded wheel. Practically speaking it shouldn't be technically hard to do. Your local 'build' command would effectively send the command to a remote machine, capture the output and error streams, and stream them back to you in some way. And when all was said and done copy the output back to you as well. You might be able to achieve something rudimentary with just ssh. Cross-compilation is where it could get messy, but Linux to Linux won't matter as much except for third party (i.e., package) dependencies. An existing wheel might be hiding behind a name like "cloud". I can't help beyond that.

Well, worst case, a custom tool is developed that understands the cross-compilation conversions necessary (if needed), copies files up, invokes build commands and streams the output back to the client, and then copies the resulting files back to the client. It's definitely technically possible to do a good job of it. In practice, if the exact wheel or wheels you need doesn't exist it's probably a pretty big job to make them. On the other hand, many people could potentially benefit from it so perhaps you could get help if you ask in the right channels.

Peter Hull
Member #1,136
March 2001

If both your systems are Linux then could you just ssh into your remote host and do all building and compiling on there? You could then use unison, rsync or maybe just scp to get the built product(s) back to your laptop for test.
If you did your remote login with gnu screen then you could keep your session going on the remote even if you put your laptop to sleep.

Go to: