Skip to content

boost: fix cross-compilation for Darwin#346954

Merged
emilazy merged 3 commits intoNixOS:stagingfrom
reckenrode:push-rttvmomquwvp
Oct 11, 2024
Merged

boost: fix cross-compilation for Darwin#346954
emilazy merged 3 commits intoNixOS:stagingfrom
reckenrode:push-rttvmomquwvp

Conversation

@reckenrode
Copy link
Contributor

Darwin needs a few tweaks to cross-compile Boost. This depends on #346043.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.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.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: darwin Running or building packages on Darwin labels Oct 6, 2024
@ofborg ofborg bot requested review from hjones2199 and ivan-tkatchev October 6, 2024 23:48
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Oct 6, 2024
@reckenrode reckenrode force-pushed the reckenrode/darwin-sdk-refactor branch from ee7fb7e to 183877a Compare October 7, 2024 03:49
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
--replace "default-toolset = darwin" "default-toolset = clang-darwin"
--replace-fail "default-toolset = darwin" "default-toolset = clang-darwin"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest push drops this replacement because it fails with --replace-fail. It appears upstream has made clang the default.

@reckenrode
Copy link
Contributor Author

The nixfmt-check errors are for files not included in this PR.

@reckenrode reckenrode force-pushed the reckenrode/darwin-sdk-refactor branch from 183877a to 1fd30e4 Compare October 8, 2024 02:51
@reckenrode reckenrode force-pushed the push-rttvmomquwvp branch 2 times, most recently from 65e4ae4 to a3bf6f7 Compare October 8, 2024 03:29
@reckenrode reckenrode deleted the branch NixOS:staging October 8, 2024 03:30
@reckenrode reckenrode closed this Oct 8, 2024
@reckenrode reckenrode reopened this Oct 8, 2024
@reckenrode reckenrode force-pushed the reckenrode/darwin-sdk-refactor branch 2 times, most recently from a240201 to 4112f1a Compare October 9, 2024 02:16
Upstream defaults to clang on Darwin now instead of GCC. This
substitution doesn’t do anything.
b2 tries to invoke the linker without a prefix, which fails.
@reckenrode reckenrode force-pushed the reckenrode/darwin-sdk-refactor branch 2 times, most recently from a1adff0 to e3f2829 Compare October 10, 2024 20:25
@emilazy emilazy marked this pull request as ready for review October 10, 2024 22:52
@emilazy emilazy deleted the branch NixOS:staging October 11, 2024 00:00
@emilazy emilazy closed this Oct 11, 2024
@emilazy emilazy reopened this Oct 11, 2024
@emilazy emilazy changed the base branch from reckenrode/darwin-sdk-refactor to staging October 11, 2024 00:06
Comment on lines +40 to +42
# Upstream uses arm64, but nixpkgs uses aarch64.
substituteInPlace src/tools/clang.jam \
--replace-fail 'arch = arm64' 'arch = aarch64'
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should consider adding aliases for this to our LLVM build at some point…

Copy link
Contributor

Choose a reason for hiding this comment

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

seems like the replace-fail should be replace-warn as older boosts are breaking here. and think that the default-toolset should be added back due to older boosts as well, using replace-warn.

Copy link
Contributor

Choose a reason for hiding this comment

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

see #350658

@emilazy emilazy merged commit 38966db into NixOS:staging Oct 11, 2024
@reckenrode reckenrode deleted the push-rttvmomquwvp branch October 11, 2024 13:26
@trofi
Copy link
Contributor

trofi commented Oct 20, 2024

Bisect says 90df0c3 boost-build: fix aarch64 clang cross-compilation broke boost179 (and a few other boost versions) in staging-next and staging as:

$ nix build --no-link -f. boost179 -L
...
boost-build-boost> Running phase: unpackPhase
boost-build-boost> unpacking source archive /nix/store/p009j36gh69b1g748lg5gr0409w1a6z8-boost_1_79_0.tar.bz2
boost-build-boost> source root is boost_1_79_0
boost-build-boost> setting SOURCE_DATE_EPOCH to timestamp 1649279392 of file boost_1_79_0/tools/build/index.html
boost-build-boost> unpackPhase completed in 1 minutes 11 seconds
boost-build-boost> Running phase: patchPhase
boost-build-boost> substituteStream() in derivation boost-build-boost-1.79.0: ERROR: pattern arch\ =\ arm64 doesn't match anything in file 'src/tools/clang.jam'

@reckenrode
Copy link
Contributor Author

It also needs investigating to see whether any of those older versions of Boost still need the default-toolset replacement to use clang on Darwin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants