ldc: Fix compiler and output crashing on macOS Sequoia 15.4 (#404245)

This commit is contained in:
Mathew Polzin 2025-05-06 10:48:31 -05:00 committed by GitHub
commit b098c89e70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -14,13 +14,17 @@ let
OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name;
ARCH =
if hostPlatform.isDarwin && hostPlatform.isAarch64 then "arm64" else hostPlatform.parsed.cpu.name;
version = "1.30.0";
# Work around macOS Sequoia 15.4 segfault by downgrading the bootstrap compiler - see:
# - https://github.com/NixOS/nixpkgs/issues/398443
# - https://github.com/dlang/dmd/issues/21126#issuecomment-2775948553
# TODO: Remove this when bootstrap can be upgraded to a fixed version (>= 1.41.0-beta2)?
version = if hostPlatform.isDarwin then "1.28.1" else "1.30.0";
hashes = {
# Get these from `nix store prefetch-file https://github.com/ldc-developers/ldc/releases/download/v1.19.0/ldc2-1.19.0-osx-x86_64.tar.xz` etc..
osx-x86_64 = "sha256-AAWZvxuZC82xvrW6fpYm783TY+H8k3DvqE94ZF1yjmk=";
osx-x86_64 = "sha256-mqQ+hNlDePOGX2mwgEEzHGiOAx3SxfNA6x8+ML3qYmw=";
linux-x86_64 = "sha256-V4TUzEfQhFrwiX07dHOgjdAoGkzausCkhnQIQNAU/eE=";
linux-aarch64 = "sha256-kTeglub75iv/jWWNPCn15aCGAbmck0RQl6L7bFOUu7Y=";
osx-arm64 = "sha256-Nb/owBdIeroB9jLMDvwjo8bvsTC9vFyJPLMTOMsSAd4=";
osx-arm64 = "sha256-m93rGywncBnPEWslcrXuGBnZ+Z/mNgLIaevkL/uBOu0=";
};
in
stdenv.mkDerivation {

View file

@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
callPackage,
makeWrapper,
removeReferencesTo,
@ -44,6 +45,17 @@ stdenv.mkDerivation (finalAttrs: {
# https://issues.dlang.org/show_bug.cgi?id=19553
hardeningDisable = [ "fortify" ];
# Fix output programs segfaulting on macOS Sequoia 15.4 - see:
# https://github.com/NixOS/nixpkgs/issues/398443
# https://github.com/ldc-developers/ldc/issues/4899
# TODO: Remove this when upgrading to a fixed version (>= 1.41.0-beta2)
patches = [
(fetchpatch {
url = "https://github.com/ldc-developers/ldc/commit/60079c3b596053b1a70f9f2e0cf38a287089df56.patch";
hash = "sha256-Y/5+zt5ou9rzU7rLJq2OqUxMDvC7aSFS6AsPeDxNATQ=";
})
];
postPatch =
''
patchShebangs runtime tools tests