Building 32-bit binaries on a 64-bit system?

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

Building 32-bit binaries on a 64-bit system?

Mike Meyer
I've got someone who wants to run one of my haskell apps on a 32-bit Windows 10 box. I've pretty  much moved to 64-bit everywhere, so don't have such a system to build on.

Is it possible to get stack/cabal/ghc to build a 32-bit Windows binary on a 64-bit Windows box? Google found a bunch of things about building 64 bit applications, and the ghc manual doesn't seem to have such an option. So do I need to get a 32-bit system for this?

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Building 32-bit binaries on a 64-bit system?

Michael Snoyman

Stack has a command line argument --arch, mostly intended for the Windows case. Try stack --install-ghc --arch i386 build, it should do what you want.


On Fri, Oct 16, 2015, 5:22 PM Mike Meyer <[hidden email]> wrote:
I've got someone who wants to run one of my haskell apps on a 32-bit Windows 10 box. I've pretty  much moved to 64-bit everywhere, so don't have such a system to build on.

Is it possible to get stack/cabal/ghc to build a 32-bit Windows binary on a 64-bit Windows box? Google found a bunch of things about building 64 bit applications, and the ghc manual doesn't seem to have such an option. So do I need to get a 32-bit system for this?
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Building 32-bit binaries on a 64-bit system?

Mike Meyer

Thanks, the worked like a charm! Any chance this can be used for cross-compiling from a Unix desktop to embedded arm?


On Fri, Oct 16, 2015, 09:24 Michael Snoyman <[hidden email]> wrote:

Stack has a command line argument --arch, mostly intended for the Windows case. Try stack --install-ghc --arch i386 build, it should do what you want.


On Fri, Oct 16, 2015, 5:22 PM Mike Meyer <[hidden email]> wrote:
I've got someone who wants to run one of my haskell apps on a 32-bit Windows 10 box. I've pretty  much moved to 64-bit everywhere, so don't have such a system to build on.

Is it possible to get stack/cabal/ghc to build a 32-bit Windows binary on a 64-bit Windows box? Google found a bunch of things about building 64 bit applications, and the ghc manual doesn't seem to have such an option. So do I need to get a 32-bit system for this?
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Building 32-bit binaries on a 64-bit system?

Roman Cheplyaka-2
On 10/17/2015 03:29 PM, Mike Meyer wrote:
> Thanks, the worked like a charm! Any chance this can be used for
> cross-compiling from a Unix desktop to embedded arm?

Not as easy as that. This solution relies on the fact that you can run
i386 binaries on x86-64, which is obviously not true for arm.

See https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling for
how to build a cross-compiler.

> On Fri, Oct 16, 2015, 09:24 Michael Snoyman <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Stack has a command line argument --arch, mostly intended for the
>     Windows case. Try stack --install-ghc --arch i386 build, it should
>     do what you want.
>
>
>     On Fri, Oct 16, 2015, 5:22 PM Mike Meyer <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         I've got someone who wants to run one of my haskell apps on a
>         32-bit Windows 10 box. I've pretty  much moved to 64-bit
>         everywhere, so don't have such a system to build on.
>
>         Is it possible to get stack/cabal/ghc to build a 32-bit Windows
>         binary on a 64-bit Windows box? Google found a bunch of things
>         about building 64 bit applications, and the ghc manual doesn't
>         seem to have such an option. So do I need to get a 32-bit system
>         for this?
>
>         _______________________________________________
>         Haskell-Cafe mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Building 32-bit binaries on a 64-bit system?

Lana Black
One can run arm binaries on x86_64 using qemu user emulation and binfmt on linux.

  Original Message  
From: Roman Cheplyaka
Sent: Saturday, October 17, 2015 2:04 PM
To: [hidden email]
Subject: Re: [Haskell-cafe] Building 32-bit binaries on a 64-bit system?

On 10/17/2015 03:29 PM, Mike Meyer wrote:
> Thanks, the worked like a charm! Any chance this can be used for
> cross-compiling from a Unix desktop to embedded arm?

Not as easy as that. This solution relies on the fact that you can run
i386 binaries on x86-64, which is obviously not true for arm.

See https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling for
how to build a cross-compiler.

> On Fri, Oct 16, 2015, 09:24 Michael Snoyman <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> Stack has a command line argument --arch, mostly intended for the
> Windows case. Try stack --install-ghc --arch i386 build, it should
> do what you want.
>
>
> On Fri, Oct 16, 2015, 5:22 PM Mike Meyer <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> I've got someone who wants to run one of my haskell apps on a
> 32-bit Windows 10 box. I've pretty much moved to 64-bit
> everywhere, so don't have such a system to build on.
>
> Is it possible to get stack/cabal/ghc to build a 32-bit Windows
> binary on a 64-bit Windows box? Google found a bunch of things
> about building 64 bit applications, and the ghc manual doesn't
> seem to have such an option. So do I need to get a 32-bit system
> for this?
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email] <mailto:[hidden email]>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Cross-compiling for arm?

Mike Meyer
In reply to this post by Roman Cheplyaka-2
On Sat, Oct 17, 2015 at 9:04 AM Roman Cheplyaka <[hidden email]> wrote:
On 10/17/2015 03:29 PM, Mike Meyer wrote:
> Thanks, the worked like a charm! Any chance this can be used for
> cross-compiling from a Unix desktop to embedded arm?

Not as easy as that. This solution relies on the fact that you can run
i386 binaries on x86-64, which is obviously not true for arm.

Yeah, I sort of expected that. But i'd be nice if it works.
 
See https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling for
how to build a cross-compiler.

Doesn't work for me for building embedded code. The target arm-none-eabi fails to configure because gcc doesn't work, because _exit doesn't exist. Which is indeed the case. I don't see any way to turn that off.

Is this not supported by ghc?

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compiling for arm?

Alexey Raga
I was able to build a docker container for an ARM cross-compiler, if you find it helpful please have a look here: https://github.com/AlexeyRaga/ghc-docker-cross-arm

Cheers 

On Mon, Oct 19, 2015 at 3:00 AM Mike Meyer <[hidden email]> wrote:
On Sat, Oct 17, 2015 at 9:04 AM Roman Cheplyaka <[hidden email]> wrote:
On 10/17/2015 03:29 PM, Mike Meyer wrote:
> Thanks, the worked like a charm! Any chance this can be used for
> cross-compiling from a Unix desktop to embedded arm?

Not as easy as that. This solution relies on the fact that you can run
i386 binaries on x86-64, which is obviously not true for arm.

Yeah, I sort of expected that. But i'd be nice if it works.
 
See https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling for
how to build a cross-compiler.

Doesn't work for me for building embedded code. The target arm-none-eabi fails to configure because gcc doesn't work, because _exit doesn't exist. Which is indeed the case. I don't see any way to turn that off.

Is this not supported by ghc?
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe