Skip to content
Snippets Groups Projects
  1. Oct 14, 2023
    • Ilias Tsitsimpis's avatar
      hadrian: Pass -DNOSMP to C compiler when needed · 257c2807
      Ilias Tsitsimpis authored and Marge Bot's avatar Marge Bot committed
      Hadrian passes the -DNOSMP flag to GHC when the target doesn't support
      SMP, but doesn't pass it to CC as well, leading to the following
      compilation error on mips64el:
      
      | Run Cc (FindCDependencies CDep) Stage1: rts/sm/NonMovingScav.c => _build/stage1/rts/build/c/sm/NonMovingScav.o.d
      Command line: /usr/bin/mips64el-linux-gnuabi64-gcc -E -MM -MG -MF _build/stage1/rts/build/c/hooks/FlagDefaults.thr_debug_p_o.d -MT _build/stage1/rts/build/c/hooks/FlagDefaults.o -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -Irts/include -x c rts/hooks/FlagDefaults.c -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wundef -fno-strict-aliasing -DTHREADED_RTS -DDEBUG -fomit-frame-pointer -O2 -g -Irts -I_build/stage1/rts/build -DDEBUG -fno-omit-frame-pointer -g3 -O0
      ===> Command failed with error code: 1
      In file included from rts/include/Stg.h:348,
                       from rts/include/Rts.h:38,
                       from rts/hooks/FlagDefaults.c:8:
      rts/include/stg/SMP.h:416:2: error: #error memory barriers unimplemented on this architecture
        416 | #error memory barriers unimplemented on this architecture
            |  ^~~~~
      rts/include/stg/SMP.h:440:2: error: #error memory barriers unimplemented on this architecture
        440 | #error memory barriers unimplemented on this architecture
            |  ^~~~~
      rts/include/stg/SMP.h:464:2: error: #error memory barriers unimplemented on this architecture
        464 | #error memory barriers unimplemented on this architecture
            |  ^~~~~
      
      The old make system correctly passed this flag to both GHC and CC [1].
      
      Fix this error by passing -DNOSMP to CC as well.
      
      [1] https://gitlab.haskell.org/ghc/ghc/-/blob/00920f176b0235d5bb52a8e054d89a664f8938fe/rts/ghc.mk#L407
      
      Closes #24082
      257c2807
  2. Oct 13, 2023
    • John Ericson's avatar
      Do not substitute `@...@` for stage-specific values in cabal files · 08fc27af
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      
      `rts` and `ghc-prim` now no longer have a `*.cabal.in` to set Cabal flag
      defaults; instead manual choices are passed to configure in the usual
      way.
      
      The old way was fundamentally broken, because it meant we were baking
      these Cabal files for a specific stage. Now we only do stage-agnostic
      @...@ substitution in cabal files (the GHC version), and so all
      stage-specific configuration is properly confined to `_build` and the
      right stage dir.
      
      Also `include-ghc-prim` is a flag that no longer exists for `ghc-prim`
      (it was removed in 835d8ddb) so I got
      rid of it.
      
      Co-Authored-By: default avatarMatthew Pickering <matthewtpickering@gmail.com>
      08fc27af
  3. Oct 05, 2023
  4. Aug 02, 2023
    • Ben Gamari's avatar
      hadrian: Ensure that way-flags are passed to CC · cca74dab
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously the way-specific compilation flags (e.g. `-DDEBUG`,
      `-DTHREADED_RTS`) would not be passed to the CC invocations. This meant
      that C dependency files would not correctly reflect
      dependencies predicated on the way, resulting in the rather
      painful #23554.
      
      Closes #23554.
      cca74dab
  5. Jul 24, 2023
    • Rodrigo Mesquita's avatar
      ghc-toolchain: Toolchain Selection · 31dcd26c
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      This commit integrates ghc-toolchain, the brand new way of configuring
      toolchains for GHC, with the Hadrian build system, with configure, and
      extends and improves the first iteration of ghc-toolchain.
      
      The general overview is
      
      * We introduce a program invoked `ghc-toolchain --triple=...` which, when run,
        produces a file with a `Target`. A `GHC.Toolchain.Target.Target`
        describes the properties of a target and the toolchain (executables
        and configured flags) to produce code for that target
      
      * Hadrian was modified to read Target files, and will both
        * Invoke the toolchain configured in the Target file as needed
        * Produce a `settings` file for GHC based on the Target file for that stage
      
      * `./configure` will invoke ghc-toolchain to generate target files, but
        it will also generate target files based on the flags configure itself
        configured (through `.in` files that are substituted)
      
        * By default, the Targets generated by configure are still (for now) the ones used by Hadrian
      
        * But we additionally validate the Target files generated by
          ghc-toolchain against the ones generated by configure, to get a head
          start on catching configuration bugs before we transition
          completely.
      
        * When we make that transition, we will want to drop a lot of the
          toolchain configuration logic from configure, but keep it otherwise.
      
      * For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine)
        * We just have a HOST target file, which we use as the target for stage0
        * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling)
        * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST
        * (for more details on cross-compilation see discussion on !9263)
      
      See also
      * Note [How we configure the bundled windows toolchain]
      * Note [ghc-toolchain consistency checking]
      * Note [ghc-toolchain overview]
      
      Ticket: #19877
      MR: !9263
      31dcd26c
  6. Jun 19, 2023
    • Finley McIlwaine's avatar
      IPE data compression · cb9e1ce4
      Finley McIlwaine authored
      IPE data resulting from the `-finfo-table-map` flag may now be
      compressed by configuring the GHC build with the
      `--enable-ipe-data-compression` flag. This results in about a 20%
      reduction in the size of IPE-enabled build results.
      
      The compression library, zstd, may optionally be statically linked by
      configuring with the `--enabled-static-libzstd` flag (on non-darwin
      platforms)
      
      libzstd version 1.4.0 or greater is required.
      cb9e1ce4
  7. Jun 07, 2023
  8. Jun 01, 2023
    • Finley McIlwaine's avatar
      Add IPE compression to configure · 5d1f2411
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      Reference ticket #21766
      
      Adds an `--enable-ipe-data-compreesion` flag to the configure script
      which will check for libzstd and set the appropriate flags to allow for
      IPE data compression in the compiler
      5d1f2411
  9. May 04, 2023
    • Rodrigo Mesquita's avatar
      Hardwire a better unit-id for ghc · 3fdb18f8
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Previously, the unit-id of ghc-the-library was fixed as `ghc`.
      This was done primarily because the compiler must know the unit-id of
      some packages (including ghc) a-priori to define wired-in names.
      
      However, as seen in #20742, a reinstallable `ghc` whose unit-id is fixed
      to `ghc` might result in subtle bugs when different ghc's interact.
      
      A good example of this is having GHC_A load a plugin compiled by GHC_B,
      where GHC_A and GHC_B are linked to ghc-libraries that are ABI
      incompatible. Without a distinction between the unit-id of the ghc library
      GHC_A is linked against and the ghc library the plugin it is loading was
      compiled against, we can't check compatibility.
      
      This patch gives a slightly better unit-id to ghc (ghc-version) by
      (1) Not setting -this-unit-id to ghc, but rather to the new unit-id (modulo stage0)
      (2) Adding a definition to `GHC.Settings.Config` whose value is the new unit-id.
          (2.1) `GHC.Settings.Config` is generated by Hadrian
          (2.2) and also by cabal through `compiler/Setup.hs`
      This unit-id definition is imported by `GHC.Unit.Types` and used to
      set the wired-in unit-id of "ghc", which was previously fixed to "ghc"
      
      The commits following this one will improve the unit-id with a
      cabal-style package hash and check compatibility when loading plugins.
      
      Note that we also ensure that ghc's unit key matches unit id both when
      hadrian or cabal builds ghc, and in this way we no longer need to add
      `ghc` to the WiringMap.
      3fdb18f8
  10. Mar 08, 2023
    • Alexis King's avatar
      hadrian: Fix flavour compiler stage options off-by-one error · 7c813d06
      Alexis King authored and Marge Bot's avatar Marge Bot committed
      !9193 pointed out that ghcDebugAssertions was supposed to be a predicate
      on the stage of the built compiler, but in practice it was a predicate
      on the stage of the compiler used to build. Unfortunately, while it
      fixed that issue for ghcDebugAssertions, it documented every other
      similar option as behaving the same way when in fact they all used the
      old behavior.
      
      The new behavior of ghcDebugAssertions seems more intuitive, so this
      commit changes the interpretation of every other option to match. It
      also improves the enableProfiledGhc and debugGhc flavour transformers by
      making them more selective about which stages in which they build
      additional library/RTS ways.
      7c813d06
  11. Feb 17, 2023
    • Sylvain Henry's avatar
      Merge libiserv with ghci · a203ad85
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      `libiserv` serves no purpose. As it depends on `ghci` and doesn't have
      more dependencies than the `ghci` package, its code could live in the
      `ghci` package too.
      
      This commit also moves most of the code from the `iserv` program into
      the `ghci` package as well so that it can be reused. This is especially
      useful for the implementation of TH for the JS backend (#22261, !9779).
      a203ad85
  12. Feb 03, 2023
    • Tamar Christina's avatar
      linker: Fix BFD import libraries · 48e39195
      Tamar Christina authored and Marge Bot's avatar Marge Bot committed
      This commit fixes the BFD style import library support in the runtime
      linker.  This was accidentally broken during the refactoring to clang
      and went unnoticed because clang itself is unable to generate the BFD
      style import libraries.
      
      With this change we can not link against both GCC or Clang produced
      libraries again and intermix code produced by both compilers.
      48e39195
    • Ryan Scott's avatar
      Windows: Remove mingwex dependency · de1d1512
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      The clang based toolchain uses ucrt as its math library
      and so mingwex is no longer needed.  In fact using mingwex
      will cause incompatibilities as the default routines in both
      have differing ULPs and string formatting modifiers.
      
      ```
      $ LIBRARY_PATH=/mingw64/lib ghc/_build/stage1/bin/ghc Bug.hs -fforce-recomp && ./Bug.exe
      [1 of 2] Compiling Main             ( Bug.hs, Bug.o )
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__imp___p__environ'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__hscore_get_errno'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziError_errnoToIOError_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziWindows_failIf2_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePageziAPI_mkCodePageEncoding_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePage_currentCodePage_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncoding_getForeignEncoding_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziString_withCStringLen1_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziInternals_zdwflushCharReadBuffer_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziText_hGetBuf1_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziFingerprint_fingerprintString_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_DataziTypeableziInternal_mkTrCon_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziException_errorCallWithCallStackException_closure'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziErr_error_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `base_DataziMaybe_fromJust1_info'
      ghc.exe:  | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `templatezmhaskell_LanguageziHaskellziTHziSyntax_IntPrimL_con_info'
      ghc.exe: ^^ Could not load 'templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure', dependency unresolved. See top entry above.
      
      <no location info>: error:
      
      GHC.ByteCode.Linker.lookupCE
      During interactive linking, GHCi couldn't find the following symbol:
        templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure
      This may be due to you not asking GHCi to load extra object files,
      archives or DLLs needed by your current session.  Restart GHCi, specifying
      the missing library using the -L/path/to/object/dir and -lmissinglibname
      flags, or simply by naming the relevant files on the GHCi command line.
      Alternatively, this link failure might indicate a bug in GHCi.
      If you suspect the latter, please report this as a GHC bug:
        https://www.haskell.org/ghc/reportabug
      ```
      de1d1512
  13. Jan 19, 2023
  14. Dec 08, 2022
    • Cheng Shao's avatar
      hadrian: don't add debug info to non-debug ways of rts · 9ec76f61
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      Hadrian used to pass -g when building all ways of rts. It makes output
      binaries larger (especially so for wasm backend), and isn't needed by
      most users out there, so this patch removes that flag. In case the
      debug info is desired, we still pass -g3 when building the debug way,
      and there's also the debug_info flavour transformer which ensures -g3
      is passed for all rts ways.
      9ec76f61
  15. Dec 06, 2022
    • sheaf's avatar
      Hadrian: fix ghcDebugAssertions off-by-one error · cd31acad
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit 6b2f7ffe changed the logic that decided whether to enable debug
      assertions. However, it had an off-by-one error, as the stage parameter
      to the function inconsistently referred to the stage of the compiler
      being used to build or the stage of the compiler we are building.
      
      This patch makes it consistent. Now the parameter always refers to the
      the compiler which is being built.
      
      In particular, this patch re-enables
      assertions in the stage 2 compiler when building with devel2 flavour,
      and disables assertions in the stage 2 compiler when building with
      validate flavour.
      
      Some extra performance tests are now run in the "validate" jobs because
      the stage2 compiler no longer contains assertions.
      
      -------------------------
      Metric Decrease:
          CoOpt_Singletons
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModulesTH_OneShot
          T11374
          T12227
          T12234
          T13253-spj
          T13701
          T14683
          T14697
          T15703
          T17096
          T17516
          T18304
          T18478
          T18923
          T5030
          T9872b
          TcPlugin_RewritePerf
      Metric Increase:
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModules
          MultiLayerModulesRecomp
          MultiLayerModulesTH_Make
          T13386
          T13719
          T3294
          T9233
          T9675
          parsing001
      -------------------------
      cd31acad
  16. Nov 23, 2022
    • Sylvain Henry's avatar
      Don't let configure perform trivial substitutions (#21846) · b5c71454
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Hadrian now performs substitutions, especially to generate .cabal files
      from .cabal.in files. Two benefits:
      
      1. We won't have to re-configure when we modify thing.cabal.in. Hadrian
         will take care of this for us.
      
      2. It paves the way to allow the same package to be configured
         differently by Hadrian in the same session. This will be useful to
         fix #19174: we want to build a stage2 cross-compiler for the host
         platform and a stage1 compiler for the cross target platform in the
         same Hadrian session.
      b5c71454
  17. Sep 22, 2022
  18. Sep 17, 2022
    • Cheng Shao's avatar
      rts: make threaded ways optional · bd0f4184
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      For certain targets (e.g. wasm32-wasi), the threaded rts is known not to
      work. This patch adds a "threaded" cabal flag to rts to make threaded
      rts ways optional. Hadrian enables this flag iff the flavour rtsWays
      contains threaded ways.
      bd0f4184
  19. Aug 31, 2022
    • Matthew Pickering's avatar
      Make ghcDebugAssertions into a Stage predicate (Stage -> Bool) · 6b2f7ffe
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      We also care whether we have debug assertions enabled for a stage one
      compiler, but the way which we turned on the assertions was quite
      different from the stage2 compiler. This makes the logic for turning on
      consistent across both and has the advantage of being able to correct
      determine in in-tree args whether a flavour enables assertions or not.
      
      Ticket #22096
      6b2f7ffe
  20. Aug 26, 2022
  21. Jul 05, 2022
    • Matthew Pickering's avatar
      Vendor filepath inside template-haskell · b151b65e
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Adding filepath as a dependency of template-haskell means that it can't
      be reinstalled if any build-plan depends on template-haskell.
      
      This is a temporary solution for the 9.4 release.
      
      A longer term solution is to split-up the template-haskell package into
      the wired-in part and a non-wired-in part which can be reinstalled. This
      was deemed quite risky on the 9.4 release timescale.
      
      Fixes #21738
      b151b65e
  22. May 31, 2022
    • Matthew Pickering's avatar
      hadrian: Introduce new package database for executables needed to build stage0 · 5c4421b1
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      These executables (such as hsc2hs) are built using the boot compiler and
      crucially, most libraries from the global package database.
      
      We also move other build-time executables to be built in this stage such
      as linters which also cleans up which libraries end up in the global
      package database. This allows us to remove hacks where linters-common is
      removed from the package database when a bindist is created.
      
      This fixes issues caused by infinite recursion due to bytestring adding
      a dependency on template-haskell.
      
      Fixes #21634
      5c4421b1
  23. May 30, 2022
    • Matthew Pickering's avatar
      hadrian: Fix building from source-dist without alex/happy · cac8c7bb
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This fixes two bugs which were adding dependencies on alex/happy when
      building from a source dist.
      
      * When we try to pass `--with-alex` and `--with-happy` to cabal when
        configuring but the builders are not set. This is fixed by making them
        optional.
      * When we configure, cabal requires alex/happy because of the
        build-tool-depends fields. These are now made optional with a cabal
        flag (build-tool-depends) for compiler/hpc-bin/genprimopcode.
      
      Fixes #21627
      cac8c7bb
  24. Apr 28, 2022
  25. Apr 27, 2022
    • Ben Gamari's avatar
      Enable eventlog support in all ways by default · ee11d043
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we deprecate the eventlogging RTS ways and instead enable eventlog
      support in the remaining ways. This simplifies packaging and reduces GHC
      compilation times (as we can eliminate two whole compilations of the RTS)
      while simplifying the end-user story. The trade-off is a small increase
      in binary sizes in the case that the user does not want eventlogging
      support, but we think that this is a fine trade-off.
      
      This also revealed a latent RTS bug: some files which included `Cmm.h`
      also assumed that it defined various macros which were in fact defined
      by `Config.h`, which `Cmm.h` did not include. Fixing this in turn
      revealed that `StgMiscClosures.cmm` failed to import various spinlock
      statistics counters, as evidenced by the failed unregisterised build.
      
      Closes #18948.
      ee11d043
  26. Apr 25, 2022
  27. Mar 29, 2022
  28. Mar 28, 2022
  29. Feb 08, 2022
  30. Dec 01, 2021
  31. Nov 19, 2021
    • John Ericson's avatar
      Hadrian: bring up to date with latest make improvements · aed98dda
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      Headers should be associated with the RTS, and subject to less hacks.
      
      The most subtle issue was that the package-grained dependencies on
      generated files were being `need`ed before calculating Haskell deps, but
      not before calculating C/C++ deps.
      aed98dda
  32. Nov 17, 2021
  33. Nov 15, 2021
    • Sylvain Henry's avatar
      Hadrian: fix windows cross-build (#20657) · d9f54905
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Many small things to fix:
      
      * Hadrian: platform triple is "x86_64-w64-mingw32" and this wasn't recognized by
        Hadrian (note "w64" instead of "unknown")
      
      * Hadrian was using the build platform ("isWindowsHost") to detect
        the use of the Windows toolchain, which was wrong. We now use the
        "targetOs" setting.
      
      * Hadrian was doing the same thing for Darwin so we fixed both at once,
        even if cross-compilation to Darwin is unlikely to happen afaik (cf
        "osxHost" vs "osxTarget" changes)
      
      * Hadrian: libffi name was computed in two different places and one of
        them wasn't taking the different naming on Windows into account.
      
      * Hadrian was passing "-Irts/include" when building the stage1 compiler
        leading to the same error as in #18143 (which is using make).
        stage1's RTS is stage0's one so mustn't do this.
      
      * Hadrian: Windows linker doesn't seem to support "-zorigin" so we
        don't pass it (similarly to Darwin)
      
      * Hadrian: hsc2hs in cross-compilation mode uses a trick (taken from
        autoconf): it defines "static int test_array[SOME_EXPR]" where
        SOME_EXPR is a constant expression. However GCC reports an error
        because SOME_EXPR is supposedly not constant. This is fixed by using
        another method enabled with the `--via-asm` flag of hsc2hs. It has been
        fixed in `make` build system (5f6fcf78)
        but not in Hadrian.
      
      * Hadrian: some packages are specifically built only on Windows but they
        shouldn't be when building a cross-compiler (`touchy` and
        `ghci-wrapper`). We now correctly detect this case and disable these
        packages.
      
      * Base: we use `iNVALID_HANDLE_VALUE` in a few places. It fixed some
        hsc2hs issues before we switched to `--via-asm` (see above). I've kept
        these changes are they make the code nicer.
      
      * Base: `base`'s configure tries to detect if it is building for Windows
        but for some reason the `$host_alias` value is `x86_64-windows` in my
        case and it wasn't properly detected.
      
      * Base: libraries/base/include/winio_structs.h imported "Windows.h" with
        a leading uppercase. It doesn't work on case-sensitive systems when
        cross-compiling so we have to use "windows.h".
      
      * RTS: rts/win32/ThrIOManager.c was importin "rts\OSThreads.h" but this
        path isn't valid when cross-compiling. We replaced "\" with "/".
      
      * DeriveConstants: this tool derives the constants from the target
        RTS header files. However these header files define `StgAsyncIOResult`
        only when `mingw32_HOST_OS` is set hence it seems we have to set it
        explicitly.
        Note that deriveConstants is called more than once (why? there is
        only one target for now so it shouldn't) and in the second case this
        value is correctly defined (probably coming indirectly from the import
        of "rts/PosixSource.h"). A better fix would probably be to disable the
        unneeded first run of deriveconstants.
      d9f54905
    • John Ericson's avatar
      Delete dead code knobs for building GHC itself · b679721a
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      As GHC has become target agnostic, we've left behind some now-useless
      logic in both build systems.
      b679721a
  34. Oct 29, 2021
    • John Ericson's avatar
      make build system: RTS should use dist-install not dist · 7b67724b
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      This is the following find and replace:
      
       - `rts/dist` -> `rts/dist-install` # for paths
       - `rts_dist` -> `rts_dist-install` # for make rules and vars
       - `,dist` -> `,dist-install` # for make, just in rts/ghc.mk`
      
      Why do this? Does it matter when the RTS is just built once? The answer
      is, yes, I think it does, because I want the distdir--stage
      correspondence to be consistent.
      
      In particular, for #17191 and continuing from
      d5de970d I am going to make the headers
      (`rts/includes`) increasingly the responsibility of the RTS (hence their
      new location). However, those headers are current made for multiple
      stages. This will probably become unnecessary as work on #17191
      progresses and the compiler proper becomes more of a freestanding cabal
      package (e.g. a library that can be downloaded from Hackage and built
      without any autoconf). However, until that is finished, we have will
      transitional period where the RTS and headers need to agree on dirs for
      multiple stages.
      
      I know the make build system is going away, but it's not going yet, so I
      need to change it to unblock things :).
      7b67724b
  35. Jul 27, 2021
Loading