Skip to content
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

build GHC from source if bindist not available #4637

Closed
notestaff opened this issue Mar 18, 2019 · 11 comments
Closed

build GHC from source if bindist not available #4637

notestaff opened this issue Mar 18, 2019 · 11 comments

Comments

@notestaff
Copy link

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.

@mihaimaruseac
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

Maybe, eventually there could also be an option to upload the built bindist to some shared repository, from which others could download it?

@mihaimaruseac
Copy link
Contributor

That would be nice, but will open a can of worms labeled security and trust.

@snoyberg
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

#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
Copy link

@snoyberg How would you bypass a need for existing GHC? AFAIK it does not build with any compilers bootstrappable from C (like nhc98).

@mpilgrem
Copy link
Member

mpilgrem commented 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
Copy link
Contributor

hasufell commented 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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants