[Git][ghc/ghc][wip/T18234] 4 commits: hadrian: fix ghc-pkg uses (#17601)
Ben Gamari
gitlab at gitlab.haskell.org
Sat Nov 21 18:34:00 UTC 2020
Ben Gamari pushed to branch wip/T18234 at Glasgow Haskell Compiler / GHC
Commits:
0c4199d0 by Sylvain Henry at 2020-11-20T17:34:20+01:00
hadrian: fix ghc-pkg uses (#17601)
Make sure ghc-pkg doesn't read the compiler "settings" file by passing
--no-user-package-db.
- - - - -
c3409dd8 by Ben Gamari at 2020-11-21T13:33:46-05:00
gitlab-ci: Add usage message to ci.sh
- - - - -
6f403878 by Ben Gamari at 2020-11-21T13:33:46-05:00
gitlab-ci: Add VERBOSE environment variable
And change the make build system's default behavior to V=0, greatly
reducing build log sizes.
- - - - -
b789f5f9 by Ben Gamari at 2020-11-21T13:33:46-05:00
gitlab-ci: Introduce a nightly cross-compilation job
This adds a job to test cross-compilation from x86-64 to AArch64 with
Hadrian.
Fixes #18234
- - - - -
3 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- hadrian/src/Settings/Builders/GhcPkg.hs
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -257,6 +257,33 @@ validate-x86_64-linux-deb9-unreg-hadrian:
CONFIGURE_ARGS: --enable-unregisterised
TEST_ENV: "x86_64-linux-deb9-unreg-hadrian"
+validate-x86_64-linux-deb10-hadrian-cross-aarch64:
+ <<: *nightly
+ extends: .validate-linux-hadrian
+ stage: full-build
+ image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
+ variables:
+ BIN_DIST_NAME: "ghc-x86_64-deb9-linux"
+ rules:
+ - if: '$CI_MERGE_REQUEST_LABELS =~ /.*cross-compilation.*/'
+ variables:
+ CONFIGURE_ARGS: --with-intree-gmp
+ CROSS_TARGET: "aarch64-linux-gnu"
+
+nightly-x86_64-linux-deb10-hadrian-cross-aarch64:
+ <<: *nightly
+ extends: .validate-linux-hadrian
+ stage: full-build
+ variables:
+ CONFIGURE_ARGS: --with-intree-gmp
+ CROSS_TARGET: "aarch64-linux-gnu"
+
+
+
+############################################################
+# GHC-in-GHCi (Hadrian)
+############################################################
+
hadrian-ghc-in-ghci:
stage: quick-build
needs: [lint-linters, lint-submods]
=====================================
.gitlab/ci.sh
=====================================
@@ -2,6 +2,8 @@
# shellcheck disable=SC2230
# This is the primary driver of the GitLab CI infrastructure.
+# Run `ci.sh usage` for usage information.
+
set -e -o pipefail
@@ -17,6 +19,62 @@ fi
source $TOP/.gitlab/common.sh
+function usage() {
+ cat <<EOF
+$0 - GHC continuous integration driver
+
+Common Modes:
+
+ usage Show this usage message.
+ setup Prepare environment for a build.
+ configure Run ./configure.
+ clean Clean the tree
+ shell Run an interactive shell with a configured build environment.
+
+Make build system:
+
+ build_make Build GHC via the make build system
+ test_make Test GHC via the make build system
+
+Hadrian build system
+ build_hadrian Build GHC via the Hadrian build system
+ test_hadrian Test GHC via the Hadrian build system
+
+Environment variables affecting both build systems:
+
+ CROSS_TARGET Triple of cross-compilation target.
+ VERBOSE Set to non-empty for verbose build output
+ MSYSTEM (Windows-only) Which platform to build form (MINGW64 or MINGW32).
+
+Environment variables determining build configuration of Make system:
+
+ BUILD_FLAVOUR Which flavour to build.
+ BUILD_SPHINX_HTML Whether to build Sphinx HTML documentation.
+ BUILD_SPHINX_PDF Whether to build Sphinx PDF documentation.
+ INTEGER_LIBRARY Which integer library to use (integer-simple or integer-gmp).
+ HADDOCK_HYPERLINKED_SOURCES
+ Whether to build hyperlinked Haddock sources.
+ TEST_TYPE Which test rule to run.
+
+Environment variables determining build configuration of Hadrian system:
+
+ BUILD_FLAVOUR Which flavour to build.
+
+Environment variables determining bootstrap toolchain (Linux):
+
+ GHC Path of GHC executable to use for bootstrapping.
+ CABAL Path of cabal-install executable to use for bootstrapping.
+ ALEX Path of alex executable to use for bootstrapping.
+ HAPPY Path of alex executable to use for bootstrapping.
+
+Environment variables determining bootstrap toolchain (non-Linux):
+
+ GHC_VERSION Which GHC version to fetch for bootstrapping.
+ CABAL_INSTALL_VERSION
+ Cabal-install version to fetch for bootstrapping.
+EOF
+}
+
function setup_locale() {
# Musl doesn't provide locale support at all...
if ! which locale > /dev/null; then
@@ -53,11 +111,11 @@ function setup_locale() {
function mingw_init() {
case "$MSYSTEM" in
MINGW32)
- triple="i386-unknown-mingw32"
+ target_triple="i386-unknown-mingw32"
boot_triple="i386-unknown-mingw32" # triple of bootstrap GHC
;;
MINGW64)
- triple="x86_64-unknown-mingw32"
+ target_triple="x86_64-unknown-mingw32"
boot_triple="x86_64-unknown-mingw32" # triple of bootstrap GHC
;;
*)
@@ -320,8 +378,8 @@ function configure() {
end_section "booting"
local target_args=""
- if [[ -n "$triple" ]]; then
- target_args="--target=$triple"
+ if [[ -n "$target_triple" ]]; then
+ target_args="--target=$target_triple"
fi
start_section "configuring"
@@ -341,6 +399,11 @@ function build_make() {
if [[ -z "$BIN_DIST_PREP_TAR_COMP" ]]; then
fail "BIN_DIST_PREP_TAR_COMP is not set"
fi
+ if [[ -n "$VERBOSE" ]]; then
+ MAKE_ARGS="$MAKE_ARGS V=1"
+ else
+ MAKE_ARGS="$MAKE_ARGS V=0"
+ fi
echo "include mk/flavours/${BUILD_FLAVOUR}.mk" > mk/build.mk
echo 'GhcLibHcOpts+=-haddock' >> mk/build.mk
@@ -367,6 +430,11 @@ function determine_metric_baseline() {
}
function test_make() {
+ if [ -n "$CROSS_TARGET" ]; then
+ info "Can't test cross-compiled build."
+ return
+ fi
+
run "$MAKE" test_bindist TEST_PREP=YES
run "$MAKE" V=0 test \
THREADS="$cores" \
@@ -387,6 +455,11 @@ function build_hadrian() {
}
function test_hadrian() {
+ if [ -n "$CROSS_TARGET" ]; then
+ info "Can't test cross-compiled build."
+ return
+ fi
+
cd _build/bindist/ghc-*/
run ./configure --prefix="$TOP"/_build/install
run "$MAKE" install
@@ -434,6 +507,7 @@ function clean() {
function run_hadrian() {
if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
+ if [ -n "$VERBOSE" ]; then HADRIAN_ARGS="$HADRIAN_ARGS -V"; fi
run hadrian/build-cabal \
--flavour="$BUILD_FLAVOUR" \
-j"$cores" \
@@ -473,9 +547,15 @@ case "$(uname)" in
*) fail "uname $(uname) is not supported" ;;
esac
+if [ -n "$CROSS_TARGET" ]; then
+ info "Cross-compiling for $CROSS_TARGET..."
+ target_triple="$CROSS_TARGET"
+fi
+
set_toolchain_paths
case $1 in
+ usage) usage ;;
setup) setup && cleanup_submodules ;;
configure) configure ;;
build_make) build_make ;;
=====================================
hadrian/src/Settings/Builders/GhcPkg.hs
=====================================
@@ -8,8 +8,7 @@ ghcPkgBuilderArgs = mconcat
verbosity <- expr getVerbosity
stage <- getStage
pkgDb <- expr $ packageDbPath stage
- mconcat [ arg "--global-package-db"
- , arg pkgDb
+ mconcat [ use_db pkgDb
, arg "register"
, verbosity < Chatty ? arg "-v0"
]
@@ -17,8 +16,7 @@ ghcPkgBuilderArgs = mconcat
verbosity <- expr getVerbosity
stage <- getStage
pkgDb <- expr $ packageDbPath stage
- mconcat [ arg "--global-package-db"
- , arg pkgDb
+ mconcat [ use_db pkgDb
, arg "unregister"
, arg "--force"
, verbosity < Chatty ? arg "-v0"
@@ -29,10 +27,30 @@ ghcPkgBuilderArgs = mconcat
config <- expr $ pkgInplaceConfig context
stage <- getStage
pkgDb <- expr $ packageDbPath stage
- mconcat [ notStage0 ? arg "--global-package-db"
- , notStage0 ? arg pkgDb
+ mconcat [ notStage0 ? use_db pkgDb
, arg "update"
, arg "--force"
, verbosity < Chatty ? arg "-v0"
, bootPackageDatabaseArgs
, arg config ] ]
+ where
+ use_db db = mconcat
+ -- We use ghc-pkg's --global-package-db to manipulate our databases.
+ -- We can't use --package-db (at least with stage0's ghc-pkg)
+ -- because units in stage0's global package db would be in scope and
+ -- ghc-pkg would disallow us the register a second "rts" unit in our
+ -- database.
+ --
+ -- However ghc-pkg uses the path to the global package db to find
+ -- the compiler "settings" file... So when it finds our newly
+ -- generated settings file in _build/stageN, it may crash if it
+ -- isn't the format it expects (#17601).
+ --
+ -- By chance, ghc-pkg only needs the "settings" file to query the
+ -- arch/os to generate the path to the user package db, which we
+ -- don't need. So we disable it below to avoid failures.
+ [ arg "--no-user-package-db"
+ , arg "--global-package-db"
+ , arg db
+ ]
+
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b2b1ccad1c479557895a978e4e6b01edcafa0dd1...b789f5f997f1873116c52486198520db1abea2e6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b2b1ccad1c479557895a978e4e6b01edcafa0dd1...b789f5f997f1873116c52486198520db1abea2e6
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201121/2d14d105/attachment-0001.html>
More information about the ghc-commits
mailing list