Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try ucrt64 #2083

Merged
merged 11 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 12 additions & 9 deletions overlays/bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 :-/
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions overlays/mingw_w64.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion overlays/patches/ghc/win-add-tzset-to-rtssyms.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions overlays/windows.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
Expand Down
5 changes: 4 additions & 1 deletion test/th-dlls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down