Skip to content

Commit

Permalink
build: don't pass python override to V8 build
Browse files Browse the repository at this point in the history
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 <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
richardlau authored and danielleadams committed Jun 17, 2021
1 parent d5d12b6 commit 4ec46a3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ V8_TEST_OPTIONS = $(V8_EXTRA_TEST_OPTIONS)
ifdef DISABLE_V8_I18N
V8_BUILD_OPTIONS += i18nsupport=off
endif
# V8 build and test toolchains are not currently compatible with Python 3.
# config.mk may have prepended a symlink for `python` to PATH which we need
# to undo before calling V8's tools.
OVERRIDE_BIN_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))out/tools/bin
NO_BIN_OVERRIDE_PATH=$(subst $() $(),:,$(filter-out $(OVERRIDE_BIN_DIR),$(subst :, ,$(PATH))))

ifeq ($(OSTYPE), darwin)
GCOV = xcrun llvm-cov gcov
Expand Down Expand Up @@ -274,7 +279,8 @@ endif
# Rebuilds deps/v8 as a git tree, pulls its third-party dependencies, and
# builds it.
v8:
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

.PHONY: jstest
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
Expand Down Expand Up @@ -651,19 +657,22 @@ test-with-async-hooks:
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
# 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) \
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
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

test-v8-intl: v8
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) \
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) intl \
$(TAP_V8_INTL)

test-v8-benchmarks: v8
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
benchmarks \
$(TAP_V8_BENCHMARKS)

Expand Down

0 comments on commit 4ec46a3

Please sign in to comment.