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

build: don't pass python override to V8 build #38969

Closed
wants to merge 1 commit into from

Conversation

richardlau
Copy link
Member

If the configure.py script is executed by a Python binary that is
not the one on the PATH it will create a python symlink in
out/tools/bin and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to python execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up python from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

Refs: #38791 (comment)

If we land this I need to undo the change in #36691 (comment) to force configure to run with Python 2 to allow Node.js' to autodetect Python 3 again (and this PR should allow V8 to then build with python pointing to Python 2).

cc @targos @nodejs/v8-update

@github-actions github-actions bot added needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels Jun 8, 2021
@nodejs-github-bot

This comment has been minimized.

@richardlau
Copy link
Member Author

If we land this I need to undo the change in #36691 (comment) to force configure to run with Python 2 to allow Node.js' to autodetect Python 3 again (and this PR should allow V8 to then build with python pointing to Python 2).

On second thought, since the V8 CI is currently broken anyway after #38867 I'll update the job now and we can verify that this PR fixes it.

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

RSLGTM

@targos
Copy link
Member

targos commented Jun 8, 2021

+1 to fast-track if V8 CI is fixed

@richardlau
Copy link
Member Author

I've undone the previous change to the V8 CI that was running python ./configure.py to force building Node.js with Python 2 back to ./configure so that it autodetects Python 3 again.

Build against master (expected to fail as V8 will attempt to build with Python 3): https://ci.nodejs.org/job/node-test-commit-v8-linux/4032/

Build with this PR (expected to pass): https://ci.nodejs.org/job/node-test-commit-v8-linux/4033/

@richardlau richardlau added the wip Issues and PRs that are still a work in progress. label Jun 8, 2021
@richardlau
Copy link
Member Author

richardlau commented Jun 8, 2021

Needs a bit more work. With this PR V8 does build successfully but then we end up back in our Makefile to run the V8 tests and the override written to config.mk is in effect which makes the V8 test runner run with Python 3 which then falls over.

node/Makefile

Lines 652 to 658 in 65a7fd3

# Related CI job: node-test-commit-v8-linux
test-v8: v8 ## Runs the V8 test suite on deps/v8.
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) $(V8_TEST_OPTIONS) \
mjsunit cctest debugger inspector message preparser \
$(TAP_V8)
$(info Testing hash seed)
$(MAKE) test-hash-seed

https://ci.nodejs.org/job/node-test-commit-v8-linux/4033/nodes=rhel7-s390x,v8test=v8test/console

15:36:35 Testing hash seed
15:36:35 deps/v8/tools/run-tests.py --gn --arch=s390x --progress=dots --timeout=120 \
15:36:35 			mjsunit cctest debugger inspector message preparser \
15:36:35 			--junitout /home/iojs/build/workspace/node-test-commit-v8-linux/v8-tap.xml
15:36:35 Traceback (most recent call last):
15:36:36   File "/home/iojs/build/workspace/node-test-commit-v8-linux/deps/v8/tools/testrunner/base_runner.py", line 273, in execute
15:36:36     parser = self._create_parser()
15:36:36   File "/home/iojs/build/workspace/node-test-commit-v8-linux/deps/v8/tools/testrunner/base_runner.py", line 319, in _create_parser
15:36:36     self._add_parser_default_options(parser)
15:36:36   File "/home/iojs/build/workspace/node-test-commit-v8-linux/deps/v8/tools/testrunner/base_runner.py", line 355, in _add_parser_default_options
15:36:36     help="The style of progress indicator (verbose, dots, "
15:36:36   File "/usr/lib64/python3.6/optparse.py", line 1000, in add_option
15:36:36     option = self.option_class(*args, **kwargs)
15:36:36   File "/usr/lib64/python3.6/optparse.py", line 581, in __init__
15:36:36     checker(self)
15:36:36   File "/usr/lib64/python3.6/optparse.py", line 670, in _check_choice
15:36:36     % str(type(self.choices)).split("'")[1], self)
15:36:36 optparse.OptionError: option -p/--progress: choices must be a list of strings ('dict_keys' supplied)
15:36:36 make: *** [Makefile:654: test-v8] Error 5

(Note I cannot just add python in front of run-tests.py as config.mk has modified the PATH such that python is pointing to the Python 3 binary autodetected by configure.)

If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.
@richardlau
Copy link
Member Author

richardlau commented Jun 8, 2021

Trying out doing the PATH manipulation in the Makefile.
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/4034/ (✔️)

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jun 8, 2021

@richardlau richardlau added build Issues and PRs related to build files or the CI. and removed wip Issues and PRs that are still a work in progress. tools Issues and PRs related to the tools directory. labels Jun 8, 2021
@richardlau
Copy link
Member Author

richardlau commented Jun 8, 2021

Trying out doing the PATH manipulation in the Makefile.
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/4034/

V8 CI has passed with this PR (🎉).

@jasnell @targos FYI I've changed this PR to move the PATH manipulation to remove the bin override directory from the tools/make-v8.sh script to Makefile instead so we can also run V8's test runner from Makefile.

@gengjiawen gengjiawen added the fast-track PRs that do not need to wait for 48 hours to land. label Jun 9, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2021

Fast-track has been requested by @gengjiawen. Please 👍 to approve.

@richardlau richardlau added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 9, 2021
gengjiawen pushed a commit that referenced this pull request Jun 9, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: #38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@gengjiawen
Copy link
Member

Landed in ff09d6d

@gengjiawen gengjiawen closed this Jun 9, 2021
@richardlau richardlau deleted the nooverridev8 branch June 9, 2021 15:14
targos pushed a commit that referenced this pull request Jun 11, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: #38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@danielleadams danielleadams mentioned this pull request Jun 14, 2021
danielleadams pushed a commit that referenced this pull request Jun 17, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: #38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
richardlau added a commit that referenced this pull request Jul 19, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: #38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
richardlau added a commit that referenced this pull request Jul 20, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: #38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@richardlau richardlau mentioned this pull request Jul 20, 2021
foxxyz pushed a commit to foxxyz/node that referenced this pull request Oct 18, 2021
If the `configure.py` script is executed by a Python binary that is
not the one on the PATH it will create a `python` symlink in
`out/tools/bin` and prefix that to the PATH so it is used instead of
the one that otherwise would have been found on the PATH. This is
done so that gyp scripts shelling out to `python` execute with the
same version of Python as used to run the configure script.

V8's build uses V8's build toolchain (i.e. not gyp) and currently that
is incompatible with Python 3. Prevent prefixing the PATH for the V8
build so that it picks up `python` from the unprefixed PATH. This will
allow us to build Node.js with Python 3 but still use Python 2 to build
V8 in the CI.

PR-URL: nodejs#38969
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. fast-track PRs that do not need to wait for 48 hours to land. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants