Skip to content

Commit

Permalink
ci: fix arm client compiler toolchain
Browse files Browse the repository at this point in the history
Refs #137927
  • Loading branch information
deepak1556 committed Dec 2, 2021
1 parent 2108162 commit fdffcd8
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions build/azure-pipelines/linux/product-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,41 @@ steps:
set -e
export npm_config_arch=$(NPM_ARCH)
if [ -z "$CC" ] || [ -z "$CXX" ]; then
# Download clang based on chromium revision used by vscode
curl -s https://raw.githubusercontent.com/chromium/chromium/96.0.4664.45/tools/clang/scripts/update.py | python - --output-dir=$PWD/.build/CR_Clang --host-os=linux
# Download libcxx headers and objects from upstream electron releases
DEBUG=libcxx-fetcher \
VSCODE_LIBCXX_OBJECTS_DIR=$PWD/.build/libcxx-objects \
VSCODE_LIBCXX_HEADERS_DIR=$PWD/.build/libcxx_headers \
VSCODE_LIBCXXABI_HEADERS_DIR=$PWD/.build/libcxxabi_headers \
VSCODE_ARCH="$(NPM_ARCH)" \
node build/linux/libcxx-fetcher.js
# Set compiler toolchain
export CC=$PWD/.build/CR_Clang/bin/clang
export CXX=$PWD/.build/CR_Clang/bin/clang++
export CXXFLAGS="-nostdinc++ -D__NO_INLINE__ -isystem$PWD/.build/libcxx_headers -isystem$PWD/.build/libcxx_headers/include -isystem$PWD/.build/libcxxabi_headers/include -fPIC -flto=thin -fsplit-lto-unit"
export LDFLAGS="-stdlib=libc++ -fuse-ld=lld -flto=thin -fsplit-lto-unit -L$PWD/.build/libcxx-objects -lc++abi"
else
# Build with -fPIC for vscode-encrypt on arm64, adding it globally here
# should be moved to the module binding.gyp eventually.
export CFLAGS="-fPIC"
# Download clang based on chromium revision used by vscode
curl -s https://raw.githubusercontent.com/chromium/chromium/96.0.4664.45/tools/clang/scripts/update.py | python - --output-dir=$PWD/.build/CR_Clang --host-os=linux
# Download libcxx headers and objects from upstream electron releases
DEBUG=libcxx-fetcher \
VSCODE_LIBCXX_OBJECTS_DIR=$PWD/.build/libcxx-objects \
VSCODE_LIBCXX_HEADERS_DIR=$PWD/.build/libcxx_headers \
VSCODE_LIBCXXABI_HEADERS_DIR=$PWD/.build/libcxxabi_headers \
VSCODE_ARCH="$(NPM_ARCH)" \
node build/linux/libcxx-fetcher.js
# Set compiler toolchain
# Flags for the client build are based on
# https://source.chromium.org/chromium/chromium/src/+/refs/tags/96.0.4664.45:build/config/arm.gni
# https://source.chromium.org/chromium/chromium/src/+/refs/tags/96.0.4664.45:build/config/compiler/BUILD.gn
# https://source.chromium.org/chromium/chromium/src/+/refs/tags/96.0.4664.45:build/config/c++/BUILD.gn
export CC=$PWD/.build/CR_Clang/bin/clang
export CXX=$PWD/.build/CR_Clang/bin/clang++
export CXXFLAGS="-nostdinc++ -D__NO_INLINE__ -isystem$PWD/.build/libcxx_headers -isystem$PWD/.build/libcxx_headers/include -isystem$PWD/.build/libcxxabi_headers/include -fPIC -flto=thin -fsplit-lto-unit"
export LDFLAGS="-stdlib=libc++ -fuse-ld=lld -flto=thin -fsplit-lto-unit -L$PWD/.build/libcxx-objects -lc++abi"
export VSCODE_REMOTE_CC=$(which gcc-4.9)
export VSCODE_REMOTE_CXX=$(which g++-4.9)
if [ "$VSCODE_ARCH" == "arm64" ]; then
export CXXFLAGS="${CXXFLAGS} --target=aarch64-linux-gnu -fwhole-program-vtables"
export CFLAGS="${CFLAGS} --target=aarch64-linux-gnu -fwhole-program-vtables"
export LDFLAGS="${LDFLAGS} --target=aarch64-linux-gnu -march=arm64 -fwhole-program-vtables"
export VSCODE_REMOTE_CC=/usr/bin/aarch64-linux-gnu-gcc
export VSCODE_REMOTE_CXX=/usr/bin/aarch64-linux-gnu-g++
fi
if [ "$VSCODE_ARCH" == "x64" ]; then
export VSCODE_REMOTE_CC=$(which gcc-4.9)
export VSCODE_REMOTE_CXX=$(which g++-4.9)
if [ "$VSCODE_ARCH" == "armhf" ]; then
export CXXFLAGS="${CXXFLAGS} --target=arm-linux-gnueabihf -march=armv7-a -mthumb -mfloat-abi=hard -mfpu=neon -mtune=generic-armv7-a"
export CFLAGS="${CFLAGS} --target=arm-linux-gnueabihf -march=armv7-a -mthumb -mfloat-abi=hard -mfpu=neon -mtune=generic-armv7-a"
export LDFLAGS="${LDFLAGS} --target=arm-linux-gnueabihf -march=armv7-a"
export VSCODE_REMOTE_CC=/usr/bin/arm-linux-gnueabihf-gcc
export VSCODE_REMOTE_CXX=/usr/bin/arm-linux-gnueabihf-g++
fi
for i in {1..3}; do # try 3 times, for Terrapin
Expand Down

0 comments on commit fdffcd8

Please sign in to comment.