Posted by
| David Haley
USA (3,881 posts) Bio
|
Message
| The short answer is: yes, this is possible. You might do it if, say, you couldn't compile on the other machine, or didn't want to.
In fact, if you think about it, every time you run a program on Windows, you are basically the receiving end of the situation you describe.
The long answer is:
- For this to work, both machines need to have the same architecture. You cannot compile on an x86 and then go run on a SUN Solaris box, for instance. (but see note below about cross-compiling) An exception of note is probably 64-bit x86 (which isn't actually called x86 anymore, I think) but which is quite compatible with 32-bit code.
- Once you're running on the same architecture, you also need to have compatible OS system calls. A windows executable obviously will not run "as is" on Linux, and vice-versa. Even on Linux, you need to have compatible flavors of Linux -- but this is probably guaranteed since they all have more or less the same kernel anyhow.
- You can cross-compile, which means that you compile on platform A for platform B. Why would you do such a thing? Perhaps platform B has no native compiler (or you don't have access to it for whatever reason), so you don't have a choice. In this case, compilation is the same, except that instead of generating, say, x86 assembly, you could generate PowerPC (Mac) or even MIPS assembly.
Now, why would a MUD person do this? Good question. Most Linux-like environments are not in the habit of distributing binaries, because it's usually so easy to just compile stuff yourself. Basically there is a culture of do-it-yourself.
Now, you might want to actually distribute binaries if:
- the compilation process is complicated
- you do not want to distribute source code
- the receiver doesn't know anything about compiling and will make a mess out of everything
- you just want a nice, neat package that can be run without worrying about a thing -- unzip, cd src, startup. (But frankly, it's so easy to type 'make' before 'startup' that you have to wonder how good of a reason this is.)
- the target system is very slow and you're lazy and don't want to wait for a long compile to finish (and hopefully, your program isn't so resource-hungry as to suffer from the slow computer!)
- the target system has a crappy compiler, and will produce unoptimized or worse yet buggy code. Or, it is not very strict, and you prefer to compile in a strict environment with lots of warnings, etc.
Would I do such a thing for SMAUG? Incredibly unlikely. I just don't see the need for it. If I'm going to go to the trouble of tgzing everything and moving it, it costs very little more to just re-compile. If I'm moving it to a system where I can run it, then I'll be able to compile it there, too. But, yes, it is possible, with all the caveats above... |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|