You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build GHC from source if bindist not available #4637
For a platform for which only older bindists exist, if a project's resolver requires a newer ghc, it would be good if stack could (have the option to) download ghc sources and build ghc from source, using the older available bindist for bootstrapping.
That would be an improvement, but I would also want a warning be presented to the user and then have the user choose to do the download,compile&install.
Issue #4567 also asks for the ability to build GHC from source. I'm leaning towards wishlisting both of these issues until someone steps up to contribute code to make this happen.
There's a PR too build from source at #4655. If and when that lands, I could imagine providing an argument to stack setup which would perform a source build.
#4655 has been merged to master, though it doesn't completely address this issue. I'm moving this request to this wishlist, if you're interested in working on this (or anyone else for that matter), please add a comment.
@barracuda156, based on this GHC wiki page (under 'ghc'), I understand your question is equivalent to: how to cross-compile GHC. This other GHC wiki page is devoted to that subject. I think cross-compiling GHC is (at least, currently) outside of the scope of the Stack project.
I do have an active interest in cross-compiling GHC, because I want to have it on Darwin PPC, and sequential native builds from 7.6.3 up is just madness, since the compiler is rather buggy and build is very fragile. So cross-compiling it from Intel appears more realistic. (To add insult to injury, he-he, upstream has broken the build on 10.6 Intel too, which is the last bi-arch OS and the one where cross-compiling would be somewhat less problematic.)
But as for “building from source”, I think GHC does not qualify, as of now. Self-dependency implies impossibility to build from sources. Majority of compilers can be built from sources only; specifically for Haskell, sadly, those are too archaic however.
Activity
mihaimaruseac commentedon Mar 19, 2019
That would be an improvement, but I would also want a warning be presented to the user and then have the user choose to do the download,compile&install.
notestaff commentedon Mar 19, 2019
Right, so where right now it just fails for lack of needed bindist, it would print “Rerun with —build-ghc-from-source if you want to do that”.
notestaff commentedon Mar 19, 2019
Maybe, eventually there could also be an option to upload the built bindist to some shared repository, from which others could download it?
mihaimaruseac commentedon Mar 19, 2019
That would be nice, but will open a can of worms labeled security and trust.
snoyberg commentedon Mar 25, 2019
Issue #4567 also asks for the ability to build GHC from source. I'm leaning towards wishlisting both of these issues until someone steps up to contribute code to make this happen.
snoyberg commentedon Mar 28, 2019
There's a PR too build from source at #4655. If and when that lands, I could imagine providing an argument to stack setup which would perform a source build.
snoyberg commentedon Apr 12, 2019
#4655 has been merged to master, though it doesn't completely address this issue. I'm moving this request to this wishlist, if you're interested in working on this (or anyone else for that matter), please add a comment.
barracuda156 commentedon Jun 6, 2023
@snoyberg How would you bypass a need for existing GHC? AFAIK it does not build with any compilers bootstrappable from C (like nhc98).
mpilgrem commentedon Jun 6, 2023
@barracuda156, based on this GHC wiki page (under 'ghc'), I understand your question is equivalent to: how to cross-compile GHC. This other GHC wiki page is devoted to that subject. I think cross-compiling GHC is (at least, currently) outside of the scope of the Stack project.
hasufell commentedon Jun 7, 2023
GHCup tries to support cross compilation. But the GHC build system is a constantly moving target and far from convenient for the casual end user.
barracuda156 commentedon Jun 7, 2023
I do have an active interest in cross-compiling GHC, because I want to have it on Darwin PPC, and sequential native builds from 7.6.3 up is just madness, since the compiler is rather buggy and build is very fragile. So cross-compiling it from Intel appears more realistic. (To add insult to injury, he-he, upstream has broken the build on 10.6 Intel too, which is the last bi-arch OS and the one where cross-compiling would be somewhat less problematic.)
But as for “building from source”, I think GHC does not qualify, as of now. Self-dependency implies impossibility to build from sources. Majority of compilers can be built from sources only; specifically for Haskell, sadly, those are too archaic however.