NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.82k stars 13.92k forks source link

Build failure: swift #327836

Open XYenon opened 3 months ago

XYenon commented 3 months ago

Swift still built failed after https://github.com/NixOS/nixpkgs/pull/326588 has been merged.

Steps To Reproduce

Steps to reproduce the behavior:

  1. build swift on x86_64-darwin with nixpkgs 693bc46d169f5af9c992095736e82c3488bf7dbb

Build log

swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1150/1357] Building CXX object tools/swift-ast-script/CMakeFiles/swift-ast-script.dir/ASTScriptParser.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1151/1357] Building CXX object lib/RemoteAST/CMakeFiles/swiftRemoteAST.dir/RemoteAST.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1152/1357] Linking CXX static library lib/libswiftRemoteAST.a
swift> [1153/1357] Building C object tools/libSwiftScan/CMakeFiles/libSwiftScan.dir/c-include-check.c.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1154/1357] Building CXX object tools/sil-nm/CMakeFiles/sil-nm.dir/SILNM.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1155/1357] Building C object tools/libStaticMirror/CMakeFiles/libStaticMirror.dir/c-include-check.c.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1156/1357] Building swift module _CompilerRegexParser
swift> FAILED: bootstrapping1/SwiftCompilerSources/_CompilerRegexParser.o /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/_CompilerRegexParser.o
swift> cd /tmp/nix-build-swift-5.8.drv-0/src/swift/SwiftCompilerSources && /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/bin/swiftc -c -o /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/_CompilerRegexParser.o -sdk /nix/store/4gp3glbgd0n7gincx4f7fazd2xc2gjl6-SDKs/MacOSX10.15.sdk -Xcc -isystem -Xcc /nix/store/d8qw1hx36cb2gxlq2wf1kf7mycsijin2-libcxx-16.0.6-dev/include/c++/v1 -I /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/bin/../lib -I /nix/store/4gp3glbgd0n7gincx4f7fazd2xc2gjl6-SDKs/MacOSX10.15.sdk/usr/lib -target x86_64-apple-macosx10.13 -module-name _CompilerRegexParser -emit-module -emit-module-path /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/_CompilerRegexParser.swiftmodule -parse-as-library /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/AST.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/ASTAction.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/ASTProtocols.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/Atom.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/Conditional.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/CustomCharClass.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/Group.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/MatchingOptions.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/AST/Quantification.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/CaptureList.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/CaptureStructure.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/CharacterPropertyClassification.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/CompilerInterface.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/DelimiterLexing.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/Diagnostics.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/LexicalAnalysis.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/Parse.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/Sema.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/Source.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/SourceLocation.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Parse/SyntaxOptions.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/DumpAST.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/PrettyPrinter.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/PrintAsCanonical.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/Printing/RenderRanges.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Regex/TreeProtocols.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Utility/AllScalars.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Utility/Errors.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Utility/Misc.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Utility/MissingUnicode.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift-experimental-string-processing/Sources/_RegexParser/Utility/TypeConstruction.swift -wmo -Xfrontend -validate-tbd-against-ir=none -Xfrontend -enable-experimental-cxx-interop -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -Xfrontend -disable-implicit-string-processing-module-import -O -cross-module-optimization -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/src/llvm-project/llvm/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/llvm/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/src/llvm-project/clang/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/llvm/tools/clang/include -Xcc -I -Xcc /private/tmp/nix-build-swift-5.8.drv-0/src/swift/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/swift/SwiftCompilerSources/../include -I /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources
swift> <unknown>:0: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13'
swift> <unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
swift> <unknown>:0: error: IR generation failure: Cannot read legacy layout file at '/private/tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/lib/swift/macosx/layouts-x86_64.yaml'
swift> [1157/1357] Building CXX object tools/sil-llvm-gen/CMakeFiles/sil-llvm-gen.dir/SILLLVMGen.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1158/1357] Building CXX object lib/SwiftRemoteMirror/CMakeFiles/swiftRemoteMirror.dir/__/__/stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1159/1357] Building CXX object tools/libStaticMirror/CMakeFiles/libStaticMirror.dir/libStaticMirror.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1160/1357] Building CXX object lib/StaticMirror/CMakeFiles/swiftStaticMirror.dir/ObjectFileContext.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> /tmp/nix-build-swift-5.8.drv-0/src/swift/lib/StaticMirror/ObjectFileContext.cpp:101:16: warning: variable 'Offset' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
swift>     } else if (O->getBytesInAddress() == 4) {
swift>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
swift> /tmp/nix-build-swift-5.8.drv-0/src/swift/lib/StaticMirror/ObjectFileContext.cpp:109:68: note: uninitialized use occurs here
swift>     DynamicRelocations.insert({bind.address(), {bind.symbolName(), Offset}});
swift>                                                                    ^~~~~~
swift> /tmp/nix-build-swift-5.8.drv-0/src/swift/lib/StaticMirror/ObjectFileContext.cpp:101:12: note: remove the 'if' if its condition is always true
swift>     } else if (O->getBytesInAddress() == 4) {
swift>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swift> /tmp/nix-build-swift-5.8.drv-0/src/swift/lib/StaticMirror/ObjectFileContext.cpp:93:20: note: initialize the variable 'Offset' to silence this warning
swift>     uint64_t Offset;
swift>                    ^
swift>                     = 0
swift> 1 warning generated.
swift> [1161/1357] Building CXX object tools/swift-ast-script/CMakeFiles/swift-ast-script.dir/swift-ast-script.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1162/1357] Building CXX object stdlib/public/SwiftRemoteMirror/CMakeFiles/swiftRemoteMirror-macosx-x86_64.dir/SwiftRemoteMirror.cpp.o
swift> clang-15-unwrapped: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1163/1357] Building CXX object tools/swift-ast-script/CMakeFiles/swift-ast-script.dir/ASTScriptEvaluator.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1164/1357] Building CXX object tools/swift-remoteast-test/CMakeFiles/swift-remoteast-test.dir/swift-remoteast-test.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1165/1357] Building CXX object tools/swift-refactor/CMakeFiles/swift-refactor.dir/swift-refactor.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1166/1357] Building CXX object tools/libSwiftScan/CMakeFiles/libSwiftScan.dir/libSwiftScan.cpp.o
swift> clang-15: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13' [-Woverriding-t-option]
swift> [1167/1357] Building swift module Basic
swift> FAILED: bootstrapping1/SwiftCompilerSources/Basic.o /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/Basic.o
swift> cd /tmp/nix-build-swift-5.8.drv-0/src/swift/SwiftCompilerSources && /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/bin/swiftc -c -o /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/Basic.o -sdk /nix/store/4gp3glbgd0n7gincx4f7fazd2xc2gjl6-SDKs/MacOSX10.15.sdk -Xcc -isystem -Xcc /nix/store/d8qw1hx36cb2gxlq2wf1kf7mycsijin2-libcxx-16.0.6-dev/include/c++/v1 -I /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/bin/../lib -I /nix/store/4gp3glbgd0n7gincx4f7fazd2xc2gjl6-SDKs/MacOSX10.15.sdk/usr/lib -target x86_64-apple-macosx10.13 -module-name Basic -emit-module -emit-module-path /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources/Basic.swiftmodule -parse-as-library /private/tmp/nix-build-swift-5.8.drv-0/src/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift /private/tmp/nix-build-swift-5.8.drv-0/src/swift/SwiftCompilerSources/Sources/Basic/Utils.swift -wmo -Xfrontend -validate-tbd-against-ir=none -Xfrontend -enable-experimental-cxx-interop -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -Xfrontend -disable-implicit-string-processing-module-import -O -cross-module-optimization -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/src/llvm-project/llvm/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/llvm/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/src/llvm-project/clang/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/llvm/tools/clang/include -Xcc -I -Xcc /private/tmp/nix-build-swift-5.8.drv-0/src/swift/include -Xcc -I -Xcc /tmp/nix-build-swift-5.8.drv-0/build/swift/SwiftCompilerSources/../include -I /tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping1/SwiftCompilerSources
swift> <unknown>:0: warning: overriding '-mmacos-version-min=10.15' option with '-target x86_64-apple-macosx10.13'
swift> <unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
swift> <unknown>:0: warning: template instantiation for 'std::reverse_iterator' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::__pointer' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::remove_volatile' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::initializer_list' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::conditional' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::pair' not imported: too many instantiations
swift> <unknown>:0: warning: template instantiation for 'std::__add_lvalue_reference_impl' not imported: too many instantiations
swift> <unknown>:0: error: IR generation failure: Cannot read legacy layout file at '/private/tmp/nix-build-swift-5.8.drv-0/build/swift/bootstrapping0/lib/swift/macosx/layouts-x86_64.yaml'
swift> ninja: build stopped: subcommand failed.

Additional context

Add any other context about the problem here.

Notify maintainers

@dtzWill @trepetti @dduan @Trundle @stephank

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 23.5.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.4`
 - channels(root): `""`
 - channels(user): `""`
 - nixpkgs: `/nix/store/j4jzjbr302cw5bl0n3pch5j9bh5qwmaj-source`

Add a :+1: reaction to issues you find important.

thiagokokada commented 3 months ago

Also failing in aarch64-darwin:

error: builder for '/nix/store/rcdwli2c6v6f36yqzg66yj9bgmhjg9mc-swift-5.8.drv' failed with exit code 1;
       last 25 log lines:
       > 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)
       >       __swift_FORCE_LOAD_$_swiftCompatibility56_$_SIL in libswiftCompilerModules-bootstrapping1.a(SIL.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibility56_$_Basic in libswiftCompilerModules-bootstrapping1.a(Basic.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibility56_$_Parse in libswiftCompilerModules-bootstrapping1.a(Parse.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibility56_$__CompilerRegexParser in libswiftCompilerModules-bootstrapping1.a(_CompilerRegexParser.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibility56_$_AST in libswiftCompilerModules-bootstrapping1.a(AST.o)
       >      (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibility56_$__CompilerRegexParser, __swift_FORCE_LOAD_$_swiftCompatibility56_$_SIL , __swift_FORCE_LOAD_$_swiftCompatibility56_$_Parse , __swift_FORCE_LOAD_$_swiftCompatibility56_$_Basic , __swift_FORCE_LOAD_$_swiftCompatibility56_$_Optimizer , __swift_FORCE_LOAD_$_swiftCompatibility56_$_AST )
       >   "__swift_FORCE_LOAD_$_swiftCompatibilityConcurrency", referenced from:
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Optimizer in libswiftCompilerModules-bootstrapping1.a(Optimizer.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_SIL in libswiftCompilerModules-bootstrapping1.a(SIL.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Basic in libswiftCompilerModules-bootstrapping1.a(Basic.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Parse in libswiftCompilerModules-bootstrapping1.a(Parse.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$__CompilerRegexParser in libswiftCompilerModules-bootstrapping1.a(_CompilerRegexParser.o)
       >       __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_AST in libswiftCompilerModules-bootstrapping1.a(AST.o)
       >      (maybe you meant: __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_AST, __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Basic , __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Parse , __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$__CompilerRegexParser , __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_Optimizer , __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_SIL )
       > ld: symbol(s) not found for architecture arm64
       > clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
       > [1105/1354] Building CXX object stdlib/public/RemoteInspection/CMakeFiles/swiftRemoteInspection-macosx-arm64.dir/TypeLowering.cpp.o
       > clang-15-unwrapped: warning: overriding '-mmacos-version-min=10.15' option with '-target arm64-apple-macosx10.13' [-Woverriding-t-option]
       > [1106/1354] Building CXX object stdlib/public/RemoteInspection/CMakeFiles/swiftRemoteInspection-macosx-arm64.dir/TypeRef.cpp.o
       > clang-15-unwrapped: warning: overriding '-mmacos-version-min=10.15' option with '-target arm64-apple-macosx10.13' [-Woverriding-t-option]
       > ninja: build stopped: subcommand failed.
       For full logs, run 'nix log /nix/store/rcdwli2c6v6f36yqzg66yj9bgmhjg9mc-swift-5.8.drv'.

The interesting part is that I could build this locally in my laptop (macOS 14.5), but it isn't working in GitHub Actions (also macOS 14.5). Here is my logs from GitHub Actions: https://github.com/thiagokokada/nix-configs/actions/runs/9976188278/job/27567744849.

corngood commented 3 months ago

This also builds on the darwin community builder:

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.5.0, macOS 14.5`
 - multi-user?: `yes`
 - sandbox: `relaxed`
 - version: `nix-env (Nix) 2.18.5`
 - nixpkgs: `/nix/store/qapc95ms35a2syn25wawy4byy3h1zbiv-8sjaji13jiylfr93qcx0d7fqc1f4gm1s-source`
XYenon commented 3 months ago

Hydra also failed by same errors

https://hydra.nixos.org/build/266353277/nixlog/2 https://hydra.nixos.org/build/266353180/nixlog/1

aaronpkelly commented 2 months ago

Hello swift maintainers @dtzWill @trepetti @dduan @Trundle @stephank

on the nixpkgs trunk branch, swift-unwrapped is currently failing to build on 3/4 platforms:

two of the above platforms (aarch64-darwin, x86_64-darwin) have been broken for 1.5 months :(

can you please take a look?

nixos-discourse commented 2 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/release-channels-arent-stable-for-darwin-users-swift-package-broken/50452/1

yelite commented 2 months ago

Just a note on how I workaround this, in case it's helpful for people who reach here.

I am able to build my system with the latest unstable with swift replaced by the swift from 2e92235aa591abc613504fde2546d6f78b18c0cd (the previous commit of the first failed build of swift.aarch64-darwin https://hydra.nixos.org/build/262793523). In my setup swift is only used by mpv so YMMV.

(final: prev: let
  pkgsDarwin= import darwin-nixpkgs {inherit (prev) system;};
in
  prev.lib.optionalAttrs prev.stdenv.hostPlatform.isDarwin {
    inherit (pkgsDarwin) swift;
  })

where

    darwin-nixpkgs.url = "github:nixos/nixpkgs?rev=2e92235aa591abc613504fde2546d6f78b18c0cd";

in flake.inputs.

aaronpkelly commented 1 month ago

Thanks @yelite for your flakes workaround

I don't use flakes myself, so one workaround I'm using for the moment is excluding all packages that pull in swift as a dependency.

To do this:

Here are the commands... I generated a derivation my next rebuild by using --dry-run:

$ darwin-rebuild switch --dry-run
building the system configuration...
trace: warning: nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which is currently available as nixfmt-rfc-style
these 107 derivations will be built:
/nix/store/9cvhkxbx69pd8w9kw9xwcccn98bxdwc6-swift-5.8.drv
/nix/store/52bvqras0kmavb9x7mg5x2w8bjkfwwkc-swift-wrapper-5.8.drv
/nix/store/84a9v245r6829j6spf61bbv72a70s409-fix-stdlib-path.patch.drv
...
/nix/store/i37yr1qrlg15cjrv1rj5rmvsnrwh3asa-darwin-system-24.05pre634371.29e8e22b42cc+darwin4.drv

That's my next derivation there on the last line. I turned this next derivation into a dependency tree (i output it to a file so I could browse it a bit easier):

nix-store --query --tree /nix/store/i37yr1qrlg15cjrv1rj5rmvsnrwh3asa-darwin-system-24.05pre634371.29e8e22b42cc+darwin4.drv > ~/output_dependencies_next

After squinting hard at that file for a bit, it turns out that mpv, or anything that depends on mpv, will also pull in swift as a dependency. This is unfortunate because mpv is pretty incredible and I'd hate to go without it. So, I excluded mpv, and a few other packages like yt-dlp, somafmcli and curseradio.

After excluding the above, the dependency tree of my next generation didn't include swift, and I was finally able to run darwin-rebuild switch to completion

emilazy commented 1 month ago

FWIW Swift is getting fixed as we speak as part of the macOS SDK rework. That’s still a few weeks out from landing in unstable, though.

neilmayhew commented 1 month ago

swift is now failing to build on Linux. It's a transitive dependency of deadbeef (an audio player). The direct dependency is swift-corelibs-libdispatch.

The build error occurs when running swig to create Python bindings:

FAILED: bindings/python/LLDBWrapPython.cpp bindings/python/lldb.py /build/build/lldb/bindings/python/LLDBWrapPython.cpp /build/build/lldb/bindings/python/lldb.py 
cd /build/build/lldb/bindings/python && /nix/store/alain6ji648fj2fl073sag1324xr9ivd-python3-3.12.5-env/bin/python3.12 /build/src/llvm-project/lldb/bindings/prepare_bindings.py --srcRoot=/build/src/llvm-project/lldb --targetDir=/build/build/lldb/bindings/python --cfgBldDir=/build/build/lldb/bindings/python --prefix=/build/build/lldb --swig-executable=/nix/store/ssm2qdxyzffs94ivzs2irblnah23b7bd-swig-4.2.1/bin/swig
ERROR:root:swig failed with error code 1: stdout=b'', stderr=b"/build/src/llvm-project/lldb/bindings/interfaces.swig:5: Error: Macro '__STDC_LIMIT_MACROS' redefined,\n:EOF: Error: previous definition of '__STDC_LIMIT_MACROS'.\n"
ERROR:root:command line:
/nix/store/ssm2qdxyzffs94ivzs2irblnah23b7bd-swig-4.2.1/bin/swig -c++ -shadow -python -features autodoc -threads -I/build/src/llvm-project/lldb/include -I/build/src/llvm-project/lldb/bindings -I/build/src/llvm-project/lldb/bindings/python -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -outdir /build/build/lldb/bindings/python -o /build/build/lldb/bindings/python/LLDBWrapPython.cpp /build/src/llvm-project/lldb/bindings/python/python.swig
emilazy commented 1 month ago

It’s a SWIG 4 issue; I’m working on it.

FWIW the Darwin SDK rework is not going to significantly change a lot of the problems with the Swift derivation. It’s pretty unmaintainable right now. If anyone is strongly invested in Swift, I strongly suggest trying to factor out their LLVM from the core Swift derivations. Right now it spends so much time building its own LLVM and Clang and so on. I don’t know whether the use of their specific LLVM fork is mandatory. If it isn’t, then we should just use the existing packages from Nixpkgs. If it is required, then it should at least be built with the LLVM package machinery we already have in‐tree so that we don’t have to duplicate patches and other complexity.

emilazy commented 1 month ago

https://github.com/NixOS/nixpkgs/pull/341384

(This won’t fix the Darwin problems or Hydra weirdness though.)

emilazy commented 1 month ago

The PR has now been merged and I successfully built Swift on aarch64-linux and x86_64-darwin. Would be good to hear more build reports to see if the problem here is fixed. We still don’t know what’s up with the builds on Hydra, though.

neilmayhew commented 1 month ago

Works for me, using commit 418918ebb102 from master, on an x86_64-linux system.

Thanks for fixing this! :raised_hands:

ofalvai commented 1 month ago

Works for me as well on aarch64-darwin!

khaneliman commented 4 weeks ago

The PR has now been merged and I successfully built Swift on aarch64-linux and x86_64-darwin. Would be good to hear more build reports to see if the problem here is fixed. We still don’t know what’s up with the builds on Hydra, though.

Thanks Emily, i hadn't been using swift stuff for a bit and can confirm it fixed the issues I was having on my builds.

Aleksanaa commented 3 weeks ago

The PR has now been merged and I successfully built Swift on aarch64-linux and x86_64-darwin. Would be good to hear more build reports to see if the problem here is fixed. We still don’t know what’s up with the builds on Hydra, though.

Does hydra weirdness mean this? https://hydra.nixos.org/build/272581651/nixlog/1

emilazy commented 3 weeks ago

Yes. The hope is that Randy’s SDK rework will make it go away, but I don’t think anyone understands it. It builds successfully locally for everyone, as far as I know.

XYenon commented 3 weeks ago

The PR has now been merged and I successfully built Swift on aarch64-linux and x86_64-darwin. Would be good to hear more build reports to see if the problem here is fixed. We still don’t know what’s up with the builds on Hydra, though.

I have tried this on macOS 15.0 x86_64 and it builds failed 😭

 - system: `"x86_64-darwin"`
 - host os: `Darwin 24.0.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `relaxed`
 - version: `nix-env (Nix) 2.18.5`
 - nixpkgs: `/nix/store/cjz8w4dgc3rd2n3dqv5c208vygndjyba-source`

swift.log

domenkozar commented 2 weeks ago

Same failure when bumping devenv-nixpkgs: https://github.com/cachix/devenv/actions/runs/11140734654/job/30961906452?pr=1489#step:7:4516

domenkozar commented 1 week ago

Can someone try building swift on https://github.com/NixOS/nixpkgs/pull/346043

reckenrode commented 1 week ago

Can someone try building swift on #346043

Swift is definitely broken on #346043. I have a separate set of fixes for building Swift after that is merged. I’ll be opening that (and others) later today, but it won’t be able to merge until after that PR is merged.

reckenrode commented 1 week ago

https://github.com/NixOS/nixpkgs/pull/346947 is the follow up PR for Swift that fixes it to build with the new SDK.