
Hi, I have a Mac OS X workstation and want to compile a cli for Linux (and potentially Windows) in addition to OS X. I could not find anything but https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. This has an explanation how I can build a cross compiling GHC for a specific combination of build and target system/architecture. Stack has an open issue regarding cross compilation. Is that really all there is out there? Regards Jan

On 11/11/16 10:52 PM, Jan von Löwenstein wrote:
I have a Mac OS X workstation and want to compile a cli for Linux (and potentially Windows) in addition to OS X.
I could not find anything but https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. This has an explanation how I can build a cross compiling GHC for a specific combination of build and target system/architecture. Stack has an open issue regarding cross compilation.
Is that really all there is out there?
I documented my cross-compilation adventure here: https://wiki.haskell.org/OpenWRT However, in my opinion, cross-compilation is one of the areas where ghc and its ecosystem are the weakest. You'll probably be much happier if you find a Linux box or install virtualization software on your Mac. --Patrick

On Sat, Nov 12, 2016 at 1:52 AM, Jan von Löwenstein < jan.loewenstein@gmail.com> wrote:
I have a Mac OS X workstation and want to compile a cli for Linux (and potentially Windows) in addition to OS X. I could not find anything but https://ghc.haskell.org/ trac/ghc/wiki/CrossCompilation. This has an explanation how I can build a cross compiling GHC for a specific combination of build and target system/architecture. Stack has an open issue regarding cross compilation.
Is that really all there is out there?
Cross-compilation pretty much only exists for porting ghc itself at this point. There are some hacks involving llvm that are used for ARM cross-compiling. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Thanks for the responses.
I guess I will "cross compile" via vm/docker then.
Glad that I am running on Mac, the other direction would be more difficult
I suppose.
Regards
Jan
Brandon Allbery
On Sat, Nov 12, 2016 at 1:52 AM, Jan von Löwenstein < jan.loewenstein@gmail.com> wrote:
I have a Mac OS X workstation and want to compile a cli for Linux (and potentially Windows) in addition to OS X. I could not find anything but https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. This has an explanation how I can build a cross compiling GHC for a specific combination of build and target system/architecture. Stack has an open issue regarding cross compilation.
Is that really all there is out there?
Cross-compilation pretty much only exists for porting ghc itself at this point. There are some hacks involving llvm that are used for ARM cross-compiling.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Sat, Nov 12, 2016 at 4:17 PM, Jan von Löwenstein < jan.loewenstein@gmail.com> wrote:
Glad that I am running on Mac, the other direction would be more difficult I suppose.
Impossible, legally, since you aren't licensed to install OS X headers and libraries even for cross-compilation on other OSes. You could generate object code (if you can work around not having OS includes, or you don't need them) but final link would need to be done on a Mac to comply with Apple licensing. (Well, since Apple uses dynamic linking exclusively, in theory someone could clean-room enough of a fake e.g. libSystem.dylib to enable cross-link without actually having any of its object code. Lot of work for dubious amount of gain, though, and the edge cases would be horrendous.) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Brandon Allbery
-
Jan von Löwenstein
-
Patrick Pelletier