On Sun, Feb 14, 2010 at 10:44 AM, Daniel Eggleston <[email protected]> wrote: > If you're going to expect your compiled programs to run on any system, > without re-compiling, they will have to be statically linked, or distributed
I feel I have to qualify this further. You will absolutely need to recompile for Win32, Win64, Linux, and BSD. Obviously, Win32 and Win64 use different binary formats (ELF versus COFF). Win32 and Win64 don't support Universal Binaries, so you'll need separate executables for both. Linux isn't technically a Unix; it's not Open-Group certified. So there are subtle differences between it and true Unix platforms like BSD. Because of this, most of the time you can use the same binary on both Linux and BSD; sometimes you can't. So you have to be aware of this. On the Mach kernel (a variant of BSD used in Mac OS X) you need to still tweak further. Some libraries are only available as frameworks, which are linked differently. (A Framework is a truly ingenious idea which puts a library's headers and binaries in one package, instead of smearing the headers into /include, /usr/include, /usr/local/include, /usr/share/include, etc. and then smearing the binaries into /lib, /usr/lib, etc.) > with copies of the libraries in question, and a shell script wrapper to set > the library path. > > Even then, they'll only run on the arch they're compiled for. Except in the case of OS X Universal Binaries, which is the only situation in which I've ever seen an executable functional across multiple architectures (PPC, x86, x64, and ARM so far AFAIK). > That's one of the easy things about interpreted languages. If your program > is not math-intensive, (like the one you've written), you can easily make an > interpreted-language version that will run *without modification* on several > platforms (i.e. I'm fond of doing this with python; Tkinter, GTK and QT4 all > allow the creation of programs that run on windows, linux, and mac, on any > processor, without any modification whatsoever. You just run it. More recent JVMs have done a fantastic job of optimizing math-intensive bits, almost as efficient as C/C++ is now. Not that it will stop me from putting on the "Back in my day!" hat and accusing Java of being slow. -- Registered Linux Addict #431495 For Faith and Family! | John 3:16! http://www.fsdev.net/ -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup
