snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 39 forks source link

rts: buggy handling of non-trivial dynamic flavours of the library #695

Closed alpmestan closed 5 years ago

alpmestan commented 5 years ago

It turns out hadrian can produce any flavour we want of the RTS library, but Cabal just won't see them as its code just expects one shared lib, for the "just dynamic" way. This in particular keeps us from building the stage 2 GHC with -dynamic, like the make build system does, at least whenever we build a flavour that contains at least one dynamic-enabled way. Why? Because the stage 2 GHC is also meant to be built with -threaded, 99% of the time, which requires the thr_dyn way of the RTS library, that Cabal doesn't install.

I have a Cabal patch that adds extra-dynamic-library-flavours, which seemed like the least bad solution when I discussed this problem with @hvr. See https://github.com/haskell/cabal/pull/5606.

This then of course also requires a change to rts.cabal.in:

diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 76fd353134..9c95fbb342 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -39,6 +39,8 @@ flag debug
   default: False
 flag logging
   default: False
+flag dynamic
+  default: False

 library
     -- rts is a wired in package and
@@ -65,8 +67,14 @@ library
         extra-library-flavours: _debug_p _thr_debug_p
     if flag(debug)
       extra-library-flavours: _debug _thr_debug
+      if flag(dynamic)
+        extra-dynamic-library-flavours: _debug _thr_debug
     if flag(logging)
       extra-library-flavours: _l _thr_l
+      if flag(dynamic)
+        extra-dynamic-library-flavours: _l _thr_l
+    if flag(dynamic)
+      extra-dynamic-library-flavours: _thr

     exposed: True
     exposed-modules:

that I will submit to GHC, along with a Cabal submodule bump, once I get the feature merged in Cabal.

Finally, I have some hadrian patch here that makes use of that new dynamic flag. The result is that with all those elements, we not only produce all the dynamic ways we want, as before, but Cabal sees them and installs them all in the package database, unlike before.

@DavidEichmann and I stumbled upon this problem while investigating a test failure, where David noticed the "GHC Dynamic" bit of the ghc --info output differed between hadrian built GHCs and make built GHCs. On top of all those patches he will submit a PR that builds GHC with -dynamic whenever we're building a flavour that contains one dynamic-enabled way, or something along those lines.

snowleopard commented 5 years ago

@alpmestan Thanks a lot! This all sounds good to me, although it feels a bit strange that the dynamic way is treated specially. For example, are we going to also need extra-profiling-library-flavours later?

Hope all three patches (Cabal, GHC and Hadrian) will land soon!

alpmestan commented 5 years ago

No, dynamic is special because it yields shared libs. Profiled libraries can be either static or dynamic, so we're never going to need some special support as long as extra[-dynamic]-library-flavours let us get non-trivial flavours of static or shared libraries.

I'm not ecstatic about this solution but it was either that or keep just extra-library-flavours and treat anything with dyn it in in a special way. That was judged too hacky, which is why I went for the new field.

angerman commented 5 years ago

omg. what box have I opened with extra-library-flavours. @snowleopard I doubt we'll need specialization for profiling. From a systems perspective there are only static and dynamic libraries; where the extra-library-flavours was mostly concerned with allowing multiple static libraries in a cabal package (without cabal knowing how to actually build those libraries).

alpmestan commented 5 years ago

Eventually, I suppose some of hadrian's logic for building object files for many complex flavours could be carried over in Cabal, and then we would have a nicer approach to ask for a bunch of ways to be built. What's a little troubling is that this is only ever going to be useful for libHSrts, since any other Haskell library ever only comes in vanilla, profiled or dynamic(/shared) flavour, they just don't have any other flavour to offer.

Would it make sense to generalize this notion of flavour so that not only libHSrts could offer its current menu of flavours to its customers, but other libraries could perhaps make use of this too? I don't know. All I know right now is that without the Cabal patch above, we simply can't have both sentences be true:

snowleopard commented 5 years ago

@alpmestan @angerman Thank you! It makes sense to me now. Let's go ahead with the proposed solution. I guess other libraries might start building various flavours once this is supported and documented.

DavidEichmann commented 5 years ago

When doing a clean hadrian build (flavour=quick) from my branch (https://github.com/DavidEichmann/ghc/commit/b7ca1a1413dd1a6f369f6fbd652182fc94b73474), I see that the GenericPackageDescription for the rts has extra-lib-flavours, but no extra-dyn-lib-flavours. I added debug output to Hadrian.Haskell.Cabal.Parser.resolveContextData:

when (package == rts) . liftIO . putStrLn $ " @@@ generic condLibrary: " ++ show (C.condLibrary gpd)

And got the output:

``` | ContextData oracle: resolving data for 'rts' (Stage1, dyn)... @@@ generic condLibrary: Just (CondNode { condTreeData = Library { ... extraLibFlavours = ["_thr"], extraDynLibFlavours = [], ... options = [(GHC, ["-this-unit-id","rts"])], } }, ...) ``` ``` | ContextData oracle: resolving data for 'rts' (Stage1, dyn)... @@@ generic condLibrary: Just (CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = ["Apply.cmm","Compact.cmm","Exception.cmm","HeapStackCheck.cmm","PrimOps.cmm","StgMiscClosures.cmm","StgStartup.cmm","StgStdThunks.cmm","Updates.cmm","AutoApply.cmm"], cSources = ["Adjustor.c","Arena.c","Capability.c","CheckUnload.c","ClosureFlags.c","Disassembler.c","FileLock.c","Globals.c","Hash.c","Heap.c","Hpc.c","HsFFI.c","Inlines.c","Interpreter.c","LdvProfile.c","Libdw.c","LibdwPool.c","Linker.c","Messages.c","OldARMAtomic.c","PathUtils.c","Pool.c","Printer.c","ProfHeap.c","ProfilerReport.c","ProfilerReportJson.c","Profiling.c","Proftimer.c","RaiseAsync.c","RetainerProfile.c","RetainerSet.c","RtsAPI.c","RtsDllMain.c","RtsFlags.c","RtsMain.c","RtsMessages.c","RtsStartup.c","RtsSymbolInfo.c","RtsSymbols.c","RtsUtils.c","STM.c","Schedule.c","Sparks.c","StableName.c","StablePtr.c","StaticPtrTable.c","Stats.c","StgCRun.c","StgPrimFloat.c","Task.c","ThreadLabels.c","ThreadPaused.c","Threads.c","Ticky.c","Timer.c","TopHandler.c","Trace.c","WSDeque.c","Weak.c","eventlog/EventLog.c","eventlog/EventLogWriter.c","hooks/FlagDefaults.c","hooks/LongGCSync.c","hooks/MallocFail.c","hooks/OnExit.c","hooks/OutOfHeap.c","hooks/StackOverflow.c","linker/CacheFlush.c","linker/Elf.c","linker/LoadArchive.c","linker/M32Alloc.c","linker/MachO.c","linker/PEi386.c","linker/SymbolExtras.c","linker/elf_got.c","linker/elf_plt.c","linker/elf_plt_aarch64.c","linker/elf_plt_arm.c","linker/elf_reloc.c","linker/elf_reloc_aarch64.c","linker/elf_util.c","sm/BlockAlloc.c","sm/CNF.c","sm/Compact.c","sm/Evac.c","sm/Evac_thr.c","sm/GC.c","sm/GCAux.c","sm/GCUtils.c","sm/MBlock.c","sm/MarkWeak.c","sm/Sanity.c","sm/Scav.c","sm/Scav_thr.c","sm/Storage.c","sm/Sweep.c","xxhash.c","fs.c"], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = ["_thr"], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = ["build","../includes","includes","includes/dist-derivedconstants/header"], includes = ["Stg.h"], installIncludes = ["Cmm.h","HsFFI.h","MachDeps.h","Rts.h","RtsAPI.h","Stg.h","ghcautoconf.h","ghcconfig.h","ghcplatform.h","ghcversion.h","DerivedConstants.h","ffi.h","ffitarget.h","rts/Adjustor.h","rts/BlockSignals.h","rts/Bytecodes.h","rts/Config.h","rts/Constants.h","rts/EventLogFormat.h","rts/EventLogWriter.h","rts/FileLock.h","rts/Flags.h","rts/GetTime.h","rts/Globals.h","rts/Hpc.h","rts/IOManager.h","rts/Libdw.h","rts/LibdwPool.h","rts/Linker.h","rts/Main.h","rts/Messages.h","rts/OSThreads.h","rts/Parallel.h","rts/PrimFloat.h","rts/Profiling.h","rts/Signals.h","rts/SpinLock.h","rts/StableName.h","rts/StablePtr.h","rts/StaticPtrTable.h","rts/TTY.h","rts/Threads.h","rts/Ticky.h","rts/Time.h","rts/Timer.h","rts/Types.h","rts/Utils.h","rts/prof/CCS.h","rts/prof/LDV.h","rts/storage/Block.h","rts/storage/ClosureMacros.h","rts/storage/ClosureTypes.h","rts/storage/Closures.h","rts/storage/FunTypes.h","rts/storage/Heap.h","rts/storage/GC.h","rts/storage/InfoTables.h","rts/storage/MBlock.h","rts/storage/TSO.h","stg/DLL.h","stg/HaskellMachRegs.h","stg/MachRegs.h","stg/MiscClosures.h","stg/Prim.h","stg/Regs.h","stg/RtsMachRegs.h","stg/SMP.h","stg/Ticky.h","stg/Types.h"], options = [(GHC,["-this-unit-id","rts"])], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = Var (OS Windows), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = ["Cffi-6"], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just (CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = ["Cffi"], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []})},CondBranch {condBranchCondition = Var (Flag (FlagName "profiling")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = ["_p","_thr_p"], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = Var (Flag (FlagName "debug")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = ["_debug_p","_thr_debug_p"], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "debug")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = ["_debug","_thr_debug"], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = Var (Flag (FlagName "dynamic")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "logging")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = ["_l","_thr_l"], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = Var (Flag (FlagName "dynamic")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "dynamic")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "libm")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["m"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "librt")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["rt"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "libdl")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["dl"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "ffi")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["ffi"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (OS Windows), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["wsock32","gdi32","winmm","dbghelp","psapi"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "need-pthread")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["pthread"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "libbfd")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["bfd","iberty"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "mingwex")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["mingwex"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "libdw")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["elf","dw"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "libnuma")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = ["numa"], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = CNot (Var (Flag (FlagName "smp"))), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = ["-DNOSMP"], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "64bit")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = Var (Flag (FlagName "leading-underscore")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-Wl,-u,_hs_atomic_add64","-Wl,-u,_hs_atomic_sub64","-Wl,-u,_hs_atomic_and64","-Wl,-u,_hs_atomic_nand64","-Wl,-u,_hs_atomic_or64","-Wl,-u,_hs_atomic_xor64","-Wl,-u,_hs_cmpxchg64","-Wl,-u,_hs_atomicread64","-Wl,-u,_hs_atomicwrite64"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just (CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-Wl,-u,hs_atomic_add64","-Wl,-u,hs_atomic_sub64","-Wl,-u,hs_atomic_and64","-Wl,-u,hs_atomic_nand64","-Wl,-u,hs_atomic_or64","-Wl,-u,hs_atomic_xor64","-Wl,-u,hs_cmpxchg64","-Wl,-u,hs_atomicread64","-Wl,-u,hs_atomicwrite64"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []})}]}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (Flag (FlagName "leading-underscore")), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-Wl,-u,_base_GHCziTopHandler_runIO_closure","-Wl,-u,_base_GHCziTopHandler_runNonIO_closure","-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure","-Wl,-u,_ghczmprim_GHCziTypes_True_closure","-Wl,-u,_ghczmprim_GHCziTypes_False_closure","-Wl,-u,_base_GHCziPack_unpackCString_closure","-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure","-Wl,-u,_base_GHCziIOziException_stackOverflow_closure","-Wl,-u,_base_GHCziIOziException_heapOverflow_closure","-Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure","-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure","-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure","-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure","-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure","-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure","-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure","-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure","-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure","-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure","-Wl,-u,_base_GHCziConcziSync_runSparks_closure","-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure","-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure","-Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure","-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure","-Wl,-u,_base_GHCziTopHandler_runMainIO_closure","-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info","-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info","-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info","-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info","-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info","-Wl,-u,_base_GHCziPtr_Ptr_con_info","-Wl,-u,_base_GHCziPtr_FunPtr_con_info","-Wl,-u,_base_GHCziInt_I8zh_con_info","-Wl,-u,_base_GHCziInt_I16zh_con_info","-Wl,-u,_base_GHCziInt_I32zh_con_info","-Wl,-u,_base_GHCziInt_I64zh_con_info","-Wl,-u,_base_GHCziWord_W8zh_con_info","-Wl,-u,_base_GHCziWord_W16zh_con_info","-Wl,-u,_base_GHCziWord_W32zh_con_info","-Wl,-u,_base_GHCziWord_W64zh_con_info","-Wl,-u,_base_GHCziStable_StablePtr_con_info","-Wl,-u,_hs_atomic_add8","-Wl,-u,_hs_atomic_add16","-Wl,-u,_hs_atomic_add32","-Wl,-u,_hs_atomic_sub8","-Wl,-u,_hs_atomic_sub16","-Wl,-u,_hs_atomic_sub32","-Wl,-u,_hs_atomic_and8","-Wl,-u,_hs_atomic_and16","-Wl,-u,_hs_atomic_and32","-Wl,-u,_hs_atomic_nand8","-Wl,-u,_hs_atomic_nand16","-Wl,-u,_hs_atomic_nand32","-Wl,-u,_hs_atomic_or8","-Wl,-u,_hs_atomic_or16","-Wl,-u,_hs_atomic_or32","-Wl,-u,_hs_atomic_xor8","-Wl,-u,_hs_atomic_xor16","-Wl,-u,_hs_atomic_xor32","-Wl,-u,_hs_cmpxchg8","-Wl,-u,_hs_cmpxchg16","-Wl,-u,_hs_cmpxchg32","-Wl,-u,_hs_atomicread8","-Wl,-u,_hs_atomicread16","-Wl,-u,_hs_atomicread32","-Wl,-u,_hs_atomicwrite8","-Wl,-u,_hs_atomicwrite16","-Wl,-u,_hs_atomicwrite32","-Wl,-u,_findPtr"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just (CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-Wl,-u,base_GHCziTopHandler_runIO_closure","-Wl,-u,base_GHCziTopHandler_runNonIO_closure","-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure","-Wl,-u,ghczmprim_GHCziTypes_True_closure","-Wl,-u,ghczmprim_GHCziTypes_False_closure","-Wl,-u,base_GHCziPack_unpackCString_closure","-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure","-Wl,-u,base_GHCziIOziException_stackOverflow_closure","-Wl,-u,base_GHCziIOziException_heapOverflow_closure","-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure","-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure","-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure","-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure","-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure","-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure","-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure","-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure","-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure","-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure","-Wl,-u,base_GHCziConcziSync_runSparks_closure","-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure","-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure","-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure","-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure","-Wl,-u,base_GHCziTopHandler_runMainIO_closure","-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info","-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info","-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info","-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info","-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info","-Wl,-u,base_GHCziPtr_Ptr_con_info","-Wl,-u,base_GHCziPtr_FunPtr_con_info","-Wl,-u,base_GHCziInt_I8zh_con_info","-Wl,-u,base_GHCziInt_I16zh_con_info","-Wl,-u,base_GHCziInt_I32zh_con_info","-Wl,-u,base_GHCziInt_I64zh_con_info","-Wl,-u,base_GHCziWord_W8zh_con_info","-Wl,-u,base_GHCziWord_W16zh_con_info","-Wl,-u,base_GHCziWord_W32zh_con_info","-Wl,-u,base_GHCziWord_W64zh_con_info","-Wl,-u,base_GHCziStable_StablePtr_con_info","-Wl,-u,hs_atomic_add8","-Wl,-u,hs_atomic_add16","-Wl,-u,hs_atomic_add32","-Wl,-u,hs_atomic_sub8","-Wl,-u,hs_atomic_sub16","-Wl,-u,hs_atomic_sub32","-Wl,-u,hs_atomic_and8","-Wl,-u,hs_atomic_and16","-Wl,-u,hs_atomic_and32","-Wl,-u,hs_atomic_nand8","-Wl,-u,hs_atomic_nand16","-Wl,-u,hs_atomic_nand32","-Wl,-u,hs_atomic_or8","-Wl,-u,hs_atomic_or16","-Wl,-u,hs_atomic_or32","-Wl,-u,hs_atomic_xor8","-Wl,-u,hs_atomic_xor16","-Wl,-u,hs_atomic_xor32","-Wl,-u,hs_cmpxchg8","-Wl,-u,hs_cmpxchg16","-Wl,-u,hs_cmpxchg32","-Wl,-u,hs_atomicread8","-Wl,-u,hs_atomicread16","-Wl,-u,hs_atomicread32","-Wl,-u,hs_atomicwrite8","-Wl,-u,hs_atomicwrite16","-Wl,-u,hs_atomicwrite32","-Wl,-u,findPtr"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []})},CondBranch {condBranchCondition = Var (OS OSX), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-Wl,-search_paths_first"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = [CondBranch {condBranchCondition = CNot (Var (Arch X86_64)), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = ["-read_only_relocs","warning"], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = COr (COr (Var (Arch I386)) (Var (Arch (OtherArch "powerpc")))) (Var (Arch (OtherArch "powerpc64"))), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = ["AdjustorAsm.S"], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = COr (COr (Var (Arch (OtherArch "powerpc"))) (Var (Arch (OtherArch "powerpc64")))) (Var (Arch (OtherArch "powerpc64le"))), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = ["StgCRunAsm.S"], cmmSources = [], cSources = [], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing},CondBranch {condBranchCondition = Var (OS Windows), condBranchIfTrue = CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = ["win32/AsyncIO.c","win32/AwaitEvent.c","win32/ConsoleHandler.c","win32/GetEnv.c","win32/GetTime.c","win32/IOManager.c","win32/OSMem.c","win32/OSThreads.c","win32/ThrIOManager.c","win32/Ticker.c","win32/WorkQueue.c","win32/veh_excn.c"], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just (CondNode {condTreeData = Library {libName = Nothing, exposedModules = [], reexportedModules = [], signatures = [], libExposed = True, libBuildInfo = BuildInfo {buildable = True, buildTools = [], buildToolDepends = [], cppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], extraFrameworkDirs = [], asmSources = [], cmmSources = [], cSources = ["posix/GetEnv.c","posix/GetTime.c","posix/Itimer.c","posix/OSMem.c","posix/OSThreads.c","posix/Select.c","posix/Signals.c","posix/TTY.c"], cxxSources = [], jsSources = [], hsSourceDirs = [], otherModules = [], virtualModules = [], autogenModules = [], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraGHCiLibs = [], extraBundledLibs = [], extraLibFlavours = [], extraDynLibFlavours = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [], profOptions = [], sharedOptions = [], staticOptions = [], customFieldsBI = [], targetBuildDepends = [], mixins = []}}, condTreeConstraints = [], condTreeComponents = []})}]}) ```
snowleopard commented 5 years ago

@DavidEichmann Perhaps, we haven't yet implemented the new parsing functionality for extra-dyn-lib-flavours in Hadrian?

I think the relevant function is:

https://github.com/snowleopard/hadrian/blob/master/src/Hadrian/Haskell/Cabal/Parse.hs#L173

alpmestan commented 5 years ago

Yes we've been looking at this function, but I personally fail to understand why things go fine for extraLibFlavours but not extraDynLibFlavours. Why one is preserved but not the other. It was all working fine before I rebased and got the last few commits (among which the caching ones?), so this is quite confusing.

alpmestan commented 5 years ago

@DavidEichmann This output is expected. This is "by default", without taking into account all the flags etc. In particular, you can notice how extraLibFlavours only has _thr while we in fact end up building and even installing a lot more static flavours than that. _thr is there because we always build at least vanilla + threaded static libs for the RTS, whatever the flavour. On the other hand, the dyn lib flavours is empty because by default we don't want to produce any shared lib, only when the dynamic cabal flag is passed when configuring the rts lib. Makes sense? So we need to look further down the road. At some point, extraLibFlavours will be augmented with loads of things, and, quite likely, extraDynLibFlavours won't, I suppose?

snowleopard commented 5 years ago

@alpmestan Actually, it appears that we don't even record anything flavour-related in ContextData:

https://github.com/snowleopard/hadrian/blob/master/src/Hadrian/Haskell/Cabal/Type.hs#L40

Should we? If rts.cabal contains this information, then maybe we need to parse it and put into ContextData.extraLibFlavours or something like that?

alpmestan commented 5 years ago

Yeah maybe. Yet, it still works for static library flavours (extraLibFlavours field in Cabal's BuildInfo type), even though we don't have that information in ContextData. So there's something odd going on, we're completely missing a piece of the puzzle, and we definitely need to figure it out. It is not completely crazy to think that even if we were storing that data in ContextData, we still would not get Cabal to install our extra dynamic flavours. I actually consider this to be the most likely outcome (for what it's worth... since I've got no clue at this point about what's going on).

DavidEichmann commented 5 years ago

It looks like the empty extraDynLibFlavours was caused by my branch (DavidEichmann/ghc@b7ca1a1 being based on too old of a version of cabal (2.4). Hence the default value of [] is used as per this line of code. Commenting that line out leads to a successful build with ghc build with -dynamic and ghc --info gives ("GHC Dynamic","YES").

DavidEichmann commented 5 years ago

I've noticed a further issue with the dynamically linked ghc binary (e.g. in the perf flavour). When executing it from the a directory other than the ghc project root, it fails to find the needed .so files. one can see that the "Library runpath" is set relative to the current directory:

``` $ readelf --dynamic _build/stage1/bin/ghc ... 0x000000000000001d (RUNPATH) Library runpath: [_build/stage1/lib/../lib/x86_64-linux-ghc-8.7.20181018] ... ``` ``` $ readelf --dynamic _build/stage1/bin/ghc Dynamic section at offset 0x149118 contains 59 entries: Tag Type Name/Value 0x0000000000000003 (PLTGOT) 0x54bfe8 0x0000000000000002 (PLTRELSZ) 384 (bytes) 0x0000000000000017 (JMPREL) 0x42f238 0x0000000000000014 (PLTREL) RELA 0x0000000000000007 (RELA) 0x414310 0x0000000000000008 (RELASZ) 110376 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000006 (SYMTAB) 0x400298 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000005 (STRTAB) 0x4076a8 0x000000000000000a (STRSZ) 49726 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x4138e8 0x0000000000000001 (NEEDED) Shared library: [libgmp.so.10] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libHShaskeline-0.7.4.3-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSstm-2.5.0.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-8.7-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSterminfo-0.4.1.2-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSprocess-1.6.3.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHShpc-0.6.0.3-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghci-8.7-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHStransformers-0.5.5.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHStemplate-haskell-2.14.0.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSpretty-1.1.3.6-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-heap-8.7-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-boot-8.7-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-boot-th-8.7-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbinary-0.8.6.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSdirectory-1.3.3.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSunix-2.7.2.2-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHStime-1.8.0.2-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSfilepath-1.4.2.1-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHScontainers-0.6.0.1-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbytestring-0.10.8.2-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSdeepseq-1.4.4.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSarray-0.5.2.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbase-4.12.0.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSinteger-gmp-1.0.2.0-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-prim-0.5.3-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libHSrts-1.0_thr-ghc8.7.20181018.so] 0x0000000000000001 (NEEDED) Shared library: [libffi.so.6] 0x0000000000000001 (NEEDED) Shared library: [libtinfo.so.5] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libutil.so.1] 0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x42f3b8 0x000000000000000d (FINI) 0x5440e4 0x000000000000001a (FINI_ARRAY) 0x54a108 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x0000000000000019 (INIT_ARRAY) 0x54a110 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes) 0x000000000000001d (RUNPATH) Library runpath: [_build/stage1/lib/../lib/x86_64-linux-ghc-8.7.20181018] 0x000000006ffffff0 (VERSYM) 0x413920 0x000000006ffffffe (VERNEED) 0x4142cc 0x000000006fffffff (VERNEEDNUM) 1 0x0000000000000000 (NULL) 0x0 ```

when it should be set relative to the ghc binray as is done with the make built ghc binary:

``` $ readelf --dynamic inplace/lib/bin/ghc-stage2 ... 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../haskeline-0.7.4.3:$ORIGIN/../stm-2.5.0.0: ... ] ... ``` ``` $ readelf --dynamic inplace/lib/bin/ghc-stage2 Dynamic section at offset 0x1490e8 contains 61 entries: Tag Type Name/Value 0x0000000000000003 (PLTGOT) 0x54bfe8 0x0000000000000002 (PLTRELSZ) 384 (bytes) 0x0000000000000017 (JMPREL) 0x42f540 0x0000000000000014 (PLTREL) RELA 0x0000000000000007 (RELA) 0x4145a0 0x0000000000000008 (RELASZ) 110496 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000006 (SYMTAB) 0x400298 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000005 (STRTAB) 0x4076c0 0x000000000000000a (STRSZ) 50359 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x413b78 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libHShaskeline-0.7.4.3-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSstm-2.5.0.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-8.7-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSterminfo-0.4.1.2-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSprocess-1.6.3.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHShpc-0.6.0.3-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghci-8.7-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHStransformers-0.5.5.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHStemplate-haskell-2.14.0.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSpretty-1.1.3.6-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-heap-8.7-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-boot-8.7-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-boot-th-8.7-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbinary-0.8.6.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSdirectory-1.3.3.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSunix-2.7.2.2-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHStime-1.8.0.2-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSfilepath-1.4.2.1-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHScontainers-0.6.0.1-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbytestring-0.10.8.2-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSdeepseq-1.4.4.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSarray-0.5.2.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSbase-4.12.0.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSinteger-gmp-1.0.2.0-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSghc-prim-0.5.3-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libHSrts_thr-ghc8.7.20180925.so] 0x0000000000000001 (NEEDED) Shared library: [libffi.so.7] 0x0000000000000001 (NEEDED) Shared library: [libtinfo.so.5] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libutil.so.1] 0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgmp.so.10] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x42f6c0 0x000000000000000d (FINI) 0x5445c4 0x000000000000001a (FINI_ARRAY) 0x54a0d8 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x0000000000000019 (INIT_ARRAY) 0x54a0e0 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes) 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../haskeline-0.7.4.3:$ORIGIN/../stm-2.5.0.0:$ORIGIN/../ghc-8.7:$ORIGIN/../terminfo-0.4.1.2:$ORIGIN/../process-1.6.3.0:$ORIGIN/../hpc-0.6.0.3:$ORIGIN/../ghci-8.7:$ORIGIN/../transformers-0.5.5.0:$ORIGIN/../template-haskell-2.14.0.0:$ORIGIN/../pretty-1.1.3.6:$ORIGIN/../ghc-heap-8.7:$ORIGIN/../ghc-boot-8.7:$ORIGIN/../ghc-boot-th-8.7:$ORIGIN/../directory-1.3.3.0:$ORIGIN/../unix-2.7.2.2:$ORIGIN/../time-1.8.0.2:$ORIGIN/../filepath-1.4.2.1:$ORIGIN/../binary-0.8.6.0:$ORIGIN/../containers-0.6.0.1:$ORIGIN/../bytestring-0.10.8.2:$ORIGIN/../deepseq-1.4.4.0:$ORIGIN/../array-0.5.2.0:$ORIGIN/../base-4.12.0.0:$ORIGIN/../integer-gmp-1.0.2.0:$ORIGIN/../ghc-prim-0.5.3:$ORIGIN/../rts] 0x000000000000001e (FLAGS) ORIGIN 0x000000006ffffffb (FLAGS_1) Flags: ORIGIN 0x000000006ffffff0 (VERSYM) 0x413bb0 0x000000006ffffffe (VERNEED) 0x414560 0x000000006fffffff (VERNEEDNUM) 1 0x0000000000000000 (NULL) 0x0 ```

The command to build the ghc binary from the make build system contains explicit options setting these paths (e.g. -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../haskeline-0.7.4.3'):

"inplace/bin/ghc-stage1" -o ghc/stage2/build/tmp/ghc-stage2 -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC -dynamic  -O -H64m -Wall      -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen    -optP-DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id array-0.5.2.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.6.0.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id ghc-8.7 -package-id ghc-boot-8.7 -package-id ghc-prim-0.5.3 -package-id ghci-8.7 -package-id haskeline-0.7.4.3 -package-id process-1.6.3.0 -package-id time-1.8.0.2 -package-id transformers-0.5.5.0 -package-id unix-2.7.2.2 -Wall -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -fno-warn-name-shadowing -threaded -XHaskell2010 -XNoImplicitPrelude  -O2 -Wcpp-undef -no-hs-main -threaded -no-user-package-db -rtsopts       -Wnoncanonical-monad-instances  -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir ghc/stage2/build     -fPIC -dynamic  -O -H64m -Wall      -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen    -optP-DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id array-0.5.2.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.6.0.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id ghc-8.7 -package-id ghc-boot-8.7 -package-id ghc-prim-0.5.3 -package-id ghci-8.7 -package-id haskeline-0.7.4.3 -package-id process-1.6.3.0 -package-id time-1.8.0.2 -package-id transformers-0.5.5.0 -package-id unix-2.7.2.2 -Wall -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -fno-warn-name-shadowing -threaded -XHaskell2010 -XNoImplicitPrelude  -O2 -Wcpp-undef -no-hs-main -threaded -no-user-package-db -rtsopts       -Wnoncanonical-monad-instances  -fno-use-rpaths -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../haskeline-0.7.4.3' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../stm-2.5.0.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-8.7' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../terminfo-0.4.1.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../process-1.6.3.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../hpc-0.6.0.3' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghci-8.7' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../transformers-0.5.5.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../template-haskell-2.14.0.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../pretty-1.1.3.6' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-heap-8.7' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-boot-8.7' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-boot-th-8.7' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../directory-1.3.3.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../unix-2.7.2.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../time-1.8.0.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../filepath-1.4.2.1' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../binary-0.8.6.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../containers-0.6.0.1' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../bytestring-0.10.8.2' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../deepseq-1.4.4.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../array-0.5.2.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../base-4.12.0.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../integer-gmp-1.0.2.0' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../ghc-prim-0.5.3' -optl-Wl,-rpath -optl-Wl,'$ORIGIN/../rts' -optl-Wl,-zorigin ghc/stage2/build/Main.dyn_o ghc/stage2/build/GHCi/Leak.dyn_o ghc/stage2/build/GHCi/UI.dyn_o ghc/stage2/build/GHCi/UI/Info.dyn_o ghc/stage2/build/GHCi/UI/Monad.dyn_o ghc/stage2/build/GHCi/UI/Tags.dyn_o ghc/stage2/build/hschooks.dyn_o   

The make logic can be found here. In the case of hadrian, we currently do not specify such linker options, but should. As hadrian installs all .so files in the same directory, we just need to use e.g. this option when building the ghc binary:

-optl-Wl,-rpath -optl-Wl,'$ORIGIN/../lib/x86_64-linux-ghc-8.7.20181018'
alpmestan commented 5 years ago

https://ghc.haskell.org/trac/ghc/ticket/15837 is now where we discuss/report updates about our past and upcoming fixes for this problem.