-
Notifications
You must be signed in to change notification settings - Fork 83
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
Recognize get_cpu_value "darwin_arm64" #191
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me...
In regards to M11 CI issues - I do not have hardware to investigate
I've tried running tests on my machine with Rosetta, got the same errors for tests. From logs, both
I don't quite understand how that could happen. Both I'll check the failure in examples a bit later. Without Rosetta, when I specified
I guess, |
In examples with Rosetta and nix:
With
Overall it seems like something isn't right with more complex toolchains there. |
Thanks for looking into this @aherrmann . I recently got an M1-based Macbook and I'm interested in getting this toolchain working. I was hacking around with your
Thanks again. |
@ryanbujnowicz Thank you for looking into this! Yes, I think you're right on all accounts. I've pushed changes to fix it. |
Rebased on master |
I cannot meaningfully test this, don't have M1. Removed myself from reviewers. |
I was able to get this working, but I had to make one additional tweak/hack to work around My toolchain is configured as follows: In
In
|
To produce constraints consistent with the other toolchains. The difference is that the posix toolchain does not set the target_constraints.
@andyscott Thanks for testing! Yes, indeed, full M1 support requires some more changes to the cc toolchain. The focus of this PR was solely on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but due to lack of an M1 machine I could not test this myself.
Before, the `nixUnstable` package from nixpkgs commit 15d1011615d16a8b731adf28e2cfc33481102780 was used which would resolve to nix version 2.4pre7534_b92f58f6. This old version of nixpkgs from May 2020 lacks support for MacOS Big Sur (11) which is only available as of nixpkgs release 21.11 and thus running Bazel failed: ``` $ bazel test //... error: cannot coerce null to a string at /private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/remote_nixpkgs_for_nix_unstable/pkgs/stdenv/generic/make-derivation.nix:192:34: 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { (use '--show-trace' to show detailed location information) INFO: Repository nix-unstable instantiated at: /Users/builder/claudio-rules_nixpkgs/WORKSPACE:41:16: in <toplevel> /private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/rules_nixpkgs_core/nixpkgs.bzl:382:21: in nixpkgs_package Repository rule _nixpkgs_package defined at: /private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/rules_nixpkgs_core/nixpkgs.bzl:276:35: in <toplevel> ERROR: An error occurred during the fetch of repository 'nix-unstable': Traceback (most recent call last): File "/private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/rules_nixpkgs_core/nixpkgs.bzl", line 242, column 38, in _nixpkgs_package_impl exec_result = execute_or_fail( File "/private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/rules_nixpkgs_core/util.bzl", line 59, column 13, in execute_or_fail fail(""" Error in fail: Cannot build Nix attribute 'nixUnstable'. Command: [/nix/var/nix/profiles/default/bin/nix-build, "-E", "import <nixpkgs> { config = {}; overlays = []; }", "-A", "nixUnstable", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/private/var/tmp/_bazel_builder/ff9a81a9a8bde7159a03f31985635bae/external/remote_nixpkgs_for_nix_unstable/remote_nixpkgs_for_nix_unstable"] Return code: 1 ``` Switch to nix_2_4 and remove the remote_nixpkgs_for_nix_unstable repository.
Tested on an M1 successfully: ✔️ all tests passed. |
Since [rules_nixpkgs#191](tweag/rules_nixpkgs#191) has been merged, we can drop the haskell-arm-m1.patch from rules_nixpkgs. Also, rules_nixpkgs has been split into several components which need to be added explicitly in `deps.bzl`
Since [rules_nixpkgs#191] has been merged, we can drop the haskell-arm-m1.patch from rules_nixpkgs. Also, rules_nixpkgs has been split into several components which need to be added explicitly in `deps.bzl`, see [#182]. [#191]: tweag/rules_nixpkgs#191 [#182]: tweag/rules_nixpkgs#182
Since [rules_nixpkgs#191] has been merged, we can drop the `rules-nixpkgs-arm.patch` from rules_nixpkgs. Also, rules_nixpkgs has been split into several components which need to be added explicitly in `deps.bzl`, see [#182]. [#191]: tweag/rules_nixpkgs#191 [#182]: tweag/rules_nixpkgs#182
…3798) * Update `rules_nixpgks` to HEAD Since [rules_nixpkgs#191] has been merged, we can drop the `rules-nixpkgs-arm.patch` from rules_nixpkgs. Also, rules_nixpkgs has been split into several components which need to be added explicitly in `deps.bzl`, see [#182]. [#191]: tweag/rules_nixpkgs#191 [#182]: tweag/rules_nixpkgs#182 * Adapt `compatibility/deps.bzl` * Update platforms repository to version 0.0.4 It has been updated in rules_nixpkgs, so this just follows suite. * Pass through `isClang` attribute for the cc-toolchain In rules_nixpkgs, this attribute is now used to determine whether the compiler is clang, see [#216]. [#216]: tweag/rules_nixpkgs#216 CHANGELOG_BEGIN CHANGELOG_END
On an M1 Mac
get_cpu_value
will returndarwin_arm64
instead ofdarwin
.This PR adapts our platform constraint detection to take that case into account.
Note, if bazel runs as an x86_64 binary under Rosetta, then
get_cpu_value
will still reportdarwin
.So, under Rosetta this will consistently use
x86_64
constraints.This also removes an unused instance of
get_cpu_value
in the Go toolchain.