From f23f30705f9e2f2627eba4dc74088c89693d36a4 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 31 Aug 2023 23:30:05 +1200 Subject: [PATCH 01/10] Use Cabal 3.10 when building hoogle --- builder/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builder/default.nix b/builder/default.nix index b12fd97b32..873848904b 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -67,6 +67,9 @@ let in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc928" "hoogle" { inherit evalPackages; version = "5.0.18.3"; + cabalProjectLocal = '' + constraints: setup.Cabal >=3.10 + ''; # index-state = pkgs.haskell-nix.internalHackageIndexState; index-state = "2023-06-05T00:00:00Z"; } From 0407de9cbd66de3ff7a17f3b8e0509267b843136 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sat, 26 Aug 2023 16:53:11 +0800 Subject: [PATCH 02/10] Add windows R_X86_64_PC64 relocation support --- overlays/bootstrap.nix | 5 ++++- .../patches/ghc/win-reloc-x86_64-pc64.patch | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 overlays/patches/ghc/win-reloc-x86_64-pc64.patch diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 8080b93826..665be62fcb 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -184,7 +184,10 @@ in { ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.4.5" ./patches/ghc/ghc-9.4-hadrian-win-cross.patch) ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.7" "9.4.8" ./patches/ghc/ghc-9.8-hadrian-win-cross.patch) ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.8.1" "9.10" ./patches/ghc/ghc-9.8-hadrian-win-cross.patch) - ++ fromUntil "9.4.5" "9.4.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch + # support R_X86_64_PC64 (ELF constant 24) - IMAGE_REL_AMD64_SREL32 (PE constant 14), which seems to appear with 9.6 more frequently, and + # results in "unhandled PEi386 relocation type 14". + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/win-reloc-x86_64-pc64.patch) + ++ fromUntil "9.4.5" "9.4.6" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.2" "9.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.1" "9.10" ./patches/ghc/MR10116.patch ++ final.lib.optionals (final.stdenv.buildPlatform == final.stdenv.targetPlatform) (fromUntil "9.4.1" "9.6" ./patches/ghc/hadrian-build-deriveConstants-genprimopcode-ghc94.patch) diff --git a/overlays/patches/ghc/win-reloc-x86_64-pc64.patch b/overlays/patches/ghc/win-reloc-x86_64-pc64.patch new file mode 100644 index 0000000000..7abf4c01a3 --- /dev/null +++ b/overlays/patches/ghc/win-reloc-x86_64-pc64.patch @@ -0,0 +1,20 @@ +diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c +index 0b328df..c404992 100644 +--- a/rts/linker/PEi386.c ++++ b/rts/linker/PEi386.c +@@ -2071,6 +2071,15 @@ ocResolve_PEi386 ( ObjectCode* oc ) + *(uint32_t *)pP = (uint32_t)v; + break; + } ++ case 14: /* R_X86_64_PC64 (ELF constant 24) - IMAGE_REL_AMD64_SREL32 (PE constant 14) */ ++ { ++ /* mingw will emit this for a pc-rel 64 relocation */ ++ uint64_t A; ++ checkProddableBlock(oc, pP, 8); ++ A = *(uint64_t*)pP; ++ *(uint64_t *)pP = S + A - (intptr_t)pP; ++ break; ++ } + case 4: /* R_X86_64_PC32 (ELF constant 2) - IMAGE_REL_AMD64_REL32 (PE constant 4) */ + { + intptr_t v; From 44f2822afdbbfea0b9d80d8d814d313b655a280c Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sat, 26 Aug 2023 18:06:22 +0800 Subject: [PATCH 03/10] Patch wine to fix addDllDirectory Fixes errors like this when trying to load DLLs into template haskell code with GHC 9.4 and above: ``` iserv-proxy-interpreter.exe: addLibrarySearchPath: \\?\Z:\nix\store\gjsf5jazfbfv21hvvgf1amd5rdx3ycf3-x86_64-w64-mingw32-ghc-9.4.3\lib\x86_64-windows-ghc-9.4.3\ghc-bignum-1.3 (Win32 error 87): Invalid parameter. ``` These errors arise with GHC 9.4 and above because it uses UNC paths to avoid limits on path length. The `RtlDetermineDosPathNameType_U` function classifies these as a `DEVICE_PATH` and `LdrAddDllDirectory` gives up at that point. --- overlays/patches/wine-add-dll-directory.patch | 13 +++++++++++ overlays/wine.nix | 23 +++++-------------- 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 overlays/patches/wine-add-dll-directory.patch diff --git a/overlays/patches/wine-add-dll-directory.patch b/overlays/patches/wine-add-dll-directory.patch new file mode 100644 index 0000000000..6f817be4ec --- /dev/null +++ b/overlays/patches/wine-add-dll-directory.patch @@ -0,0 +1,13 @@ +diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c +index 85eb2976807..36d92b32d1c 100644 +--- a/dlls/ntdll/loader.c ++++ b/dlls/ntdll/loader.c +@@ -4015,7 +4015,7 @@ NTSTATUS WINAPI LdrAddDllDirectory( const UNICODE_STRING *dir, void **cookie ) + struct dll_dir_entry *ptr; + DOS_PATHNAME_TYPE type = RtlDetermineDosPathNameType_U( dir->Buffer ); + +- if (type != ABSOLUTE_PATH && type != ABSOLUTE_DRIVE_PATH) ++ if (type != ABSOLUTE_PATH && type != ABSOLUTE_DRIVE_PATH && type != DEVICE_PATH ) + return STATUS_INVALID_PARAMETER; + + status = RtlDosPathNameToNtPathName_U_WithStatus( dir->Buffer, &nt_name, NULL, NULL ); diff --git a/overlays/wine.nix b/overlays/wine.nix index 3420bec771..27fa9a3f78 100644 --- a/overlays/wine.nix +++ b/overlays/wine.nix @@ -2,21 +2,10 @@ # files from TH code) for GHC built with msvcrt (ghc<9.6). # This will inevitably replace *any* wine version. Thus this might not really be what we ultimately want. # Wine 5.4 does not build on macOS so that is not pinned and TH code will probably break. -final: prev: -prev.lib.optionalAttrs (!prev.stdenv.hostPlatform.isDarwin) { - winePackages = prev.winePackages // { - minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { - name = "wine-5.4"; - version = "5.4"; - src = prev.fetchurl { - url = "https://dl.winehq.org/wine/source/5.x/wine-5.4.tar.xz"; - sha256 = "sha256-Sz4rD/pUFfGZVA5gUcKMOXb86R6lv7LPSgmcJXMXBSw="; - }; - patches = []; - # Turning off the tests as there is a problem with the `schedsvc` test. - # With recent nixpkgs both the IDL files generate `_c.c` files with - # `handle_t rpc_handle` and that results in a linker error (duplicate symbols). - configureFlags = oldAttrs.configureFlags or [] ++ ["--disable-tests"]; - }); - }; +final: prev: { + winePackages = prev.winePackages // { + minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ ./patches/wine-add-dll-directory.patch ]; + }); + }; } From c9b4e47d232b706d2fa8571eec430bd701ecac43 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Wed, 30 Aug 2023 08:26:28 +0000 Subject: [PATCH 04/10] patch wine to support UNC paths --- flake.lock | 8 ++++---- overlays/wine.nix | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 4e7e2ea7ce..924cb174ac 100644 --- a/flake.lock +++ b/flake.lock @@ -225,11 +225,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1688517130, - "narHash": "sha256-hUqfxSlo+ffqVdkSZ1EDoB7/ILCL25eYkcCXW9/P3Wc=", + "lastModified": 1691634696, + "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", "ref": "hkm/remote-iserv", - "rev": "9151db2a9a61d7f5fe52ff8836f18bbd0fd8933c", - "revCount": 13, + "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", + "revCount": 14, "type": "git", "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" }, diff --git a/overlays/wine.nix b/overlays/wine.nix index 27fa9a3f78..076e2b1f10 100644 --- a/overlays/wine.nix +++ b/overlays/wine.nix @@ -2,10 +2,21 @@ # files from TH code) for GHC built with msvcrt (ghc<9.6). # This will inevitably replace *any* wine version. Thus this might not really be what we ultimately want. # Wine 5.4 does not build on macOS so that is not pinned and TH code will probably break. -final: prev: { - winePackages = prev.winePackages // { - minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { - patches = oldAttrs.patches or [] ++ [ ./patches/wine-add-dll-directory.patch ]; - }); - }; -} +final: prev: +prev.lib.optionalAttrs (!prev.stdenv.hostPlatform.isDarwin) { + winePackages = prev.winePackages // { + minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { + name = "wine-5.4"; + version = "5.4"; + src = prev.fetchurl { + url = "https://dl.winehq.org/wine/source/5.x/wine-5.4.tar.xz"; + sha256 = "sha256-Sz4rD/pUFfGZVA5gUcKMOXb86R6lv7LPSgmcJXMXBSw="; + }; + patches = [] ++ [ ./patches/wine-add-dll-directory.patch ]; + # Turning off the tests as there is a problem with the `schedsvc` test. + # With recent nixpkgs both the IDL files generate `_c.c` files with + # `handle_t rpc_handle` and that results in a linker error (duplicate symbols). + configureFlags = oldAttrs.configureFlags or [] ++ ["--disable-tests"]; + }); + }; +} \ No newline at end of file From 1ea1a3bf643071c59ba80260e78684b495d6426e Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sat, 26 Aug 2023 18:27:22 +0800 Subject: [PATCH 05/10] Force msvcrt instead of ucrt for GHC Nixpkgs `mingw64` is a msvcrt based toolchain. GHC 9.4+ moved on to a ucrt based toolchain. We can hover reverse this change in GHC and keep using msvcrt for now. We also need to prevent the linker for linking ucrt, as that is is incompatible with ucrt. By doing so we can also upgrade to a newer wine, which contains ucrt libs. This would previously have thrown our TH logic off. --- modules/configuration-nix.nix | 1 + overlays/bootstrap.nix | 12 +++- overlays/patches/Cabal/9220.patch | 70 +++++++++++++++++++ .../ghc/Win32-depends-on-mingwex.patch | 13 ++++ overlays/patches/ghc/no-ucrt.patch | 26 +++++++ .../win-add-closure_sizeW-to-rtssyms.patch | 15 ++++ overlays/patches/ghc/win-linker-no-ucrt.patch | 16 +++++ overlays/wine.nix | 25 ++----- 8 files changed, 159 insertions(+), 19 deletions(-) create mode 100644 overlays/patches/Cabal/9220.patch create mode 100644 overlays/patches/ghc/Win32-depends-on-mingwex.patch create mode 100644 overlays/patches/ghc/no-ucrt.patch create mode 100644 overlays/patches/ghc/win-add-closure_sizeW-to-rtssyms.patch create mode 100644 overlays/patches/ghc/win-linker-no-ucrt.patch diff --git a/modules/configuration-nix.nix b/modules/configuration-nix.nix index 5e1fb7bf50..76e4960326 100644 --- a/modules/configuration-nix.nix +++ b/modules/configuration-nix.nix @@ -44,6 +44,7 @@ in { (fromUntil "3.2.0.0" "3.5" ../overlays/patches/Cabal/Cabal-3.0.0.0-no-final-checks.diff) (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/Cabal-3.6.0.0-drop-pkg-db-check.diff) (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/Cabal-3.6.0.0-no-final-checks.diff) + (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/9220.patch) ]; # These two patches are: diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 665be62fcb..893c97f9b5 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -187,7 +187,16 @@ in { # support R_X86_64_PC64 (ELF constant 24) - IMAGE_REL_AMD64_SREL32 (PE constant 14), which seems to appear with 9.6 more frequently, and # results in "unhandled PEi386 relocation type 14". ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/win-reloc-x86_64-pc64.patch) - ++ fromUntil "9.4.5" "9.4.6" ./patches/ghc/ghc-9.4.5-include-order-fix.patch + # ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/Win32-depends-on-mingwex.patch) + # if the host system provides ucrt (e.g. wine with ucrtbase.dll), we may end up linking against symbols from ucrtbase, instead of msvcrt, + # thus leading to broken code. E.g. the handles we create and hand to wine will all be busted, because they come from one and are processed + # by another crt. + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "8.10" "9.10" ./patches/ghc/win-linker-no-ucrt.patch) + # Nixos/nixpkgs is mscvrt for now, thus we must disable ucrt in ghc, otherwise we end up with broken linking. + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/no-ucrt.patch) + # the following is needed for cardano-prelude as it uses closure_sizeW :-/ + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/win-add-closure_sizeW-to-rtssyms.patch) + ++ fromUntil "9.4.5" "9.4.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.2" "9.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.1" "9.10" ./patches/ghc/MR10116.patch ++ final.lib.optionals (final.stdenv.buildPlatform == final.stdenv.targetPlatform) (fromUntil "9.4.1" "9.6" ./patches/ghc/hadrian-build-deriveConstants-genprimopcode-ghc94.patch) @@ -212,6 +221,7 @@ in { ++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/ghc-8.10-aarch64-handle-none-rela.patch ++ final.lib.optional (versionAtLeast "9.0" && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/ghc-9.0-better-symbol-addr-debug.patch ++ final.lib.optional (versionAtLeast "9.0" && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/ghc-9.0-aarch64-handle-none-rela.patch + ; in ({ ghc865 = final.callPackage ../compiler/ghc (traceWarnOld "8.6" { diff --git a/overlays/patches/Cabal/9220.patch b/overlays/patches/Cabal/9220.patch new file mode 100644 index 0000000000..7af74aee62 --- /dev/null +++ b/overlays/patches/Cabal/9220.patch @@ -0,0 +1,70 @@ +diff --git a/src/Distribution/Simple/Configure.hs b/src/Distribution/Simple/Configure.hs +index ac7bd852f..803475283 100644 +--- a/src/Distribution/Simple/Configure.hs ++++ b/src/Distribution/Simple/Configure.hs +@@ -637,22 +637,6 @@ configure (pkg_descr0, pbi) cfg = do + "--enable-split-objs; ignoring") + return False + +- let compilerSupportsGhciLibs :: Bool +- compilerSupportsGhciLibs = +- case compilerId comp of +- CompilerId GHC version +- | version > mkVersion [9,3] && windows -> +- False +- CompilerId GHC _ -> +- True +- CompilerId GHCJS _ -> +- True +- _ -> False +- where +- windows = case compPlatform of +- Platform _ Windows -> True +- Platform _ _ -> False +- + let ghciLibByDefault = + case compilerId comp of + CompilerId GHC _ -> +@@ -669,15 +653,6 @@ configure (pkg_descr0, pbi) cfg = do + not (GHCJS.isDynamic comp) + _ -> False + +- withGHCiLib_ <- +- case fromFlagOrDefault ghciLibByDefault (configGHCiLib cfg) of +- True | not compilerSupportsGhciLibs -> do +- warn verbosity $ +- "--enable-library-for-ghci is no longer supported on Windows with" +- ++ " GHC 9.4 and later; ignoring..." +- return False +- v -> return v +- + let sharedLibsByDefault + | fromFlag (configDynExe cfg) = + -- build a shared library if dynamically-linked +@@ -774,7 +749,7 @@ configure (pkg_descr0, pbi) cfg = do + withProfExeDetail = ProfDetailNone, + withOptimization = fromFlag $ configOptimization cfg, + withDebugInfo = fromFlag $ configDebugInfo cfg, +- withGHCiLib = withGHCiLib_, ++ withGHCiLib = fromFlagOrDefault ghciLibByDefault (configGHCiLib cfg), + splitSections = split_sections, + splitObjs = split_objs, + stripExes = strip_exe, +diff --git a/src/Distribution/Simple/Setup.hs b/src/Distribution/Simple/Setup.hs +index 36f6aa22f..aa60b73b8 100644 +--- a/src/Distribution/Simple/Setup.hs ++++ b/src/Distribution/Simple/Setup.hs +@@ -384,12 +384,7 @@ defaultConfigFlags progDb = emptyConfigFlags { + configCabalFilePath = NoFlag, + configVerbosity = Flag normal, + configUserInstall = Flag False, --TODO: reverse this +-#if defined(mingw32_HOST_OS) +- -- See #8062 and GHC #21019. +- configGHCiLib = Flag False, +-#else +- configGHCiLib = NoFlag, +-#endif ++ configGHCiLib = Flag True, + configSplitSections = Flag False, + configSplitObjs = Flag False, -- takes longer, so turn off by default + configStripExes = NoFlag, diff --git a/overlays/patches/ghc/Win32-depends-on-mingwex.patch b/overlays/patches/ghc/Win32-depends-on-mingwex.patch new file mode 100644 index 0000000000..30384ff706 --- /dev/null +++ b/overlays/patches/ghc/Win32-depends-on-mingwex.patch @@ -0,0 +1,13 @@ +diff --git a/libraries/Win32/Win32.cabal b/libraries/Win32/Win32.cabal +index e986b7e..603354f 100644 +--- a/libraries/Win32/Win32.cabal ++++ b/libraries/Win32/Win32.cabal +@@ -138,7 +138,7 @@ Library + System.Win32.Time.Internal + + extra-libraries: +- "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32" ++ "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32", "mingwex" + ghc-options: -Wall + include-dirs: include + includes: "alphablend.h", "diatemp.h", "dumpBMP.h", "ellipse.h", "errors.h", "HsGDI.h", "HsWin32.h", "Win32Aux.h", "win32debug.h", "windows_cconv.h", "WndProc.h", "alignment.h" diff --git a/overlays/patches/ghc/no-ucrt.patch b/overlays/patches/ghc/no-ucrt.patch new file mode 100644 index 0000000000..5e011b091e --- /dev/null +++ b/overlays/patches/ghc/no-ucrt.patch @@ -0,0 +1,26 @@ +diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal +index 5393363..4f5db98 100644 +--- a/libraries/ghc-prim/ghc-prim.cabal ++++ b/libraries/ghc-prim/ghc-prim.cabal +@@ -73,7 +73,7 @@ Library + -- mingw32 which is required by mingwex. + -- user32: provides access to apis to modify user components (UI etc) + -- on Windows. Required because of mingw32. +- extra-libraries: user32, mingw32, ucrt ++ extra-libraries: user32, mingw32, msvcrt, mingwex + + if os(linux) + -- we need libm, but for musl and other's we might need libc, as libm +diff --git a/m4/fp_setup_windows_toolchain.m4 b/m4/fp_setup_windows_toolchain.m4 +index 1f44a38..122a205 100644 +--- a/m4/fp_setup_windows_toolchain.m4 ++++ b/m4/fp_setup_windows_toolchain.m4 +@@ -86,7 +86,7 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[ + # Signal that we are linking against UCRT with the _UCRT macro. This is + # necessary to ensure correct behavior when MinGW-w64 headers are in the + # header include path (#22159). +- cflags="--rtlib=compiler-rt -D_UCRT" ++ cflags="" + CFLAGS="$cflags" + CONF_CC_OPTS_STAGE1="$cflags" + CONF_CC_OPTS_STAGE2="$cflags" diff --git a/overlays/patches/ghc/win-add-closure_sizeW-to-rtssyms.patch b/overlays/patches/ghc/win-add-closure_sizeW-to-rtssyms.patch new file mode 100644 index 0000000000..de993b0f53 --- /dev/null +++ b/overlays/patches/ghc/win-add-closure_sizeW-to-rtssyms.patch @@ -0,0 +1,15 @@ +diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c +index 10efb2a..d8ea070 100644 +--- a/rts/RtsSymbols.c ++++ b/rts/RtsSymbols.c +@@ -160,7 +160,9 @@ extern char **environ; + SymI_HasProto(__mingw_vsnwprintf) \ + /* ^^ Need to figure out why this is needed. */ \ + SymI_HasProto(__mingw_vfprintf) \ +- /* ^^ Need to figure out why this is needed. */ ++ /* ^^ Need to figure out why this is needed. */ \ ++ SymI_HasProto(closure_sizeW_) \ ++ /* ^^ This one needed for cardano-prelude m( */ + #else + #define RTS_MINGW_ONLY_SYMBOLS /**/ + #endif diff --git a/overlays/patches/ghc/win-linker-no-ucrt.patch b/overlays/patches/ghc/win-linker-no-ucrt.patch new file mode 100644 index 0000000000..4b24a25269 --- /dev/null +++ b/overlays/patches/ghc/win-linker-no-ucrt.patch @@ -0,0 +1,16 @@ +diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c +index c404992..fd060e4 100644 +--- a/rts/linker/PEi386.c ++++ b/rts/linker/PEi386.c +@@ -1132,6 +1132,11 @@ lookupSymbolInDLLs ( const SymbolName* lbl, ObjectCode *dependent ) + for (o_dll = opened_dlls; o_dll != NULL; o_dll = o_dll->next) { + /* debugBelch("look in %ls for %s\n", o_dll->name, lbl); */ + ++ if (wcsncmp(o_dll->name,WSTR("ucrtbase.dll"),wcslen(WSTR("ucrtbase.dll"))) == 0) { ++ IF_DEBUG(linker, debugBelch("warning: ignoring %s\n", o_dll->name)); ++ continue; ++ } ++ + sym = GetProcAddress(o_dll->instance, lbl+STRIP_LEADING_UNDERSCORE); + if (sym != NULL) { + /*debugBelch("found %s in %s\n", lbl+1,o_dll->name);*/ diff --git a/overlays/wine.nix b/overlays/wine.nix index 076e2b1f10..27fa9a3f78 100644 --- a/overlays/wine.nix +++ b/overlays/wine.nix @@ -2,21 +2,10 @@ # files from TH code) for GHC built with msvcrt (ghc<9.6). # This will inevitably replace *any* wine version. Thus this might not really be what we ultimately want. # Wine 5.4 does not build on macOS so that is not pinned and TH code will probably break. -final: prev: -prev.lib.optionalAttrs (!prev.stdenv.hostPlatform.isDarwin) { - winePackages = prev.winePackages // { - minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { - name = "wine-5.4"; - version = "5.4"; - src = prev.fetchurl { - url = "https://dl.winehq.org/wine/source/5.x/wine-5.4.tar.xz"; - sha256 = "sha256-Sz4rD/pUFfGZVA5gUcKMOXb86R6lv7LPSgmcJXMXBSw="; - }; - patches = [] ++ [ ./patches/wine-add-dll-directory.patch ]; - # Turning off the tests as there is a problem with the `schedsvc` test. - # With recent nixpkgs both the IDL files generate `_c.c` files with - # `handle_t rpc_handle` and that results in a linker error (duplicate symbols). - configureFlags = oldAttrs.configureFlags or [] ++ ["--disable-tests"]; - }); - }; -} \ No newline at end of file +final: prev: { + winePackages = prev.winePackages // { + minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [] ++ [ ./patches/wine-add-dll-directory.patch ]; + }); + }; +} From 669f3068f594007c990a1e56c53b6756e8583d58 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 7 Sep 2023 12:31:23 +0000 Subject: [PATCH 06/10] Revert "Use Cabal 3.10 when building hoogle" This reverts commit f23f30705f9e2f2627eba4dc74088c89693d36a4. --- builder/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 873848904b..b12fd97b32 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -67,9 +67,6 @@ let in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc928" "hoogle" { inherit evalPackages; version = "5.0.18.3"; - cabalProjectLocal = '' - constraints: setup.Cabal >=3.10 - ''; # index-state = pkgs.haskell-nix.internalHackageIndexState; index-state = "2023-06-05T00:00:00Z"; } From a553be8acee29ebbeb0f2b35a08601bf84bf3ac6 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 7 Sep 2023 12:32:06 +0000 Subject: [PATCH 07/10] revert flake.lock change --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 924cb174ac..4e7e2ea7ce 100644 --- a/flake.lock +++ b/flake.lock @@ -225,11 +225,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1691634696, - "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", + "lastModified": 1688517130, + "narHash": "sha256-hUqfxSlo+ffqVdkSZ1EDoB7/ILCL25eYkcCXW9/P3Wc=", "ref": "hkm/remote-iserv", - "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", - "revCount": 14, + "rev": "9151db2a9a61d7f5fe52ff8836f18bbd0fd8933c", + "revCount": 13, "type": "git", "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" }, From 035d528422856800daabc7237b16139ff5a1961b Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 7 Sep 2023 12:36:46 +0000 Subject: [PATCH 08/10] Restrict range of patch --- modules/configuration-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/configuration-nix.nix b/modules/configuration-nix.nix index 76e4960326..d0d6084210 100644 --- a/modules/configuration-nix.nix +++ b/modules/configuration-nix.nix @@ -44,7 +44,7 @@ in { (fromUntil "3.2.0.0" "3.5" ../overlays/patches/Cabal/Cabal-3.0.0.0-no-final-checks.diff) (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/Cabal-3.6.0.0-drop-pkg-db-check.diff) (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/Cabal-3.6.0.0-no-final-checks.diff) - (fromUntil "3.6.0.0" "3.11" ../overlays/patches/Cabal/9220.patch) + (fromUntil "3.10" "3.11" ../overlays/patches/Cabal/9220.patch) ]; # These two patches are: From 9dc42767f3efb91139a65686b0934d95a0cb490d Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 8 Sep 2023 11:46:10 +0800 Subject: [PATCH 09/10] no-ucrt from 9.6 onwards only --- overlays/bootstrap.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 893c97f9b5..f25bea5143 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -193,7 +193,7 @@ in { # by another crt. ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "8.10" "9.10" ./patches/ghc/win-linker-no-ucrt.patch) # Nixos/nixpkgs is mscvrt for now, thus we must disable ucrt in ghc, otherwise we end up with broken linking. - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/no-ucrt.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6" "9.10" ./patches/ghc/no-ucrt.patch) # the following is needed for cardano-prelude as it uses closure_sizeW :-/ ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/win-add-closure_sizeW-to-rtssyms.patch) ++ fromUntil "9.4.5" "9.4.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch From 83cd3e4627b461eb7a21110552a595710bf290f7 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 8 Sep 2023 13:40:10 +0800 Subject: [PATCH 10/10] closure_sizeW also only from 9.6 --- overlays/bootstrap.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index f25bea5143..872c8555bd 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -195,7 +195,7 @@ in { # Nixos/nixpkgs is mscvrt for now, thus we must disable ucrt in ghc, otherwise we end up with broken linking. ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6" "9.10" ./patches/ghc/no-ucrt.patch) # the following is needed for cardano-prelude as it uses closure_sizeW :-/ - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.1" "9.10" ./patches/ghc/win-add-closure_sizeW-to-rtssyms.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6" "9.10" ./patches/ghc/win-add-closure_sizeW-to-rtssyms.patch) ++ fromUntil "9.4.5" "9.4.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.2" "9.8" ./patches/ghc/ghc-9.4.5-include-order-fix.patch ++ fromUntil "9.6.1" "9.10" ./patches/ghc/MR10116.patch