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

Add better support for armv7a cross compilation #1874

Open
wants to merge 124 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
939365b
Support for armv7a-bionic (android)
angerman Feb 1, 2023
0ca227b
allow setupBuildFlags on components and packages
angerman Feb 18, 2023
c3c3ca4
android + ios: missing patches (#1884)
shumvgolove Mar 18, 2023
079fcba
Fix hadrian naming convenction
angerman Oct 7, 2023
676aab2
Fix format
angerman Oct 7, 2023
c1dfab0
newlines
angerman Oct 8, 2023
9b3230d
WIP tools
angerman Oct 10, 2023
26379ae
Add iserv logic
angerman Oct 11, 2023
44af1d4
WIP
angerman Oct 15, 2023
fc0989b
Fix 9.6.3 aarch64 outline atomics
angerman Oct 22, 2023
8c33c01
Better patch
angerman Oct 23, 2023
e8198e9
Better linux cross
angerman Oct 23, 2023
4009bb7
Fix ghc:-dynamic-system-linker for android
angerman Oct 23, 2023
0c9b2ac
Fixup arm
angerman Oct 26, 2023
90094fd
Patch only for aarch64
angerman Oct 30, 2023
79882ce
add aggregated ghc-9.6 patch
angerman Nov 1, 2023
6922b22
More android patches
angerman Nov 12, 2023
eb3d141
Adds genapply patch for 9.6
angerman Nov 13, 2023
315446d
Add [PATCH] AArch64: Fix broken conditional jumps for offsets >= 1MB
angerman Nov 12, 2023
cd404c4
Update default.nix
angerman Nov 14, 2023
72d622c
fix native musl
angerman Nov 14, 2023
2884b5f
add debug secno patch
angerman Nov 15, 2023
9ad088f
fix musl being considered stage2
angerman Nov 15, 2023
4e9820c
Allow undefined weak symbols.
angerman Nov 15, 2023
d1321de
Map missing symbols to 0xDEADBEEF.
angerman Nov 15, 2023
746a154
Set -dynamic-system-linker if musl and not x86_64
angerman Nov 15, 2023
3623f1b
proper parens
angerman Nov 15, 2023
74026f9
Add i686 cross
angerman Nov 16, 2023
b953554
more patches
angerman Nov 16, 2023
8ccbc65
:facepalm:
angerman Nov 16, 2023
12b7e01
patch interpreter also for windows.
angerman Nov 16, 2023
793163e
No dynamic loading on x86.
angerman Nov 16, 2023
8ec031e
:facepalm:
angerman Nov 16, 2023
2dfd858
Sigh
angerman Nov 16, 2023
22dae4d
Disable linux cross patch for now.
angerman Nov 16, 2023
a9035e4
Fix 32bit patch
angerman Nov 16, 2023
9b66410
No symbol loading on darwin.
angerman Nov 16, 2023
56ab95e
all ghc c files apple-a7
angerman Nov 28, 2023
8b72989
Drop duplicate patch
angerman Jan 20, 2024
d0c35e7
Fixup compilers
angerman Jan 21, 2024
ee32432
Update nixpkgs pins
hamishmack Sep 17, 2024
3d7f4c4
ifdLevel 0
hamishmack Sep 17, 2024
d7dac30
Simplify bootPkgs
hamishmack Sep 18, 2024
2ddccc0
Update materialized files
hamishmack Sep 18, 2024
aa83440
Bump nixpkgs-unstable and ghc911
hamishmack Sep 18, 2024
5ce8ded
Simplify bootPkgs
hamishmack Sep 18, 2024
f309e82
Simplify bootPkgs
hamishmack Sep 18, 2024
8c9fa55
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Sep 18, 2024
366a923
Update ghc911
hamishmack Sep 18, 2024
e76e589
Reduce the number of compilers tested
hamishmack Sep 19, 2024
915aaf4
Bump llvm for ghc >=9.10
hamishmack Sep 19, 2024
cac7369
Update patch upper bounds
hamishmack Sep 19, 2024
b9150b0
Include clang for useLLVM GHC
hamishmack Sep 19, 2024
a9e6f39
ifdLevel 1
hamishmack Sep 19, 2024
d8b5cc7
Add materialized files
hamishmack Sep 19, 2024
852d6c7
Disable haskell-gi-overloading (it's too slow to build)
hamishmack Sep 19, 2024
2a3d7f2
Update patch upper bound
hamishmack Sep 19, 2024
26e6735
ifdLevel 2
hamishmack Sep 20, 2024
663ae4f
Fixes for GHC HEAD
hamishmack Sep 20, 2024
2f22c31
ifdLevel 3
hamishmack Sep 20, 2024
7600b7f
Fixes for GHC HEAD
hamishmack Sep 21, 2024
caec44b
Fix supported-languages for GHC HEAD
hamishmack Sep 22, 2024
d55ec23
More fixes for GHC HEAD
hamishmack Sep 23, 2024
c20f0c0
Possible fix for plugin failure on aarch64-darwin
hamishmack Sep 23, 2024
7ac6c38
ifdLevel 0
hamishmack Sep 23, 2024
b0c2fb3
ifdLevel 3
hamishmack Sep 23, 2024
7a225bc
Add emar and emranlib to ghc js builds
hamishmack Sep 24, 2024
de5afd7
Fix `repo-tar` downloads
hamishmack Sep 24, 2024
4e41959
Fix `repo-tar` downloads
hamishmack Sep 24, 2024
431caa5
More fixes for ghc HEAD
hamishmack Sep 24, 2024
f474ff4
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Sep 24, 2024
6886c43
Fix for GHC 9.6 JS backend
hamishmack Sep 24, 2024
8956daa
Fix for GHC HEAD JS
hamishmack Sep 24, 2024
8b2a567
Merge branch 'hkm/nixpkgs-update' into armv7a
hamishmack Sep 25, 2024
00b830b
Merge remote-tracking branch 'origin/master' into armv7a
hamishmack Sep 25, 2024
209c2cd
fix syntax errors
hamishmack Sep 25, 2024
dd3ecbb
ifdLevel 0
hamishmack Sep 26, 2024
aec1d0b
Disable darwin on hydra for now.
hamishmack Sep 26, 2024
6b879fe
ifdLevel 1
hamishmack Sep 26, 2024
0395359
ifdLevel 2
hamishmack Sep 26, 2024
ff5049a
ifdLevel 3
hamishmack Sep 26, 2024
226e097
Fix eval
hamishmack Sep 27, 2024
bf96421
Fix patches
hamishmack Sep 27, 2024
4eaf4b5
Fix patches
hamishmack Sep 27, 2024
502db16
ifdLevel 0
hamishmack Sep 27, 2024
79350f9
ifdLevel 1
hamishmack Sep 27, 2024
48fae4a
ifdLevel 2
hamishmack Sep 27, 2024
885c207
ifdLevel 3
hamishmack Sep 27, 2024
79a0606
Add upper bound for patch
hamishmack Sep 27, 2024
d828c0b
Add ArchX86 and ArchRISCV64
hamishmack Sep 27, 2024
cac3cf7
Fix logic for iserv-syms.patch
hamishmack Sep 27, 2024
106a506
Fix logic for iserv-syms.patch
hamishmack Sep 27, 2024
6c31610
Remove old patch. Latest upstream GHC >9.6 have a better one.
hamishmack Sep 27, 2024
c8af6d6
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Sep 29, 2024
52ebca3
ifdLevel 0
hamishmack Sep 29, 2024
a70f5ad
ifdLevel 1
hamishmack Sep 29, 2024
b139433
Fix hadrian strip patch
hamishmack Sep 30, 2024
8f2754f
Fix hadrian strip patch
hamishmack Sep 30, 2024
b825a43
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Sep 30, 2024
a46fe4b
Merge branch 'hkm/nixpkgs-update' into armv7a
hamishmack Sep 30, 2024
4692b1a
Fix haddock (now that isNativeMusl works correctly)
hamishmack Sep 30, 2024
173edcc
Fix haddock (now that isNativeMusl works correctly)
hamishmack Sep 30, 2024
076782f
Avoid building source-pins on hackage (just make sure the components …
hamishmack Sep 30, 2024
321acd9
ifdLevel 2
hamishmack Sep 30, 2024
da3dd66
Merge branch 'hkm/nixpkgs-update' into armv7a
hamishmack Sep 30, 2024
ecabb6e
Fix for native musl builds
hamishmack Sep 30, 2024
922ec59
ifdLevel 3
hamishmack Sep 30, 2024
4b883cf
Add musl32 and android tests
hamishmack Sep 30, 2024
4f04b86
Add AArch32 to call-cabal-project-to-nix.nix
hamishmack Oct 1, 2024
df06075
Update iserv-proxy patches
hamishmack Oct 2, 2024
8e08834
Fix duplication of patch in overlays/bootstrap.nix
hamishmack Oct 2, 2024
e59fd8d
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Oct 2, 2024
a090d4e
Add missing materialized file
hamishmack Oct 3, 2024
06b9333
Merge remote-tracking branch 'origin/master' into hkm/nixpkgs-update
hamishmack Oct 3, 2024
e4b6e9b
Merge branch 'hkm/nixpkgs-update' into armv7a
hamishmack Oct 3, 2024
2145cdb
Remove patch already in 9.2.8
hamishmack Oct 3, 2024
159fb66
Build android compilers with nixpkgs 24.05
hamishmack Oct 3, 2024
a1e0b30
Fix gi-gtk test
hamishmack Oct 3, 2024
3e34303
Merge branch 'hkm/nixpkgs-update' into armv7a
hamishmack Oct 3, 2024
5fc3f08
Merge remote-tracking branch 'origin/master' into armv7a
hamishmack Oct 3, 2024
3521582
Merge remote-tracking branch 'origin/master' into armv7a
hamishmack Oct 7, 2024
49a2fb9
Merge remote-tracking branch 'origin/master' into armv7a
hamishmack Oct 10, 2024
057a33c
Fix eval
hamishmack Oct 14, 2024
ee588ac
Try aarch64-android-prebuilt
hamishmack Oct 14, 2024
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
10 changes: 9 additions & 1 deletion builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,15 @@ let
(enableFeature enableShared "shared")
(enableFeature enableExecutableDynamic "executable-dynamic")
(enableFeature doCoverage "coverage")
(enableFeature (enableLibraryForGhci && !stdenv.hostPlatform.isGhcjs) "library-for-ghci")
# For Android (or really anything that uses lld), -r will silently drop
# "lazy" symbols. Those are leaf symbols with no referenes. This however
# does not work when loading the objects into the linker, because then we
# occationally miss symbols when subsequent libraries depending on the one
# that dropped the symbol are loaded. bfd and lld support --whole-archive
# lld -r --whole-archive ... will _not_ drop lazy symbols. However the
# --whole-archive flag needs to come _before_ the objects, it's applied in
# sequence. The proper fix is thusly to add --while-archive to Cabal.
(enableFeature (enableLibraryForGhci && !stdenv.hostPlatform.isGhcjs && !stdenv.hostPlatform.isAndroid) "library-for-ghci")
] ++ lib.optionals (stdenv.hostPlatform.isMusl && (haskellLib.isExecutableType componentId)) [
# These flags will make sure the resulting executable is statically linked.
# If it uses other libraries it may be necessary for to add more
Expand Down
2 changes: 1 addition & 1 deletion builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let
let
haskellPackages = {
# For musl we can use haddock from the buildGHC
ghc = if stdenv.hostPlatform.isLinux && stdenv.targetPlatform.isMusl && !haskellLib.isNativeMusl
ghc = if stdenv.targetPlatform.isMusl
then ghc.buildGHC
else ghc;
inherit packages hoogle;
Expand Down
4 changes: 2 additions & 2 deletions builder/ghc-for-component-wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let
libDir = "$wrappedGhc/${configFiles.libDir}";
docDir = "$wrappedGhc/share/doc/ghc/html";
# For musl we can use haddock from the buildGHC
haddock = if stdenv.hostPlatform.isLinux && stdenv.targetPlatform.isMusl && !haskellLib.isNativeMusl
haddock = if stdenv.targetPlatform.isMusl
then ghc.buildGHC
else ghc;

Expand Down Expand Up @@ -125,7 +125,7 @@ let
done

''
+ lib.optionalString (stdenv.targetPlatform.isMusl && !haskellLib.isNativeMusl && builtins.compareVersions ghc.version "9.9" >0) ''
+ lib.optionalString (stdenv.targetPlatform.isMusl && builtins.compareVersions ghc.version "9.9" >0) ''
ln -s $wrappedGhc/bin/${ghcCommand}-iserv $wrappedGhc/bin/ghc-iserv
ln -s $wrappedGhc/bin/${ghcCommand}-iserv-prof $wrappedGhc/bin/ghc-iserv-prof
''
Expand Down
23 changes: 13 additions & 10 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2405") {
ghc96 = false;
ghc98 = false;
ghc910 = true;
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
ghc810 = true;
ghc92 = false;
Expand All @@ -81,30 +82,32 @@
let lib = nixpkgs.lib;
in lib.optionalAttrs (nixpkgsName == "unstable"
&& (__match ".*llvm" compiler-nix-name == null)
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"])
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"])
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
)) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (
(__match ".*llvm" compiler-nix-name == null)
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc91120240918"]) # Including GHC HEAD here because the patches for rts/RtsSymbols.c no longer apply and mingwW64 GHC build fails without them
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc91120240918"]) # Including GHC HEAD here because the patches for rts/RtsSymbols.c no longer apply and mingwW64 GHC build fails without them
|| (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"
&& (__match ".*llvm" compiler-nix-name == null)
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928" "ghc948"])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc928" "ghc948"])
|| (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 ["ghc884" "ghc902" "ghc928" "ghc948"]) {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928"]) {
inherit (lib.systems.examples) musl32 musl64 aarch64-multiplatform;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) {
inherit (lib.systems.examples) aarch64-android-prebuilt armv7a-android-prebuilt;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902"]) {
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
inherit (lib.systems.examples) aarch64-multiplatform-musl;
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902"]) {
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902"]) {
inherit (lib.systems.examples) aarch64-multiplatform-musl;
};
isDisabled = d: d.meta.disabled or false;
Expand Down
34 changes: 23 additions & 11 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ let self =

, enableDWARF ? false

, enableTerminfo ?
, enableTerminfo ? !stdenv.targetPlatform.isAndroid &&
# Terminfo does not work on older ghc cross arm and windows compilers
(!haskell-nix.haskellLib.isCrossTarget || !(stdenv.targetPlatform.isAarch64 || stdenv.targetPlatform.isWindows) || builtins.compareVersions ghc-version "8.10" >= 0)
(!haskell-nix.haskellLib.isCrossTarget || !(stdenv.targetPlatform.isAarch32 || stdenv.targetPlatform.isAarch64 || stdenv.targetPlatform.isWindows) || builtins.compareVersions ghc-version "8.10" >= 0)

, # Wheter to build in NUMA support
enableNUMA ? true
Expand Down Expand Up @@ -169,8 +169,9 @@ let
WITH_TERMINFO=NO
''
# musl doesn't have a system-linker. Only on x86, and on x86 we need it, as
# our elf linker for x86_64 is broken.
+ lib.optionalString (targetPlatform.isAndroid || (targetPlatform.isMusl && !targetPlatform.isx86)) ''
# our elf linker for x86_64 is broken. The i686 one seems also to not exist.
# So it's really _just_ x86_64.
+ lib.optionalString (targetPlatform.isAndroid || (targetPlatform.isMusl && !targetPlatform.isx86_64)) ''
compiler_CONFIGURE_OPTS += --flags=-dynamic-system-linker
''
# While split sections are now enabled by default in ghc 8.8 for windows,
Expand All @@ -183,6 +184,8 @@ let
SplitSections = NO
'' + lib.optionalString (!enableLibraryProfiling) ''
BUILD_PROF_LIBS = NO
'' + lib.optionalString (disableLargeAddressSpace) ''
libraries/base_CONFIGURE_OPTS += --configure-option=--with-libcharset=no
'';

# `--with` flags for libraries needed for RTS linker
Expand Down Expand Up @@ -216,7 +219,10 @@ let
# https://gitlab.haskell.org/ghc/ghc/-/issues/23188
# https://github.com/haskell/cabal/issues/8882
"fp_cv_prog_ar_supports_dash_l=no"
] ++ lib.optional (targetPlatform.isGhcjs) "--target=javascript-unknown-ghcjs"; # TODO use configurePlatforms once tripple is updated in nixpkgs
] ++ lib.optionals (targetPlatform.isDarwin) [
"--without-libcharset"
] ++ lib.optional (targetPlatform.isGhcjs) "--target=javascript-unknown-ghcjs" # TODO use configurePlatforms once tripple is updated in nixpkgs
;

# Splicer will pull out correct variations
libDeps = platform: lib.optional (enableTerminfo && !targetPlatform.isGhcjs) [ targetPackages.ncurses targetPackages.ncurses.dev ]
Expand Down Expand Up @@ -244,7 +250,7 @@ let
# for musl only; but I'd like to stay far away from the unnecessary
# bindist logic as we can. It's slow, and buggy, and doesn't provide any
# value for us.
installStage1 = useHadrian && (haskell-nix.haskellLib.isCrossTarget || stdenv.targetPlatform.isMusl);
installStage1 = useHadrian && (with haskell-nix.haskellLib; isCrossTarget || isNativeMusl);

hadrian =
let
Expand Down Expand Up @@ -339,7 +345,10 @@ let
" '*.ghc.cabal.configure.opts += --flags=-dynamic-system-linker'"
# The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
# iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH
# + lib.optionalString (targetPlatform.???) "'*.rts.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
# FIXME: we should have iOS as an argument to this derivation, and then make this, as well as
# disableLargeAddress space conditional on iOS = true.
+ lib.optionalString (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64)
" '*.*.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
# For GHC versions in the 9.x range that don't support the +native_bignum flavour transformer yet
+ lib.optionalString ((enableNativeBignum && !hadrianHasNativeBignumFlavour))
" --bignum=native"
Expand Down Expand Up @@ -452,7 +461,10 @@ stdenv.mkDerivation (rec {
export NIX_LDFLAGS+=" -rpath $out/lib/${targetPrefix}ghc-${ghc-version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
'' +
# we really want "+armv7-a,+soft-float,+neon" as features, but llvm will
# fail with those :facepalm:
lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
Expand Down Expand Up @@ -527,7 +539,7 @@ stdenv.mkDerivation (rec {
++ lib.optional stdenv.targetPlatform.isMusl "pie"
++ lib.optional enableDWARF "fortify";

postInstall = lib.optionalString (enableNUMA && targetPlatform.isLinux) ''
postInstall = lib.optionalString (enableNUMA && targetPlatform.isLinux && !targetPlatform.isAarch32 && !targetPlatform.isAndroid) ''
# Patch rts.conf to ensure libnuma can be found

for file in $(find "$out/lib" -name "rts*.conf"); do
Expand Down Expand Up @@ -721,7 +733,7 @@ stdenv.mkDerivation (rec {
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${libcxx}/lib'
find . -name 'system*.conf*'
cat mk/system-cxx-std-lib-1.0.conf
'' + lib.optionalString (installStage1 && stdenv.targetPlatform.isMusl) ''
'' + lib.optionalString (installStage1 && haskell-nix.haskellLib.isNativeMusl) ''
substituteInPlace hadrian/cfg/system.config \
--replace 'cross-compiling = YES' \
'cross-compiling = NO'
Expand Down Expand Up @@ -811,7 +823,7 @@ stdenv.mkDerivation (rec {
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${libcxx}/lib'
find . -name 'system*.conf*'
cat mk/system-cxx-std-lib-1.0.conf
'' + lib.optionalString (installStage1 && !haskell-nix.haskellLib.isCrossTarget && stdenv.targetPlatform.isMusl) ''
'' + lib.optionalString (installStage1 && haskell-nix.haskellLib.isNativeMusl) ''
substituteInPlace hadrian/cfg/system.config \
--replace 'cross-compiling = YES' \
'cross-compiling = NO'
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
callFlake = import flake-compat;

ifdLevel = 3;
runningHydraEvalTest = false;
runningHydraEvalTest = true;
compiler = "ghc928";
config = import ./config.nix;

Expand Down
10 changes: 8 additions & 2 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,14 @@ let
echo ',("target arch","${
if pkgs.stdenv.targetPlatform.isx86_64
then "ArchX86_64"
else if pkgs.stdenv.targetPlatform.isx86
then "ArchX86"
else if pkgs.stdenv.targetPlatform.isRiscV64
then "ArchRISCV64"
else if pkgs.stdenv.targetPlatform.isAarch64
then "ArchAArch64"
else if pkgs.stdenv.targetPlatform.isAarch32
then "ArchAArch32"
else if pkgs.stdenv.targetPlatform.isJavaScript
then "ArchJavaScript"
else throw "Unknown target arch ${pkgs.stdenv.targetPlatform.config}"
Expand Down Expand Up @@ -689,8 +695,8 @@ let
cabal.project.freeze
chmod +w cabal.project.freeze
''}
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
export SSL_CERT_FILE=${evalPackages.cacert}/etc/ssl/certs/ca-bundle.crt
export GIT_SSL_CAINFO=${evalPackages.cacert}/etc/ssl/certs/ca-bundle.crt

export CABAL_DIR=${
# This creates `.cabal` directory that is as it would have
Expand Down
8 changes: 5 additions & 3 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ in {
isCrossTarget = stdenv.targetPlatform != stdenv.hostPlatform
&& !(stdenv.hostPlatform.isLinux && stdenv.targetPlatform.isMusl && stdenv.hostPlatform.linuxArch == stdenv.targetPlatform.linuxArch);
# Native musl build-host-target combo
isNativeMusl = stdenv.hostPlatform.isMusl
&& stdenv.buildPlatform == stdenv.hostPlatform
&& stdenv.hostPlatform == stdenv.targetPlatform;
isNativeMusl = stdenv.targetPlatform.isMusl
&& stdenv.buildPlatform.linuxArch == stdenv.hostPlatform.linuxArch
&& stdenv.hostPlatform.linuxArch == stdenv.targetPlatform.linuxArch;

# Takes a version number, module or list of modules (for cabalProject)
# and converts it to an list of project modules. This allows
Expand Down Expand Up @@ -593,6 +593,8 @@ in {
then "arm"
else if hostPlatform.isAarch64
then "aarch64"
else if hostPlatform.isi686
then "i386"
else abort "Don't know which QEMU to use for hostPlatform ${hostPlatform.config}. Please provide qemuSuffix";

# How to run ldd when checking for static linking
Expand Down
21 changes: 17 additions & 4 deletions overlays/android.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,31 @@ _final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isAndroid ({
'';
# my current thinking is that this is due to the android toolchain using r23, api30.
});
libffi = prev.libffi.overrideAttrs (_: {
libffi = prev.libffi.overrideAttrs ( old: {
dontDisableStatic = true;
configureFlags = old.configureFlags ++ [ "--disable-shared" ];

hardeningDisable = [ "fortify" "stackprotector" "format" ];
} // prev.lib.optionalAttrs (prev.stdenv.hostPlatform.isAarch32 || prev.stdenv.hostPlatform.isAarch64) {
# see libiconv. We want to target a lower minsdk
postConfigure = ''
echo "#undef HAVE_MEMFD_CREATE" >> aarch64-unknown-linux-android/fficonfig.h
echo "#undef HAVE_MEMFD_CREATE" >> ${prev.stdenv.hostPlatform.config}/fficonfig.h
'';
});
gmp6 = (prev.gmp6.override { withStatic = true; }).overrideAttrs(_: {
gmp6 = (prev.gmp6.override { withStatic = true; }).overrideAttrs(old: {
hardeningDisable = [ "fortify" "stackprotector" "format" ];
configureFlags = old.configureFlags ++ [ "--disable-shared" ];
});
zlib = prev.zlib.override { shared = false; static = true; };
# kernel tls (ktls) doesn't work with the android kernel. And will complain
# about lots of implicitly declared functions and undeclared identifiers,
# because the android (linux) kernel doesn't expose those.
openssl = prev.openssl.override { static = true; enableKTLS = false; };

}) // prev.lib.optionalAttrs (prev.stdenv.targetPlatform.isAndroid && (!prev.stdenv.hostPlatform.useAndroidPrebuilt)) ({
bionic = prev.bionic.override { enableStatic = true; };
# we still need the shared libraries to link against on the platform. GHC
# has been neutered to not even try loading shared libs and will use dynamic ones.
# We also link iserv against the static libs, so that we have a fully static
# android (bionic/linux) iserv we can execute on glibc/linux.
bionic = prev.bionic.override { enableStatic = true; enableShared = true; };
})
Loading
Loading