
Hello! I want to bootstrap GHC on an exotic architecture and I have GCC-compatible compiler but miss cross-compiling toolchain. I was able to bootstrap Hugs98 (with manual fixes) and guys on IRC channel pointed me to GHC bootstrap articles: - https://elephly.net/posts/2017-01-09-bootstrapping-haskell-part-1.html - http://www.joachim-breitner.de/blog/748-Thoughts_on_bootstrapping_GHC which I read and plan to give it a try. I also read articles about cross-compiling GHC on Haskell wiki but the problem is complex so I don't know where to start. Are there anyone who has experience with GHC compiling (cross-compiling?) and bootstrap on new architectures who could possibly help me to solve the problem or describe the steps needed? -- With best regards, Igor Chudov

Indeed there are people here who can help with this. This is described in the articles you linked to but in short you want an unregistered build which compiles via the C backend.
Cheers,
- Ben
On July 22, 2019 4:48:32 AM EDT, Igor Chudov
Hello!
I want to bootstrap GHC on an exotic architecture and I have GCC-compatible compiler but miss cross-compiling toolchain. I was able to bootstrap Hugs98 (with manual fixes) and guys on IRC channel pointed me to GHC bootstrap articles:
- https://elephly.net/posts/2017-01-09-bootstrapping-haskell-part-1.html - http://www.joachim-breitner.de/blog/748-Thoughts_on_bootstrapping_GHC
which I read and plan to give it a try.
I also read articles about cross-compiling GHC on Haskell wiki but the problem is complex so I don't know where to start.
Are there anyone who has experience with GHC compiling (cross-compiling?) and bootstrap on new architectures who could possibly help me to solve the problem or describe the steps needed?
-- With best regards, Igor Chudov
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

Igor Chudov
Thanks, Ben!
I read old docs and found that it was mentioned that it's possible to start bootstrap with GHC 4.08.2 and HC files supplied. I performed "./configure && make" stage on x86_64 machine and moved sources to the desired machine (and successfully patched some files to work with exotic C compiler) but encountered
Oh dear; I missed the fact that you lack a cross-compiling toolchain. Things are much easier if you can cross-compile. Given your situation your approach is probably the best you can do. I have never done a native bootstrap like this and consequently have no idea what challenges lay in wait. It sounds like it may be a long road, however. Cheers, - Ben

IIRC another way to do this, which was and possibly still is used on ARM,
is to compile on the host with -fllvm, saving the LLVM IR output, and then
run opt on the target. This requires the target have an LLVM toolchain at
the same (or at least IR compatible, but note that they make few if any
guarantees about this) version as the host.
On Mon, Jul 22, 2019 at 9:52 AM Ben Gamari
Igor Chudov
writes: Thanks, Ben!
I read old docs and found that it was mentioned that it's possible to start bootstrap with GHC 4.08.2 and HC files supplied. I performed "./configure && make" stage on x86_64 machine and moved sources to the desired machine (and successfully patched some files to work with exotic C compiler) but encountered
Oh dear; I missed the fact that you lack a cross-compiling toolchain. Things are much easier if you can cross-compile.
Given your situation your approach is probably the best you can do. I have never done a native bootstrap like this and consequently have no idea what challenges lay in wait. It sounds like it may be a long road, however.
Cheers,
- Ben _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- brandon s allbery kf8nh allbery.b@gmail.com
participants (4)
-
Ben Gamari
-
Ben Gamari
-
Brandon Allbery
-
Igor Chudov