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

[bazel] Use hermetic Python #1333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kon72
Copy link
Contributor

@kon72 kon72 commented Jan 20, 2024

This change removes the dependency on system Python.

Also fixes an issue where the build fails on Windows with --incompatible_strict_action_env flag specified:

'py' is not recognized as an internal or external command,
operable program or batch file.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Nice!

bazel/emscripten_toolchain/toolchain.bzl Show resolved Hide resolved
Copy link
Collaborator

@walkingeyerobot walkingeyerobot left a comment

Choose a reason for hiding this comment

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

Thanks very much!

@walkingeyerobot
Copy link
Collaborator

This change looks good, but it looks like the test failures are real. The Linux one is complaining because the user is root and the new python is insisting it shouldn't be run as root; this might just be a configuration issue? The Windows one is complaining about actual dependency failures. These need to be addressed before we can merge. I can take a closer look later this week if needed.

@kalmard0
Copy link
Contributor

Would changing the CI user to non-root be an acceptable solution here?

@walkingeyerobot
Copy link
Collaborator

I'm not terribly familiar with the inner workings of the CI, but it sounds ok to me? I don't expect many folks are running bazel as root in the real world. @sbc100 @trybka do you have any concerns here?

@allsey87
Copy link
Contributor

allsey87 commented Jul 1, 2024

@kon72 @kalmard0 was there an attempt to just use the Python interpreter directly instead of defining EMSDK_PYTHON and using the existing scripts? I think this could be done via py_binary and then passed as the tool argument (instead of path) for clang_tool etc in toolchain.bzl.

This way we could remove all the sh and bat scripts and a bunch of logic for switching between the two depending on the OS.

@allsey87
Copy link
Contributor

allsey87 commented Jul 1, 2024

Would changing the CI user to non-root be an acceptable solution here?

I'm not terribly familiar with the inner workings of the CI, but it sounds ok to me? I don't expect many folks are running bazel as root in the real world. @sbc100 @trybka do you have any concerns here?

@kalmard0 @walkingeyerobot the reason why the non-arm version of CircleCI appears to be due to the ubuntu executor using a Docker image on the CircleCI instance. I would suggest changing this back to a standard Ubuntu image unless there is a well-known reason for using Docker here.

Moreover, the windows test is probably failing since it is pinned at quite an old version of Bazel which is probably not compatible with the python_rules version that we are using in this PR.

@walkingeyerobot
Copy link
Collaborator

If you wanted to send a PR that updates the bazel version, I'd be happy to accept it. The ubuntu image thing would be more of a question for @sbc100 I think.

@allsey87
Copy link
Contributor

allsey87 commented Jul 1, 2024

If you wanted to send a PR that updates the bazel version, I'd be happy to accept it. The ubuntu image thing would be more of a question for @sbc100 I think.

I'll put it together tomorrow. Bazel 5.4.0 (used by CircleCI on Windows) is not covered by rules_python's support policy.

@sbc100 @walkingeyerobot could you two decide on what the minimum supported version of Bazel should be for emsdk? This support matrix might help.

@walkingeyerobot
Copy link
Collaborator

Let's bump it to bazel 7 then. Seems to be the oldest version that's still under active support.

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.

5 participants