<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">Am 24.10.2017 um 20:02 schrieb Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" class="">moritz.angermann@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi *,<br class=""><br class="">so I've given this a stab[1]. While getting the wrapper requirement,<br class="">and the .conf files sorted was rather easy. (We already have getExecutablePath,<br class="">and the relocatable logic for windows. As well as $topdir and ${pkgroot} <br class="">support for paths in .conf files.)<br class=""></div></div></blockquote><div><br class=""></div>Awesome!</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div class="">Now as Manuel laid out the dynamic libraries situation is a bit annoying.<br class="">Specifically as the ghc-stage2 we build *in-tree*, and the libraries have<br class="">a completely different layout from the final install location. And as such<br class="">setting @rpath, and @loader_path, is quite tricky, as essentially the<br class="">installation is not a relocation of the stage1 or stage2 compiler.<br class=""></div></div></blockquote><div><br class=""></div>Yes, that’s why I took the hacky short-cut of running the normal install procedure and then patching the libs up in place with ’install_name_tool’. (BTW, a not too widely known tool that makes messing with dylibs, RPATHs, and signatures way nicer than otool is <<a href="http://newosxbook.com/tools/jtool.html" class="">http://newosxbook.com/tools/jtool.html</a>> — the output is so much more readable.)</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div class="">However, I am now again at the point where I start hacking on the build<br class="">system, while Hadrian is imminent. And this is quite depressing.<br class=""></div></div></blockquote><div><br class=""></div>I hear you.</div><div><br class=""></div><div>Cheers,</div><div>Manuel</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div class="">Cheers,<br class=""> Moritz<br class=""><br class="">--<br class="">[1]: <a href="https://phabricator.haskell.org/D4121" class="">https://phabricator.haskell.org/D4121</a><br class=""><blockquote type="cite" class="">On Oct 24, 2017, at 9:54 AM, Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" class="">moritz.angermann@gmail.com</a>> wrote:<br class=""><br class="">Hi Manuel,<br class=""><br class="">thanks for the link! Ahh yes lovely RPATH (this reminds me, I should look<br class="">to verify if I can make GHC link recursively.) The conf files came up on<br class="">#ghc yesterday as well. Maybe we need some $home, $sysroot or similar marker<br class="">to make them relocatable.<br class=""><br class="">I'll probably take a crack at this today. Not sure how far I get though.<br class="">The primary motivation is that packaging the cross compilers in a neat<br class="">way looks like layering patched upon patches onto the configure script. And<br class="">in light of Hadrian, we might just want to package up a directory and not<br class="">deal with the binary-dist logic where we can?<br class=""><br class="">Cheers,<br class="">Moritz<br class=""><br class=""><blockquote type="cite" class="">On Oct 24, 2017, at 9:45 AM, Manuel M T Chakravarty <<a href="mailto:chak@justtesting.org" class="">chak@justtesting.org</a>> wrote:<br class=""><br class="">Hi Moritz,<br class=""><br class="">Haskell for Mac is fully relocatable (as every Mac users expects this of a Mac app).<br class=""><br class="">Unfortunately, it is not just the libdir in the wrapper scripts that’s in the way of a relocatable GHC. Additional problems are (1) the (at least, as of 8.0) still not macOS-friendly RPATHs in dynamic libraries and (2) the absolute paths in package .conf files.<br class=""><br class="">In Haskell for Mac, I use two arguably hacky solutions to those two issues. I rewrite all RPATHs in .dylibs to be relative and I have got a little tool that relocates .conf files. I’d certainly prefer a cleaner solution!<br class=""><br class="">Those aspects of Haskell for Mac are actually in a separate framework (GHC.framework) that wraps GHC and some other tools. This is all in a public repo if you like to have a look<br class=""><br class=""> <a href="https://github.com/haskellformac/GHCframework" class="">https://github.com/haskellformac/GHCframework</a><br class=""><br class="">I haven’t put a license on it, but I’d be happy to make it all BSD3. It is of course all highly Mac specific and requires Xcode to build for all the code signing, sandboxing, etc.<br class=""><br class="">Cheers,<br class="">Manuel<br class=""><br class=""><blockquote type="cite" class="">Am 23.10.2017 um 17:04 schrieb Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" class="">moritz.angermann@gmail.com</a>>:<br class=""><br class="">Hi,<br class=""><br class="">while trying to make the binary-distribution logic work for<br class="">cross compilers. I've come wonder, how hard it could be to<br class="">make GHC relocatable. (e.g. just unpack the distribution, <br class="">and use the compiler from the `bin` folder within).<br class=""><br class="">Right now this does not work due to the need for the path to<br class="">package.conf, and this is hardcoded in the wrapper script to<br class="">provide the proper libdir to ghc via -B[1]. Supposedly this<br class="">is not an issue on Windows, as a relative path is common on<br class="">windows and finding the location of the executable can be done<br class="">safely. Or that's at least how I understand[1].<br class=""><br class="">For macOS there is the haskell-platform, and ghc-dot-app[2]<br class=""><br class="">From [3], it sounds like automake is a build, and not a packaging<br class="">system, and the binary dist usecase with configure is not<br class="">really a standard use case.<br class=""><br class="">So why do I bring this up NOW? Apart from me trying to make<br class="">cross compiler binary distributions working? The reason is<br class="">that we are also trying to move towards hadrian, and by "starting<br class="">from scratch", maybe we have a chance to reconsider how we<br class="">do things?<br class=""><br class="">I must admit, I'm quite happy to use packages like llvm, by<br class="">just downloading a package and adding the `bin` path to my<br class="">$PATH.<br class=""><br class="">There is however one thing that the current configure appraoch<br class="">does, which I think is quite noteworthy (apart from setting<br class="">$prefix). That is, it does check for compilers and sets them<br class="">accordingly, which might be desirable.<br class=""><br class="">Cheers,<br class="">Moritz<br class=""><br class="">--<br class="">[1]: <a href="https://ghc.haskell.org/trac/ghc/wiki/Building/Installing" class="">https://ghc.haskell.org/trac/ghc/wiki/Building/Installing</a><br class="">[2]: <a href="https://ghc.haskell.org/trac/ghc/wiki/Building/MacOSX/Installer" class="">https://ghc.haskell.org/trac/ghc/wiki/Building/MacOSX/Installer</a><br class="">[3]: <a href="https://lists.gnu.org/archive/html/automake/2006-10/msg00005.html" class="">https://lists.gnu.org/archive/html/automake/2006-10/msg00005.html</a><br class="">_______________________________________________<br class="">ghc-devs mailing list<br class=""><a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br class=""></blockquote><br class=""></blockquote><br class="">_______________________________________________<br class="">ghc-devs mailing list<br class=""><a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></body></html>