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: use ccache in make-v8.sh on ppc64le and s390x #42204

Merged
merged 1 commit into from Mar 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 22 additions & 10 deletions tools/make-v8.sh
Expand Up @@ -9,7 +9,7 @@ cd deps/v8 || exit
find . -type d -name .git -print0 | xargs -0 rm -rf
../../tools/v8/fetch_deps.py .

ARCH="`arch`"
ARCH=$(arch)
if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then
TARGET_ARCH=$ARCH
if [ "$ARCH" = "ppc64le" ]; then
Expand All @@ -18,22 +18,34 @@ if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then
# set paths manually for now to use locally installed gn
export BUILD_TOOLS=/home/iojs/build-tools
export LD_LIBRARY_PATH="$BUILD_TOOLS:$LD_LIBRARY_PATH"
# Avoid linking to ccache symbolic links as ccache decides which
# binary to run based on the name of the link (we always name them gcc/g++).
# shellcheck disable=SC2154
CC_PATH=`command -v "$CC" gcc | grep -v ccache | head -n 1`
# shellcheck disable=SC2154
CXX_PATH=`command -v "$CXX" g++ | grep -v ccache | head -n 1`
rm -f "$BUILD_TOOLS/g++"
rm -f "$BUILD_TOOLS/gcc"
ln -s "$CXX_PATH" "$BUILD_TOOLS/g++"
ln -s "$CC_PATH" "$BUILD_TOOLS/gcc"
# V8's build config looks for binaries called `gcc` and `g++` if not using
# clang. Ensure that `gcc` and `g++` point to the compilers we want to
# invoke, creating symbolic links placed at the front of PATH, if needed.
# Avoid linking to ccache symbolic links as ccache decides which binary
# to run based on the name of the link (i.e. `gcc`/`g++` in our case).
# shellcheck disable=SC2154
if [ "$CC" != "" ] && [ "$CC" != "gcc" ]; then
CC_PATH=$(command -v "$CC" gcc | grep -v ccache | head -n 1)
ln -s "$CC_PATH" "$BUILD_TOOLS/gcc"
fi
# shellcheck disable=SC2154
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe this comment is necessary.

Suggested change
# shellcheck disable=SC2154

Copy link
Member Author

Choose a reason for hiding this comment

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

It came out of https://github.com/nodejs/node/runs/5413643748?check_suite_focus=true

Error: /home/runner/work/node/node/tools/make-v8.sh:33:9: CXX is referenced but not assigned.

if [ "$CXX" != "" ] && [ "$CXX" != "g++" ]; then

Copy link
Member Author

Choose a reason for hiding this comment

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

With this line removed:

$ tools/lint-sh.js tools/ --from-npx
Running Shell scripts checker...

In /home/rlau/sandbox/github/node/tools/make-v8.sh line 33:
  if [ "$CXX" != "" ] && [ "$CXX" != "g++" ]; then
        ^--^ SC2154 (warning): CXX is referenced but not assigned.

For more information:
  https://www.shellcheck.net/wiki/SC2154 -- CXX is referenced but not assigned.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated to incorporate the other two suggestions but kept this one because the linter fails otherwise.

if [ "$CXX" != "" ] && [ "$CXX" != "g++" ]; then
CXX_PATH=$(command -v "$CXX" g++ | grep -v ccache | head -n 1)
ln -s "$CXX_PATH" "$BUILD_TOOLS/g++"
fi
export PATH="$BUILD_TOOLS:$PATH"
# Propagate ccache to gn.
case "$CXX" in
*ccache*) CC_WRAPPER="cc_wrapper=\"ccache\"" ;;
*) ;;
esac

g++ --version
gcc --version
export PKG_CONFIG_PATH=$BUILD_TOOLS/pkg-config
gn gen -v "out.gn/$BUILD_ARCH_TYPE" --args="is_component_build=false is_debug=false use_goma=false goma_dir=\"None\" use_custom_libcxx=false v8_target_cpu=\"$TARGET_ARCH\" target_cpu=\"$TARGET_ARCH\" v8_enable_backtrace=true"
gn gen -v "out.gn/$BUILD_ARCH_TYPE" --args="is_component_build=false is_debug=false use_goma=false goma_dir=\"None\" use_custom_libcxx=false v8_target_cpu=\"$TARGET_ARCH\" target_cpu=\"$TARGET_ARCH\" v8_enable_backtrace=true $CC_WRAPPER"
ninja -v -C "out.gn/$BUILD_ARCH_TYPE" d8 cctest inspector-test
else
DEPOT_TOOLS_DIR="$(cd _depot_tools && pwd)"
Expand Down