Skip to content

Fix ghc 9 windows cross compilation #1450

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

Merged
merged 73 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f93c3b8
Fix ghc 9 windows cross compilation
hamishmack Apr 22, 2022
defbe81
Fix suffixSalt calculation
hamishmack Apr 22, 2022
0c51d98
Fix suffixSalt calculation
hamishmack Apr 22, 2022
f2fd8ba
Fix typo
hamishmack Apr 22, 2022
508ba4a
ifdLevel 0
hamishmack Apr 22, 2022
ed58fb3
Add materialized files
hamishmack Apr 22, 2022
c236a1e
ifdLevel 1
hamishmack Apr 22, 2022
be54380
ifdLevel 2
hamishmack Apr 22, 2022
e275acf
ifdLevel 3
hamishmack Apr 22, 2022
75b25bf
Fix for ghc 9.2
hamishmack Apr 22, 2022
c49da7c
Use latest wine
hamishmack Apr 22, 2022
1db60bd
Fix cabal-22 test
hamishmack Apr 22, 2022
67530ce
Use latest wine
hamishmack Apr 22, 2022
0cfd737
Use latest wine
hamishmack Apr 22, 2022
2987e63
ifdLevel 0
hamishmack Apr 22, 2022
14d8fac
ifdLevel 1
hamishmack Apr 23, 2022
c21a84d
ifdLevel 2
hamishmack Apr 23, 2022
dd9679d
ifdLevel 3
hamishmack Apr 23, 2022
225ab31
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack Apr 24, 2022
f44190f
Add exe-dlls test
hamishmack Apr 14, 2022
d0e7b1c
Windows cross compile fixes
hamishmack Apr 25, 2022
d097bea
ifdLevel 0
hamishmack Apr 25, 2022
f51fc3e
Fix lib to exe dll dependency
hamishmack Apr 25, 2022
9b2097e
Combine ghc config & build derivations
hamishmack Apr 26, 2022
aa1fc76
ifdLevel 1
hamishmack Apr 29, 2022
2cde21b
ifdLevel 2
hamishmack Apr 30, 2022
d5d9e51
ifdLevel 3
hamishmack Apr 30, 2022
b5b660a
Can't get this test working for musl either
hamishmack May 2, 2022
6a7a301
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack May 3, 2022
119e62a
Use `-j1` for 9.2 cross compilers for now
hamishmack May 3, 2022
325e08f
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack May 4, 2022
6afd599
ifdLevel 0
hamishmack May 4, 2022
4af0117
Fix for aarch64-darwin native compilation
hamishmack May 4, 2022
04231fe
ifdLevel 1
hamishmack May 5, 2022
a5a01b5
Update some darwin materializations
hamishmack May 5, 2022
4aee8cb
Update some darwin materializations
hamishmack May 5, 2022
ebca028
More materialization changes
hamishmack May 5, 2022
1233c8e
Fix for musl
hamishmack May 5, 2022
d0965ff
More materialization
hamishmack May 5, 2022
9206e7f
More materialization
hamishmack May 6, 2022
b3b8f2e
ifdLevel 2
hamishmack May 6, 2022
e2d13c5
More materialization
hamishmack May 6, 2022
76eb347
ifdLevel 3
hamishmack May 6, 2022
7684b64
More materialization files
hamishmack May 10, 2022
bbda248
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack May 12, 2022
5bff9d6
More materialization files
hamishmack May 13, 2022
3d0a139
Fix content addressing/filtering issue
hamishmack May 13, 2022
27636fb
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack May 13, 2022
a8f4a87
Possible fix for windows cross uniques
hamishmack May 14, 2022
9138738
Fix 3434.patch (arm linking issue) for ghc 9.2
hamishmack May 14, 2022
bc7cde8
Possible fix for windows cross uniques
hamishmack May 14, 2022
0d3a964
Fix 3434.patch (arm linking issue) for ghc 9.2
hamishmack May 14, 2022
6856899
Possible fix for windows cross uniques
hamishmack May 14, 2022
cfa1baf
Possible fix for windows cross uniques
hamishmack May 14, 2022
58f34b6
Possible fix for windows cross uniques
hamishmack May 14, 2022
6fe37c7
Fix 3434.patch (arm linking issue) for ghc 9.2
hamishmack May 14, 2022
386e901
Possible fix for windows cross uniques
hamishmack May 14, 2022
38e9f98
More materialization files
hamishmack May 14, 2022
48531c8
Merge remote-tracking branch 'origin/master' into hkm/windows-with-ne…
hamishmack May 14, 2022
417d0e6
ifdLevel 0
hamishmack May 14, 2022
81142f1
ifdLevel 1
hamishmack May 15, 2022
72dce55
More materialization files
hamishmack May 15, 2022
690d0f4
ifdLevel 2
hamishmack May 15, 2022
ab707ea
ifdLevel 3
hamishmack May 15, 2022
bb75d5a
More materialization files
hamishmack May 15, 2022
656818e
Fix tests
hamishmack May 17, 2022
c05123a
Avoid aarch64-linux ghc 8.6.5 in ci.nix
hamishmack May 17, 2022
4786ce0
Fix for ghcjs
hamishmack May 17, 2022
17c0392
Fix for aarch64-darwin
hamishmack May 18, 2022
2bc0588
Fix for ghcjs
hamishmack May 18, 2022
e30ce69
Try without -j1 on windows now uniques patch is updated
hamishmack May 19, 2022
16e164d
Update modules/configuration-nix.nix
hamishmack May 19, 2022
dc0d1d4
Revert "Try without -j1 on windows now uniques patch is updated"
hamishmack May 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 21 additions & 11 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ let
"--ghc-option=-fPIC" "--gcc-option=-fPIC"
]
++ map (o: ''--ghc${lib.optionalString (stdenv.hostPlatform.isGhcjs) "js"}-options="${o}"'') ghcOptions
++ lib.optional (
# GHC 9.2 cross compiler built with older versions of GHC seem to have problems
# with unique conters. Perhaps because the name changed for the counters.
# TODO This work around to use `-j1` should be removed once we are able to build 9.2 with 9.2.
haskellLib.isCrossHost
&& builtins.compareVersions defaults.ghc.version "9.2.1" >= 0
&& builtins.compareVersions defaults.ghc.version "9.3" < 0)
"--ghc-options=-j1"
);

executableToolDepends =
Expand Down Expand Up @@ -346,10 +354,14 @@ let
frameworks # Frameworks will be needed at link time
# Not sure why pkgconfig needs to be propagatedBuildInputs but
# for gi-gtk-hs it seems to help.
++ builtins.concatLists pkgconfig;
++ builtins.concatLists pkgconfig
++ lib.optionals (stdenv.hostPlatform.isWindows)
(lib.flatten component.libs
++ map haskellLib.dependToLib component.depends);

buildInputs = component.libs
++ map haskellLib.dependToLib component.depends;
buildInputs = lib.optionals (!stdenv.hostPlatform.isWindows)
(lib.flatten component.libs
++ map haskellLib.dependToLib component.depends);

nativeBuildInputs =
[shellWrappers buildPackages.removeReferencesTo]
Expand Down Expand Up @@ -482,22 +494,20 @@ let
fi
'')
# In case `setup copy` did not create this
+ (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
+ (lib.optionalString enableSeparateDataOutput ''
mkdir -p $data
'')
+ (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) (''
echo "Symlink libffi and gmp .dlls ..."
for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
done
''
# symlink all .dlls into the local directory.
# we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
# to symlink over dlls as needed.
+ ''
echo "Symlink library dependencies..."
for libdir in $(${stdenv.hostPlatform.config}-ghc-pkg field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
if [ -d "$libdir" ]; then
find "$libdir" -iname '*.dll' -exec ln -s {} $out/bin \;
fi
for p in $pkgsHostTargetAsString; do
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
find "$p" -iname '*.dll.a' -exec ln -s {} $out/bin \;
done
''))
+ (lib.optionalString doCoverage ''
Expand Down
6 changes: 3 additions & 3 deletions builder/make-config-files.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ let
${target-pkg} init $out/${packageCfgDir}

${lib.concatStringsSep "\n" (lib.mapAttrsToList flagsAndConfig {
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") component.libs
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") (lib.flatten component.libs)
# On windows also include `bin` directories that may contain DLLs
++ lib.optionals (stdenv.hostPlatform.isWindows)
(map (p: "${lib.getBin p}/bin")
(component.libs ++ lib.concatLists component.pkgconfig));
"extra-include-dirs" = map (p: "${lib.getDev p}/include") component.libs;
(lib.flatten component.libs ++ lib.concatLists component.pkgconfig));
"extra-include-dirs" = map (p: "${lib.getDev p}/include") (lib.flatten component.libs);
"extra-framework-dirs" = map (p: "${p}/Library/Frameworks") component.frameworks;
})}

Expand Down
11 changes: 8 additions & 3 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@
# aarch64-darwin requires ghc 8.10.7 and does not work on older nixpkgs
(v != "aarch64-darwin" || (
!__elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921"]
&& !__elem nixpkgsName ["R2105"]))) supportedSystems) (v: v);
&& !__elem nixpkgsName ["R2105"]))
&&
# aarch64-linux requires ghc 8.8.4
(v != "aarch64-linux" || (
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921"]
))) supportedSystems) (v: v);
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
# We need to use the actual nixpkgs version we're working with here, since the values
# of 'lib.systems.examples' are not understood between all versions
Expand All @@ -63,10 +68,10 @@
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107"]))) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (system == "x86_64-linux" &&
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc810420210212" "ghc8107"])) {
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc810420210212" "ghc8107" "ghc902" "ghc922"])) {
# Windows cross compilation is currently broken on macOS
inherit (lib.systems.examples) mingwW64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && compiler-nix-name == "ghc8107") {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922"]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
Expand Down
132 changes: 0 additions & 132 deletions compiler/ghc/configured-src.nix

This file was deleted.

Loading