Skip to content

Conversation

lazcamus
Copy link
Contributor

@lazcamus lazcamus commented Mar 21, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

On linux arm64, rules_python using the precompiled python toolchain fails:

(11:19:15) ERROR: An error occurred during the fetch of repository 'python3':
   Traceback (most recent call last):
	File "/home/builder/.cache/bazel/_bazel_laz/99bd544777c52d5a0d8a66ea3b05626a/external/rules_python/python/private/toolchains_repo.bzl", line 81, column 13, in _resolved_interpreter_os_alias_impl
		fail("No platform declared for host OS {} on arch {}".format(os_name, arch))
Error in fail: No platform declared for host OS linux on arch aarch64

Issue Number: N/A

What is the new behavior?

It works on Linux arm64 now. rules_python tests pass on an m1 macbook pro in both OSX and Linux.

Some tests on linux-arm64 fail because bazel-integration-testing is x86 only. Here's a test.log that includes running the failed tests.

Funnily, these tests all pass on aarch64 OSX because of x86 binary emulation.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I added gen_python_config_settings() to python/versions.bzl to avoid duplicating the constraints that were already codified in the file. I don't think it'd get much (any) use? I think most rules_python users would already have this style stuff setup in their repo ... though maybe I'm just biased by the monorepo I'm working on this for.

@google-cla
Copy link

google-cla bot commented Mar 21, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

* add aarch64-unknown-linux-gnu python binary release
* unittests run & pass on my m1 macbook in OSX and Linux
    * Note: most //examples/... tests fail when run due to lack of support
      for non-x86 in https://github.com/bazelbuild/bazel-integration-testing/,
      but those failing tests pass when run directly in the directory with
      bazel
@lazcamus lazcamus force-pushed the linux-arm64-support branch from 1adaaed to f6b6c58 Compare March 21, 2022 13:25
@phlax
Copy link
Contributor

phlax commented Mar 25, 2022

just tested this out on a PR im working on (here envoyproxy/envoy#20432) and this fixes the arm build for us

would be great if this was landed (thanks @lazcamus )

Copy link
Member

@f0rmiga f0rmiga left a comment

Choose a reason for hiding this comment

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

Thanks!

for platform in TOOL_VERSIONS[python_version]["sha256"].keys()
])

def gen_python_config_settings(name = ""):
Copy link
Member

Choose a reason for hiding this comment

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

It's nice to have everything tidied up.

@f0rmiga f0rmiga merged commit ae9f24f into bazel-contrib:main Apr 8, 2022
@lazcamus lazcamus deleted the linux-arm64-support branch April 14, 2022 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants