Bug 1604615 - Fix wrench build issues on CI arising from glslopt. r=jrmuizel

* For wrench builds, the clang toolchain must now be fetched and be
  present in PATH for bindgen to work. When building OSMesa, we must
  therefore set `LLVM_CONFIG=no` so that it does not attempt to build
  llvmpipe.

* For wrench Mac cross-compiles, we must be careful to expose CFLAGS
  and similar variables using the target-specific variable names, so
  that host builds do not attempt to use flags intended for the
  target. When building OSMesa we must use the generic variable `CC`,
  so now we additionally set `HOST_CC`, so that host builds use the
  host variable rather than the generic one.

* Similarily, for wrench android builds we must use a fork of
  cargo-apk which sets the target-specific variables rather than the
  generic ones. Otherwise we would attempt to use the NDK toolchain
  for host builds.

Differential Revision: https://phabricator.services.mozilla.com/D70031
This commit is contained in:
Jamie Nicol 2020-04-21 10:31:56 +00:00
Родитель d384e8fa67
Коммит 1d3a107541
6 изменённых файлов: 37 добавлений и 22 удалений

Просмотреть файл

@ -392,8 +392,8 @@ android-rs-glue:
description: android-rs-glue source code
fetch:
type: git
repo: https://github.com/rust-windowing/android-rs-glue
revision: e3ac6edea5814e1faca0c31ea8fac6877cb929ea
repo: https://github.com/jamienicol/android-rs-glue
revision: 7a57ad320de79c74a57a8ce02b1dc69b1ea7332a
clang-5.0:
description: clang 5.0.2 source code

Просмотреть файл

@ -52,12 +52,14 @@ jobs:
docker-image: {in-tree: webrender}
fetches:
toolchain:
- linux64-clang
- linux64-rust
- wrench-deps
run:
using: run-task
command: >-
export PATH=$PATH:$MOZ_FETCHES_DIR/rustc/bin &&
export PATH=$PATH:$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/rustc/bin &&
export LLVM_CONFIG=no &&
cd $HOME/checkouts/gecko/gfx/wr &&
mv $MOZ_FETCHES_DIR/wrench-deps/{vendor,.cargo} ./ &&
CARGOFLAGS="--verbose --frozen" ci-scripts/linux-release-tests.sh
@ -76,12 +78,14 @@ jobs:
docker-image: {in-tree: webrender}
fetches:
toolchain:
- linux64-clang
- linux64-rust
- wrench-deps
run:
using: run-task
command: >-
export PATH=$PATH:$MOZ_FETCHES_DIR/rustc/bin &&
export PATH=$PATH:$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/rustc/bin &&
export LLVM_CONFIG=no &&
cd $HOME/checkouts/gecko/gfx/wr &&
mv $MOZ_FETCHES_DIR/wrench-deps/{vendor,.cargo} ./ &&
CARGOFLAGS="--verbose --frozen" ci-scripts/linux-debug-tests.sh
@ -225,6 +229,7 @@ jobs:
TOOLTOOL_MANIFEST: 'browser/config/tooltool-manifests/win64/vs2017.manifest'
fetches:
toolchain:
- win64-clang-cl
- win64-rust
- wrench-deps
run:
@ -267,6 +272,7 @@ jobs:
- android-gradle-dependencies
- android-ndk-linux
- android-sdk-linux
- linux64-clang
- linux64-rust-android
- wrench-deps
treeherder:
@ -302,6 +308,7 @@ jobs:
- android-gradle-dependencies
- android-ndk-linux
- android-sdk-linux
- linux64-clang
- linux64-rust-android
- wrench-deps
treeherder:

Просмотреть файл

@ -31,14 +31,13 @@ END_PKGCONFIG_WRAPPER
chmod +x "${TARGET_TRIPLE}-pkg-config"
popd
# The PATH intentionally excludes clang/bin because osmesa will try to
# build llvmpipe if it finds a llvm-config. And that will fail because
# we don't have a target libLLVM library to link with. We don't need
# llvmpipe anyway since we only use the softpipe driver. If for whatever
# reason we need to add clang/bin to the path here, we should be able to
# instead set LLVM_CONFIG=no to disable llvmpipe, but that might impact
# other parts of the build.
export PATH="${MOZ_FETCHES_DIR}/rustc/bin:${MOZ_FETCHES_DIR}/cctools/bin:${MOZ_FETCHES_DIR}/llvm-dsymutil/bin:${PATH}"
# Set LLVM_CONFIG=no to disable building llvmpipe, otherwise it will
# be built automatically because clang is present in PATH (which is
# required for bindgen), and that will fail because we don't have a
# target libLLVM library to link with. We don't need llvmpipe anyway
# since we only use the softpipe driver.
export LLVM_CONFIG=no
export PATH="${MOZ_FETCHES_DIR}/clang/bin:${MOZ_FETCHES_DIR}/rustc/bin:${MOZ_FETCHES_DIR}/cctools/bin:${MOZ_FETCHES_DIR}/llvm-dsymutil/bin:${PATH}"
# The x86_64-darwin11-ld linker from cctools requires libraries provided
# by clang, so we need to set LD_LIBRARY_PATH for that to work.
@ -49,17 +48,20 @@ export LD_LIBRARY_PATH="${CLANGDIR}/lib:${LD_LIBRARY_PATH}"
export ZLIB_CFLAGS="-I${MACOS_SYSROOT}/usr/include"
export ZLIB_LIBS="-L${MACOS_SYSROOT}/usr/lib -lz"
# Set up compiler and flags for cross-compile
# Set up compiler and flags for cross-compile. Careful to only export the
# target-specific CFLAGS/CXXFLAGS variables, to not break any host builds.
LDPATH="${MOZ_FETCHES_DIR}/cctools/bin/${TARGET_TRIPLE}-ld"
export CC="${CLANGDIR}/bin/clang"
export CFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT}"
TARGET_CFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT}"
export CFLAGS_${TARGET_TRIPLE//-/_}="${TARGET_CFLAGS}"
export CXX="${CLANGDIR}/bin/clang++"
export CXXFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT} -stdlib=libc++"
TARGET_CXXFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT} -stdlib=libc++"
export CXXFLAGS_${TARGET_TRIPLE//-/_}="${TARGET_CXXFLAGS}"
export AR="${CLANGDIR}/bin/llvm-ar"
# See documentation in cargo-linker for why we need this. TL;DR is that passing
# the right arguments to the linker when invoked by cargo is nigh impossible
# without this.
export MOZ_CARGO_WRAP_LD="${CC}"
export MOZ_CARGO_WRAP_LDFLAGS="${CFLAGS}"
export MOZ_CARGO_WRAP_LDFLAGS="${TARGET_CFLAGS}"
export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="${GECKO_PATH}/build/cargo-linker"

Просмотреть файл

@ -10,7 +10,7 @@ popd
pushd "${GECKO_PATH}/gfx/wr/wrench"
# These things come from the toolchain dependencies of the job that invokes
# this script (webrender-wrench-android-build).
export PATH="${PATH}:${MOZ_FETCHES_DIR}/rustc/bin"
export PATH="${PATH}:${MOZ_FETCHES_DIR}/clang/bin:${MOZ_FETCHES_DIR}/rustc/bin"
export ANDROID_HOME="${MOZ_FETCHES_DIR}/android-sdk-linux"
export NDK_HOME="${MOZ_FETCHES_DIR}/android-ndk"

Просмотреть файл

@ -6,10 +6,16 @@ source ${GECKO_PATH}/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
# The osmesa-src build which we do as part of the headless build below
# doesn't seem to always use CFLAGS/CXXFLAGS where expected. Instead we
# just squash those flags into CC/CXX and everything works out.
export CC="${CC} ${CFLAGS}"
export CFLAGS=
export CXX="${CXX} ${CXXFLAGS}"
export CXXFLAGS=
# Export HOST_CC and HOST_CXX without the squashed flags, so that host
# builds use them and don't see the target flags.
export HOST_CC="${CC}"
export HOST_CXX="${CXX}"
CFLAGS_VAR="CFLAGS_${TARGET_TRIPLE//-/_}"
CXXFLAGS_VAR="CXXFLAGS_${TARGET_TRIPLE//-/_}"
export CC="${CC} ${!CFLAGS_VAR}"
export ${CFLAGS_VAR}=
export CXX="${CXX} ${!CXXFLAGS_VAR}"
export ${CXXFLAGS_VAR}=
export UPLOAD_DIR="${HOME}/artifacts"
mkdir -p "${UPLOAD_DIR}"

Просмотреть файл

@ -12,7 +12,7 @@ cd $GECKO_PATH
# This will download the rustc, MSVC, and wrench-deps artifacts.
. taskcluster/scripts/misc/tooltool-download.sh
export PATH=$PATH:$(cd $MOZ_FETCHES_DIR && pwd)/rustc/bin
export PATH=$PATH:$(cd $MOZ_FETCHES_DIR && pwd)/clang/bin:$(cd $MOZ_FETCHES_DIR && pwd)/rustc/bin
. taskcluster/scripts/misc/vs-setup.sh