Skip to content

Commit

Permalink
swift: Workaround Hydra darwin build problem
Browse files Browse the repository at this point in the history
When the host platform is darwin, building swift on Hydra and Github Actions
with ninja 1.12 will both give the same error:

```
ld: warning: directory not found for option '-L/nix/store/g9rbp9m6vs1xj4jl6b6vjb6bm8kgr107-SDKs/MacOSX10.15.sdk/usr/lib/swift'
...
ld: warning: Could not find or use auto-linked library 'swiftCompatibility56'
Undefined symbols for architecture arm64:
  "__swift_FORCE_LOAD_$_swiftCompatibility56", referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibility56_$_Optimizer in libswiftCompilerModules-bootstrapping1.a(Optimizer.o)
  ...
```

Beware the failure does not happen on developers' local machines.

Until we find out the exact cause, pin ninja to version 1.11 to workaround the problem.
  • Loading branch information
azuwis committed Nov 7, 2024
1 parent 9c87fcc commit b1e157d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkgs/development/compilers/swift/compiler/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ let
'';
};

# https://github.com/NixOS/nixpkgs/issues/327836
# Fail to build with ninja 1.12 on Hydra when host platform is darwin, but
# not on developers' local machines.
# Until we find out the exact cause, follow [swift upstream][1], pin ninja
# to version 1.11.1.
# [1]: https://github.com/swiftlang/swift/pull/72989
ninja' = ninja.overrideAttrs (old: rec {
version = "1.11.1";
src = old.src.override {
rev = version;
hash = "sha256-LvV/Fi2ARXBkfyA1paCRmLUwCh/rTyz+tGMg2/qEepI=";
};
patches = [ ];
});

in stdenv.mkDerivation {
pname = "swift";
inherit (sources) version;
Expand All @@ -199,7 +214,7 @@ in stdenv.mkDerivation {
nativeBuildInputs = [
cmake
git
ninja
ninja'
perl # pod2man
pkg-config
python3
Expand Down

0 comments on commit b1e157d

Please sign in to comment.