GHC compiling for different platforms

Hi folks! When I compile a program under windows - will the .exe run under any windows? Do I have to distribute only the .exe or more files? When I compile a program under a 64bit-Linux on an AMD-CPU, will the executable run under 32bit and/or Intel-CPU as well? Are there any, say, compiler flags, to improve portability? Thanks, Bernhard

Bernhard Lehnert wrote:
Hi folks!
When I compile a program under windows - will the .exe run under any windows? Do I have to distribute only the .exe or more files?
In my experience, yes. But I have really only taken .exe's compiled on XP to run on Vista and w2k3.
When I compile a program under a 64bit-Linux on an AMD-CPU, will the executable run under 32bit and/or Intel-CPU as well? Are there any, say, compiler flags, to improve portability?
I don't think you'll have any success in running a 64-bit executable on a 32 bit system. However, I think most 64-bit systems are able to run 32-bit executables. I suspect GHC, with its static linking is a rather easier platform than C/C++ with its typically large set of shared objects. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

Am Montag, den 29.06.2009, 23:05 +0100 schrieb Magnus Therning:
I don't think you'll have any success in running a 64-bit executable on a 32 bit system.
Any chances to compile for a 32 bit linux on a 64 bit Linux or do I need an extra computer? Any other problems such as Intel/AMD/... or just 32bit/64bit?

You certainly don't need an extra computer, as you could run 32-bit
Linux in a VM.
2009/6/30 Bernhard Lehnert
Am Montag, den 29.06.2009, 23:05 +0100 schrieb Magnus Therning:
I don't think you'll have any success in running a 64-bit executable on a 32 bit system.
Any chances to compile for a 32 bit linux on a 64 bit Linux or do I need an extra computer? Any other problems such as Intel/AMD/... or just 32bit/64bit?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Colin Adams wrote:
You certainly don't need an extra computer, as you could run 32-bit Linux in a VM.
Yes, going the VM route is probably easiest. IIRC Virtualbox can now run 64-bit guests on a 32-bit host, so you'd be able to provide executables for both no matter what you run on your main system. There was a call for a pre-made VM for Haskell development a while back (I think it was raised on haskell-cafe). I'm not sure anything came of it, but it'd be worth searching through the archives to see if you can avoid installing guests yourself. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

I'm guessing the easiest way would be to download a 32-bit precompiled version of GHC and use that. It should work if you have 32-bit libraries installed, which your distro probably does by default. I don't know about Haskell, but in C you could set up a chroot (your distro might have docs). You could also try compiling Haskell yourself and messing with configuration options. Intel vs. AMD shouldn't make a difference.

On Tue, Jun 30, 2009 at 01:39:49AM -0400, Sean Bartell wrote:
I don't know about Haskell, but in C you could set up a chroot (your distro might have docs).
chroot'ing is a nice solution in that it works almost for free compared to virtualization, including being able to test graphical apps (OpenGL, anyone?) with the very same hardware. It may, however, be not so very straightforward to get started. Gentoo has a nice guide somewhere about setting up a (Gentoo) chroot. After the first install, however, maintaining is a breeze. -- Felipe.

On Tue, Jun 30, 2009 at 7:24 AM, Felipe Lessa
On Tue, Jun 30, 2009 at 01:39:49AM -0400, Sean Bartell wrote:
I don't know about Haskell, but in C you could set up a chroot (your distro might have docs).
chroot'ing is a nice solution in that it works almost for free compared to virtualization, including being able to test graphical apps (OpenGL, anyone?) with the very same hardware.
There seems to be some support for OpenGL in VirtualBox these days[1]. I have no experience with it myself though.
It may, however, be not so very straightforward to get started. Gentoo has a nice guide somewhere about setting up a (Gentoo) chroot. After the first install, however, maintaining is a breeze.
The big limitation with a chroot is of course that the surrounding system puts limits on what you can run in the chroot, though for many uses that doesn't really matter. /M [1]: http://www.phoronix.com/scan.php?page=news_item&px=NjkzOA -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

On Tue, Jun 30, 2009 at 09:09:30AM +0100, Magnus Therning wrote:
compared to virtualization, including being able to test graphical apps (OpenGL, anyone?) with the very same hardware.
There seems to be some support for OpenGL in VirtualBox these days[1]. I have no experience with it myself though.
That's why I said "very same hardware", because in a chroot there are no additional software layers.
The big limitation with a chroot is of course that the surrounding system puts limits on what you can run in the chroot, though for many uses that doesn't really matter.
Yes, of course, but for cross-compiling you don't really care about that. However if you cared, you could also try FreeBSD jails, but I have never used them. :) -- Felipe.

Thanks for all the help. I'lll first try to just use the 32-bit precompiled version and will google about the other answers. Thanks to all, Bernhard
participants (5)
-
Bernhard Lehnert
-
Colin Adams
-
Felipe Lessa
-
Magnus Therning
-
Sean Bartell