diff --git a/ci.nix b/ci.nix index e02e0d7915..bb6d797f7b 100644 --- a/ci.nix +++ b/ci.nix @@ -102,6 +102,10 @@ && ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc947" "ghc963" (ghc980X nixpkgs) (ghc99X nixpkgs)]) || (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity inherit (lib.systems.examples) mingwW64; + } // lib.optionalAttrs (nixpkgsName == "unstable" + && ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc947" "ghc963" (ghc980X nixpkgs) (ghc99X nixpkgs)]) + || (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity + inherit (lib.systems.examples) ucrt64; } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc947" "ghc963" (ghc980X nixpkgs) (ghc99X nixpkgs)]) { # Musl cross only works on linux # aarch64 cross only works on linux diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index fb53983c03..b9eed40345 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -206,13 +206,15 @@ in { # 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.8" ./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.6" ./patches/ghc/no-ucrt-9.4.patch) - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.1" "9.6.3" ./patches/ghc/no-ucrt-9.6.patch) - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.3" "9.8" ./patches/ghc/no-ucrt-9.6.3.patch) - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.8" "9.9" ./patches/ghc/no-ucrt-9.8.patch) - ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.9" "9.10" ./patches/ghc/no-ucrt-9.9.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.libc != "ucrt") ( + final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "8.10" "9.8" ./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.6" ./patches/ghc/no-ucrt-9.4.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.1" "9.6.3" ./patches/ghc/no-ucrt-9.6.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.3" "9.8" ./patches/ghc/no-ucrt-9.6.3.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.8" "9.9" ./patches/ghc/no-ucrt-9.8.patch) + ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.9" "9.10" ./patches/ghc/no-ucrt-9.9.patch) + ) ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.4.7" "9.5" ./patches/ghc/revert-289547580b6f2808ee123f106c3118b716486d5b.patch) ++ final.lib.optionals (final.stdenv.targetPlatform.isWindows) (fromUntil "9.6.3" "9.10" ./patches/ghc/revert-289547580b6f2808ee123f106c3118b716486d5b.patch) # the following is needed for cardano-prelude as it uses closure_sizeW :-/ @@ -1019,8 +1021,9 @@ in { bootPkgs = bootPkgsGhc94 // { ghc = if final.stdenv.buildPlatform != final.stdenv.targetPlatform - then final.buildPackages.buildPackages.haskell-nix.compiler.ghc962 - else final.buildPackages.buildPackages.haskell.compiler.ghc962 + then final.buildPackages.buildPackages.haskell-nix.compiler.ghc963 + else final.buildPackages.buildPackages.haskell.compiler.ghc963 + or final.buildPackages.buildPackages.haskell.compiler.ghc962 or final.buildPackages.buildPackages.haskell.compiler.ghc945 or final.buildPackages.buildPackages.haskell.compiler.ghc944 or final.buildPackages.buildPackages.haskell.compiler.ghc943; diff --git a/overlays/mingw_w64.nix b/overlays/mingw_w64.nix index 20772abe6e..77198c5eaf 100644 --- a/overlays/mingw_w64.nix +++ b/overlays/mingw_w64.nix @@ -69,14 +69,14 @@ let ################################################################################ # Build logic (TH support via remote iserv via wine) # - setupBuildFlags = map (opt: "--ghc-option=" + opt) (lib.optionals hostPlatform.isWindows [ + setupBuildFlags = map (opt: "--ghc-option=" + opt) (lib.optionals hostPlatform.isWindows ([ "-fexternal-interpreter" "-pgmi" "${wineIservWrapper}/bin/iserv-wrapper" # TODO: this should be automatically injected based on the extraLibrary. "-L${mingw_w64_pthreads}/lib" "-L${mingw_w64_pthreads}/bin" "-L${gmp}/lib" - ]); + ])); ################################################################################ # Test logic via wine diff --git a/overlays/patches/ghc/win-add-tzset-to-rtssyms.patch b/overlays/patches/ghc/win-add-tzset-to-rtssyms.patch index 20c4be8aaa..8c01301d2e 100644 --- a/overlays/patches/ghc/win-add-tzset-to-rtssyms.patch +++ b/overlays/patches/ghc/win-add-tzset-to-rtssyms.patch @@ -2,12 +2,14 @@ diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 10efb2a..d8ea070 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c -@@ -163,7 +163,9 @@ extern char **environ; +@@ -163,7 +163,11 @@ extern char **environ; SymI_HasProto(__mingw_vfprintf) \ /* ^^ Need to figure out why this is needed. */ \ SymI_HasProto(closure_sizeW_) \ - /* ^^ This one needed for cardano-prelude m( */ + /* ^^ This one needed for cardano-prelude m( */ \ ++ SymI_NeedsProto(_tzset) \ ++ /* ^^ This one needed for time, tzset deprecated */\ + SymI_NeedsProto(tzset) \ + /* ^^ This one needed for unix-time */ #else diff --git a/overlays/windows.nix b/overlays/windows.nix index 467086a900..172cb3c150 100644 --- a/overlays/windows.nix +++ b/overlays/windows.nix @@ -17,6 +17,11 @@ final: prev: mfpr = if !prev.stdenv.hostPlatform.isWindows then prev.mpfr else prev.mfpr.overrideAttrs (drv: { configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ]; }); +} // prev.lib.optionalAttrs (prev.stdenv.hostPlatform.isWindows && prev.stdenv.hostPlatform.libc == "ucrt") { + windows = prev.windows // { + # TODO update stdenv.cc so that the wrapper adds -D_UCRT for libc=="ucrt" + mingw_w64_pthreads = prev.windows.mingw_w64_pthreads.overrideAttrs { CPPFLAGS = "-D_UCRT"; }; + }; } // { libmpc = if !prev.stdenv.hostPlatform.isWindows then prev.libmpc else prev.libmpc.overrideAttrs (drv: { configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ]; diff --git a/test/th-dlls/default.nix b/test/th-dlls/default.nix index f9ff83227d..5d0938aab3 100644 --- a/test/th-dlls/default.nix +++ b/test/th-dlls/default.nix @@ -24,7 +24,10 @@ in recurseIntoAttrs { # the macOS linker tries to load `clang++` :facepalm: (stdenv.hostPlatform.isDarwin && compareGhc "9.4.0" >= 0) || # On aarch64 this test also breaks form musl builds (including cross compiles on x86_64-linux) - (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isMusl); + (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isMusl) || + # broken on ucrt64 windows + (stdenv.hostPlatform.libc == "ucrt") + ; ifdInputs = { inherit (project true) plan-nix;