<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><div class="">Joachim Breitner's veggies(<a href="https://github.com/nomeata/veggies" class="">https://github.com/nomeata/veggies</a>) project is a good example of using a vanilla ghc installation to compile standard libraries like base.</div></blockquote><div class="">Thanks Cheng, this looks interesting and helpful! I'm still trying to understand it fully, but it seems like the important pieces for building base are in the boot and Setup scripts?</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class="">The problem here is that you're using a stage 1 build, and stage 1 lacks support for the bytecode backend used by TH, plugins, ghci, etc. A base build with a stage 2 compiler should work.</div></blockquote>Thanks Brandon. Is there a recommended/documented way to build base with a stage 2 compiler? I haven't been able to find anything about this on the wiki. </div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 3, 2018, at 11:10 PM, Brandon Allbery <<a href="mailto:allbery.b@gmail.com" class="">allbery.b@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">The problem here is that you're using a stage 1 build, and stage 1 lacks support for the bytecode backend used by TH, plugins, ghci, etc. A base build with a stage 2 compiler should work.</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Dec 3, 2018 at 9:11 PM Bill Hallahan <<a href="mailto:william.hallahan@yale.edu" class="">william.hallahan@yale.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi,<div class=""><br class=""></div><div class="">I'm writing a program analyzer that operates on GHC Core. Currently, I'm using the GHC API to get Core from .hs files. I'd like to be able to run this analysis on the standard libraries that come with GHC, which requires getting those as Core.</div><div class=""><br class=""></div><div class="">Unfortunately, the build process for these libraries is not entirely straightforward, and relies on a make script. I eventually came up with the plan of writing a GHC plugin, which, rather than performing any optimizations, would simply run the analysis, and then print the results out to a file. I was able to write the plugin successfully, and test it on several files that were <i class="">not</i> from the base library.</div><div class=""><br class=""></div><div class="">Then, i turned to modify the GhcLibHcOpts flag in mk/<a href="http://build.mk/" target="_blank" class="">build.mk</a>, so that the make script would call the plugin. I ended up with the following:</div><div class=""><br class=""></div><div class="">GhcLibHcOpts = -package-db /usr/local/lib/ghc-8.0.2/package.conf.d -package-db /Users/BillHallahan/.ghc/x86_64-darwin-8.0.2/package.conf.d -package hplugin -fplugin HPlugin.Plugin -v</div><div class=""><br class=""></div><div class="">The two package databases are to get to (1) the GHC API and (2) the plugin ("hplugin") itself. With this I get an error message, which I have not been able to find a way to resolve:</div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">"inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H32m -O -Wall -this-unit-id ghc-prim-0.5.0.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/. -optP-include -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package-id rts -this-unit-id ghc-prim -XHaskell2010 -package-db /usr/local/lib/ghc-8.0.2/package.conf.d -package-db /Users/BillHallahan/.ghc/x86_64-darwin-8.0.2/package.conf.d -package hplugin -fplugin HPlugin.Plugin -no-user-package-db -rtsopts -Wno-trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build -split-objs -dynamic-too -c libraries/ghc-prim/./GHC/Types.hs -o libraries/ghc-prim/dist-install/build/GHC/Types.o -dyno libraries/ghc-prim/dist-install/build/GHC/Types.dyn_o</span></div><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><command line>: not built for interactive use - can't load plugins (HPlugin.Plugin)</span></div><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/Types.o] Error 1</span></div><div style="margin:0px;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">make: *** [all] Error 2</span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div></div></div><div class="">So I'm now wondering (an answer to either of these two questions would be helpful):</div><div class="">(1) Is this a viable path? That is, is it possible to use a plugin when building Base? If so, does anyone know what I might be doing wrong/what could be causing this error message?</div><div class="">(2) Is there some other better/easier way I could get Core representations of the standard libraries? I guess, in theory, it must be possible to compile the standard libraries with the GHC API, but I have no idea how/where to look to figure out how?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Bill</div></div>_______________________________________________<br class="">
ghc-devs mailing list<br class="">
<a href="mailto:ghc-devs@haskell.org" target="_blank" class="">ghc-devs@haskell.org</a><br class="">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br class="">
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">brandon s allbery kf8nh</div><div class=""><a href="mailto:allbery.b@gmail.com" target="_blank" class="">allbery.b@gmail.com</a></div></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>