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

Build failure: swift #327836

Closed
XYenon opened this issue Jul 17, 2024 · 28 comments
Closed

Build failure: swift #327836

XYenon opened this issue Jul 17, 2024 · 28 comments
Labels
0.kind: build failure A package fails to build 6.topic: darwin Running or building packages on Darwin 6.topic: swift Programming language (swift.org)

Comments

@XYenon
Copy link
Member

XYenon commented Jul 17, 2024

Swift still built failed after #326588 has been merged.

Steps To Reproduce

Steps to reproduce the behavior:

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

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 👍 reaction to issues you find important.

@XYenon XYenon added the 0.kind: build failure A package fails to build label Jul 17, 2024
@thiagokokada
Copy link
Contributor

thiagokokada commented Jul 17, 2024

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
Copy link
Contributor

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
Copy link
Member Author

XYenon commented Jul 18, 2024

@aaronpkelly
Copy link

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
Copy link

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
Copy link
Contributor

yelite commented Aug 15, 2024

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
Copy link

aaronpkelly commented Aug 24, 2024

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:

  • I generated a derivation of my next system rebuild
  • looked at the dependency tree, found out which packages are pulling in swift
  • excluded them from my darwin-configuration.nix
  • repeated the above steps, removing packages until swift no longer appeared

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
Copy link
Member

emilazy commented Aug 24, 2024

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
Copy link
Member

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
Copy link
Member

emilazy commented Sep 12, 2024

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
Copy link
Member

emilazy commented Sep 12, 2024

#341384

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

@emilazy
Copy link
Member

emilazy commented Sep 12, 2024

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
Copy link
Member

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

Thanks for fixing this! 🙌

@ofalvai
Copy link
Contributor

ofalvai commented Sep 13, 2024

Works for me as well on aarch64-darwin!

@khaneliman
Copy link
Contributor

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.

YorikSar added a commit to YorikSar/dotfiles that referenced this issue Sep 22, 2024
Use known version where swift works from
NixOS/nixpkgs#327836 (comment)
@Aleksanaa
Copy link
Member

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
Copy link
Member

emilazy commented Sep 23, 2024

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
Copy link
Member Author

XYenon commented Sep 25, 2024

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
Copy link
Member

@domenkozar
Copy link
Member

Can someone try building swift on #346043

@reckenrode
Copy link
Contributor

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
Copy link
Contributor

#346947 is the follow up PR for Swift that fixes it to build with the new SDK.

@FliegendeWurst FliegendeWurst added the 6.topic: darwin Running or building packages on Darwin label Oct 16, 2024
@azuwis
Copy link
Contributor

azuwis commented Oct 30, 2024

Unfortunately swift still failed to build on hydra as of current staging-next https://hydra.nixos.org/job/nixpkgs/staging-next/swiftPackages.swift-unwrapped.aarch64-darwin/all

I've just noticed that the weird hydra darwin timeouts and the swift build failure happened to begin about the same time, both built fine at 2024-05-21, but failed after that.

https://hydra.nixos.org/job/nixpkgs/trunk/SDL_sound.aarch64-darwin/all
https://hydra.nixos.org/job/nixpkgs/trunk/swiftPackages.swift-unwrapped.aarch64-darwin/all

Are there some configuration changes in hydra around 2024-06 that cause all this?

@emilazy
Copy link
Member

emilazy commented Oct 30, 2024

I’ve asked in the infrastructure room. Though it seems hard to relate weird linker errors to builds hanging. It kind of looks more like Swift broke during a staging cycle, but the fact that it only happens on Hydra implies something must be really weird. We thought it might be the 256 file descriptor limit on Hydra that we’re in the process of fixing causing errors in the linker, but it doesn’t seem to be. If anyone wants to try and figure it out, I suggest starting at https://github.com/apple-oss-distributions/ld64/blob/47f477cb721755419018f7530038b272e9d0cdea/src/ld/InputFiles.cpp#L786 and looking for every throw that could be leading to that line of code.

@tomodachi94 tomodachi94 added the 6.topic: swift Programming language (swift.org) label Nov 7, 2024
@azuwis
Copy link
Contributor

azuwis commented Nov 11, 2024

We can close this issue now.

https://hydra.nixos.org/eval/1809886?filter=swiftPackages.swift-unwrapped&compare=1809881&full=#tabs-still-succeed

@shishkin
Copy link

shishkin commented Nov 11, 2024

I'm glad that swift now builds on hydra. However I'm still confused because when I update my flake with unstable nixpkgs channel, my config still needs to build swift from source and can't find a cached binary (in this case swift-5.8 for aarch64-darwin). What am I still missing?

@YorikSar
Copy link
Contributor

YorikSar commented Nov 11, 2024

@shishkin it has only been fixed for 3 days on master: https://hydra.nixos.org/jobset/nixpkgs/trunk#tabs-jobs (filter for swiftPackages.swift-unwrapped). It is yet to be propagated to unstable: https://nixpk.gs/pr-tracker.html?pr=354192

@shishkin
Copy link

Thanks @YorikSar! The PR tracker was the missing piece. Extra nice would be for CI pipeline to tag PRs once they reach various channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build 6.topic: darwin Running or building packages on Darwin 6.topic: swift Programming language (swift.org)
Projects
None yet
Development

No branches or pull requests