Skip to content

swift: use stdenv libc++ on Darwin#245641

Merged
wegank merged 1 commit intoNixOS:masterfrom
reckenrode:swift-libc++
Aug 5, 2023
Merged

swift: use stdenv libc++ on Darwin#245641
wegank merged 1 commit intoNixOS:masterfrom
reckenrode:swift-libc++

Conversation

@reckenrode
Copy link
Contributor

Description of changes

Swift uses libc++ 15, but it should really be using the same libc++ from the stdenv. While not strictly needed currently, Swift 5.9 will support C++ interop. If Swift is not using the stdenv C++, any C++ library used with interop would need to be rebuilt against the Swift libc++.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jul 27, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jul 27, 2023
@reckenrode
Copy link
Contributor Author

Result of nixpkgs-review pr 245641 run on aarch64-darwin 1

6 packages marked as broken and skipped:
  • jellyfin-mpv-shim
  • jellyfin-mpv-shim.dist
  • mpc-qt
  • sublime-music
  • sublime-music.dist
  • wtwitch
9 packages failed to build:
  • anki
  • anki.dist
  • anki.doc
  • anki.man
  • hydrus
  • hydrus.doc
  • mnemosyne
  • mnemosyne.dist
  • swiftPackages.swift-unwrapped
36 packages built:
  • ani-cli
  • cplay-ng
  • cplay-ng.dist
  • curseradio
  • curseradio.dist
  • darwin.openwith
  • dmlive
  • dra-cla
  • klipperscreen
  • mpv-unwrapped
  • mpv-unwrapped.dev
  • mpv-unwrapped.man
  • python310Packages.mpv
  • python310Packages.mpv.dist
  • python311Packages.mpv
  • python311Packages.mpv.dist
  • somafm-cli
  • sourcekit-lsp (swiftPackages.sourcekit-lsp)
  • subtitleedit
  • swift (swiftPackages.swift)
  • swift-format (swiftPackages.swift-format)
  • swift.man (swiftPackages.swift.man)
  • swiftPackages.XCTest
  • swiftPackages.clang
  • swiftPackages.stdenv
  • swiftPackages.swift-docc
  • swiftPackages.swift-driver
  • swiftPackages.swift-unwrapped.dev
  • swiftPackages.swift-unwrapped.doc
  • swiftPackages.swift-unwrapped.lib
  • swiftPackages.swift-unwrapped.man
  • swiftPackages.swiftNoSwiftDriver
  • swiftPackages.swiftNoSwiftDriver.man
  • swiftpm (swiftPackages.swiftpm)
  • swiftPackages.xcbuild (swiftPackages.xcodebuild)
  • ytfzf

@reckenrode
Copy link
Contributor Author

Result of nixpkgs-review pr 245641 run on x86_64-darwin 1

3 packages marked as broken and skipped:
  • darwin.openwith
  • mnemosyne
  • mnemosyne.dist
4 packages failed to build:
  • anki
  • anki.dist
  • anki.doc
  • anki.man
18 packages built:
  • sourcekit-lsp (swiftPackages.sourcekit-lsp)
  • swift (swiftPackages.swift)
  • swift-format (swiftPackages.swift-format)
  • swift.man (swiftPackages.swift.man)
  • swiftPackages.XCTest
  • swiftPackages.clang
  • swiftPackages.stdenv
  • swiftPackages.swift-docc
  • swiftPackages.swift-driver
  • swiftPackages.swift-unwrapped
  • swiftPackages.swift-unwrapped.dev
  • swiftPackages.swift-unwrapped.doc
  • swiftPackages.swift-unwrapped.lib
  • swiftPackages.swift-unwrapped.man
  • swiftPackages.swiftNoSwiftDriver
  • swiftPackages.swiftNoSwiftDriver.man
  • swiftpm (swiftPackages.swiftpm)
  • swiftPackages.xcbuild (swiftPackages.xcodebuild)

@reckenrode
Copy link
Contributor Author

  • Anki is failing to build because it depends on qtwebengine6, which is broken right now but will be fixed by darwin-stdenv: revert NIX_CC_NO_RESPONSE_FILE logic #245640.
  • Hydrus build seems to be non-deterministic. It sometimes succeeds and sometimes fails for me. 🤷🏻‍♂️
  • Mnemosyne depends on Anki and fails due to the Anki failure.
  • I don’t know why swiftPackages.swift-unwrapped is showing as failed on aarch64-darwin but the individual outputs show as succeeded.

Comment on lines 32 to 46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that llvmPackages_15 is repeated twice, can we turn this into a function, something like:

if pkgs.stdenv.isDarwin then
  # Comments here
  let makeSwiftClang = stdenvLLVM: targetLLVM:
      ...
  in
  makeSwiftClang pkgs.llvmPackages llvmPackages_15

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How’s the current push look like with the alias (swiftLlvmPackages)? I can still rework it to use a function, but it’s only going to be used right away, so it seems like it would add a limited amount of clarity.

@reckenrode reckenrode force-pushed the swift-libc++ branch 2 times, most recently from 3c58bda to 3595e01 Compare August 5, 2023 00:20
Copy link
Contributor

@tjni tjni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Swift uses libc++ 15, but it should really be using the same libc++ from
the stdenv. While not strictly needed currently, Swift 5.9 will support
C++ interop. If Swift is not using the stdenv C++, any C++ library used
with interop would need to be rebuilt against the Swift libc++.
@wegank wegank merged commit c839b1f into NixOS:master Aug 5, 2023
@reckenrode reckenrode mentioned this pull request Aug 15, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants