Skip to content

Commit 746a154

Browse files
committed
Set -dynamic-system-linker if musl and not x86_64
1 parent d1321de commit 746a154

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/ghc/default.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ let
322322
# `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows
323323
+ lib.optionalString (enableRelocatedStaticLibs && targetPlatform.isx86_64 && !targetPlatform.isWindows)
324324
" '*.*.ghc.*.opts += -fexternal-dynamic-refs'"
325-
+ lib.optionalString targetPlatform.isAndroid
325+
# The fact that we need to set this here is pretty idiotic. GHC should figure this out on it's own.
326+
# Either have a runtime flag/setting to disable it or if dlopen fails, remember that it failed and
327+
# fall back to non-dynamic. We only have x86_64 dynamic linker with musl.
328+
+ lib.optionalString targetPlatform.isAndroid || (targetPlatform.isMusl && !targetPlatform.isx86)
326329
" '*.ghc.cabal.configure.opts += --flags=-dynamic-system-linker'"
327330
# The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
328331
# iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH

0 commit comments

Comments
 (0)