-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-compile for ARM processors support #1332
Comments
There's a GHC Linux ARM bindist, it shouldn't take much to support it. Aside from |
I was tried before to build cross-compiler, i.e. building GHC on Windows to build ARM builds. But without much success. That is way it would be great if there is easier way for using Haskell on ARM. This will open the door for using Haskell in Embedded systems more easily. |
We may someday support cross-compiling, but that day isn't here yet. I've put this in the "Future" milestone to keep track of the idea. |
Thank you! |
Have you tried the GHC Linux ARM bindist I mentioned |
I decided to try the approach suggested by @borsboom and I couldn't get |
That is unfortunate. I'd suggest filing an issue upstream to see if |
Technically, flags aren't supposed to change the API. However, this isn't necessarily what's actually done in practice, and stack does make it reasonable to add and use a manual flag for this purpose. |
@borsboom, I succeeded to build from sources easily GHC 7.10.2, so it is buildable on ARM v7. There is also cabal-install 1.20, too. Here you could see some ready packages for ARM: I think if it is possible to build stack on top of that? |
Haven't tried to figure out cross-compiler but Docker / Static QEMU combo seems to work for a few arm projects. E.g. here's my 'platform' launcher script, hope this helps: |
I have the same problem with cryptonite when attempting to install stack on ARM. This is really sad because stack would make development on ARM so much more tolerable as compiling is so slow that cabal-sandboxes for each project can really suck a lot of time out of you. I have recently gotten GHC working on various ARM things, and have even gotten a cross compiler to (sort of) work with template Haskell. This has been documented in a blog post here: https://haskellembedded.github.io/posts/2015-12-15-arm.html if anybody is having trouble with GHC on ARMv7 then feel free to contact me (@Chobbez on twitter, Chobbes on freenode - come join #haskell-embedded maybe!) There are some problems with cross-compilation involving template Haskell and FFI stuff. I have gotten template Haskell to work in a cross compiler by using binfmt_misc to transparently execute any ARM template Haskell with qemu-arm. I'm currently looking into the FFI issues that I'm having with the cross-compiler, if anybody has any suggestions they would be greatly appreciated. Additionally I am willing to put in work to get Stack working in some fashion for ARM development, because this is something that I desire greatly! @andreyk0 how have you managed to install Stack on ARM with the issue that @asakeron mentioned? Is it just an x86 / x86_64 stack that calls an ARM GHC? |
@Chobbes I never actually ran it on the ARM boards, only via static QEMU(2.4.1)/Docker(1.9.1). Here's my stack-0.1.10.0-Arm.gz binary, uploaded as a GH gist, if that helps. Build process crashes / hangs occasionally but I'm sure QEMU bugs are responsible for some of that, it's a bit better with 2.4.1 than with the earlier versions I've tried. Generated binaries seem Ok/stable on debian stretch, cortex-a8 A10 Olinuxino Lime board. |
Do you use LLVM 3.5.2+ ? 2015-12-19 2:59 GMT+02:00 Andrey Kartashov [email protected]:
|
@varosi yeah, LLVM 3.5.2, available from package manager in debian stretch. |
👍 |
For what it's worth, I've written a guide on how I got a stack based project build on an Raspberry Pi, hopefully it's useful for somebody stumbling on this thread: |
Great-great! Will there be ARM distros of Stack officially? |
We don't intend to have official stack support for archs that don't have official ghc binary distributions. |
@mgsloan is this not considered official? https://www.haskell.org/ghc/download_ghc_7_10_3#linux_armv7 |
Oh, yeah, you're right! Ok, yeah it'd be reasonable to add support in stack, then, if all the details get worked out. |
See #2103 for the issue tracking adding ARM as an official platform for Stack, which we very much hope to do. This is distinct from cross-compiling for ARM, which is more complex and will need general support in Stack for cross-compiling. The main obstacle is a solution to the LLVM problem (like Stack also managing installation much like it manages GHC's) to have a decent user experience. Unfortunately, the current LLVM bindists don't seem to work on Scaleway's ARM VPS so I haven't made any headway on this. |
@blitzcode, now it doesn't compile on ARMv7, because of: haskell-crypto/cryptonite#90 cryptonite is a dependency of Stack |
That's an unfortunate regression, hope it'll be fixed soon. Might need to change stack to pin to an older version for now. Wish I could build stack with stack for more reproducible builds ;-) |
Yes, but it compiles with cryptonite-0.15 so it may be constrained. |
Replied in #2103 |
Is it possible to use the cross-compilers at http://hackage.mobilehaskell.org/ and the overlay somehow with stack? |
With LLVM backends this should be relatively easy to do right? Is there a place I can start to make this work? |
Any option for arm appears to be disabled in the stack install script |
Is there any update on this? I've been cross-compiling to ARMv6 and ARMv7 from my x86_64 desktop computer using Haskell.nix and Cabal for some time now without issues (at least, without any issue that could not be quickly fixed). So I guess there should be less technical barriers today. Having it in Stack would be great and maybe less cumbersome for newcomers than having to install Nix :-) |
Asking for an update myself as well. What's needed to be able to target arm devices using stack? Is there a way to make it work today? Thanks. |
Do someone thought about to include ARM based compilation support for Stack?
That way Haskell will become even more portable.
The text was updated successfully, but these errors were encountered: