GHC compiling for different platforms

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Bernhard Lehnert
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

Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Magnus Therning
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20090629/5e3b88aa/signature-0001.bin
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

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?



Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Colin Adams-3
You certainly don't need an extra computer, as you could run 32-bit
Linux in a VM.

2009/6/30 Bernhard Lehnert <[hidden email]>:

> 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
> [hidden email]
> http://www.haskell.org/mailman/listinfo/beginners
>
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Sean Bartell
In reply to this post by Bernhard Lehnert
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090630/863415c9/attachment.html
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Magnus Therning
In reply to this post by Colin Adams-3
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20090630/326b6de9/signature.bin
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Felipe Lessa
In reply to this post by Sean Bartell
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.
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Magnus Therning
On Tue, Jun 30, 2009 at 7:24 AM, Felipe Lessa<[hidden email]> wrote:
> 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
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Felipe Lessa
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.
Reply | Threaded
Open this post in threaded view
|

GHC compiling for different platforms

Bernhard Lehnert
In reply to this post by Sean Bartell
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