Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 37 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
name: CI
name: Nix CI

# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
types:
- opened
- synchronize
types: [opened, synchronize]
push:
branches: [master]

branches: [stable-ghc-9.14, stable-master]
workflow_dispatch:

jobs:
cabal:
name: ${{ matrix.plat }} / ghc ${{ matrix.ghc }}
runs-on: "${{ fromJSON('{\"x86_64-linux\": \"ubuntu-24.04\", \"aarch64-linux\": \"ubuntu-24.04-arm\", \"x86_64-darwin\": \"macos-latest\", \"aarch64-darwin\": \"macos-latest\"}')[matrix.plat] }}"

strategy:
fail-fast: false
matrix:
plat:
- x86_64-linux
# - aarch64-linux # disabled: waiting for devx images to be fixed
# - x86_64-darwin # disabled: waiting for devx images to be fixed
- aarch64-darwin
ghc: ['98'] # bootstrapping compiler
include:
- plat: x86_64-linux
runner: ubuntu-24.04
ghc: '98'
dynamic: 0
- plat: x86_64-linux
runner: ubuntu-24.04
ghc: '98'
dynamic: 1
# - plat: aarch64-linux # disabled: waiting for devx images to be fixed
# runner: ubuntu-24.04-arm
# ghc: '98'
# dynamic: 0
# - plat: aarch64-linux
# runner: ubuntu-24.04-arm
# ghc: '98'
# dynamic: 1
- plat: aarch64-darwin
runner: macos-latest
ghc: '98'
dynamic: 0
- plat: aarch64-darwin
runner: macos-latest
ghc: '98'
dynamic: 1

name: "${{ matrix.plat }} / ghc ${{ matrix.ghc }} / dynamic=${{ matrix.dynamic }}"
runs-on: ${{ matrix.runner }}

steps:
- uses: actions/checkout@v4
Expand All @@ -50,25 +65,25 @@ jobs:
# shell: devx {0}
# run: ./configure

- name: Build the bindist
- name: Build the bindist (dynamic=${{ matrix.dynamic }})
shell: devx {0}
run: make CABAL=$PWD/_build/stage0/bin/cabal
run: make CABAL=$PWD/_build/stage0/bin/cabal DYNAMIC=${{ matrix.dynamic }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.plat }}-bindist
name: ${{ matrix.plat }}-dynamic${{ matrix.dynamic }}-bindist
path: _build/bindist

- name: Run the testsuite
- name: Run the testsuite (dynamic=${{ matrix.dynamic }})
shell: devx {0}
run: make test CABAL=$PWD/_build/stage0/bin/cabal
run: make test CABAL=$PWD/_build/stage0/bin/cabal DYNAMIC=${{ matrix.dynamic }}

- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} # upload test results even if the testsuite failed to pass
with:
name: ${{ matrix.plat }}-testsuite-results
name: ${{ matrix.plat }}-dynamic${{ matrix.dynamic }}-testsuite-results
path: |
_build/test-perf.csv
_build/test-summary.txt
Expand Down
24 changes: 20 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,17 @@ _build/bindist: stage2 driver/ghc-usage.txt driver/ghci-usage.txt
$@/bin/ghc-pkg$(EXE_EXT) recache
# Copy headers
@$(call copy_all_stage2_h,$@/bin/ghc-pkg$(EXE_EXT))
# Add basename symlinks for nested shared libs (.dylib, .so) in
# lib/$(HOST_PLATFORM). Shared libraries may be installed in subdirectories
# (e.g., lib/x86_64-linux/rts-1.0.3/). We create symlinks at the top level
# so all shared libraries are in one folder.
@if [ -d "$@/lib/$(HOST_PLATFORM)" ]; then \
cd "$@/lib/$(HOST_PLATFORM)" && \
find . -mindepth 2 \( -name "*.dylib" -o -name "*.so" \) -type f \
-exec sh -c 'ln -sf "$$1" "$$(basename "$$1")"' _ {} \; ; \
fi
# Create -dyn iserv executable (symlink so ghc can find ghc-iserv-dyn)
@ln -sf ghc-iserv$(EXE_EXT) "$@/bin/ghc-iserv-dyn$(EXE_EXT)"
@echo "::endgroup::"

_build/bindist/ghc.tar.gz: _build/bindist
Expand All @@ -980,6 +991,13 @@ _build/bindist/lib/targets/%: _build/bindist driver/ghc-usage.txt driver/ghci-us
# Copy libraries and settings
@if [ -e $(CURDIR)/_build/bindist/lib/targets/$(@F)/lib/$(@F) ] ; then find $(CURDIR)/_build/bindist/lib/targets/$(@F)/lib/$(@F)/ -mindepth 1 -type f -name "*.so" -execdir mv '{}' $(CURDIR)/_build/bindist/lib/targets/$(@F)/lib/$(@F)/'{}' \; ; fi
$(call copycrosslib,$(@F))
# Add basename symlinks for nested shared libs (.dylib, .so) in lib/$(@F).
# See comment in _build/bindist target for explanation.
@if [ -d $(CURDIR)/_build/bindist/lib/targets/$(@F)/lib/$(@F) ] ; then \
cd $(CURDIR)/_build/bindist/lib/targets/$(@F)/lib/$(@F) && \
find . -mindepth 2 \( -name "*.dylib" -o -name "*.so" \) -type f \
-exec sh -c 'ln -sf "$$1" "$$(basename "$$1")"' _ {} \; ; \
fi
# --help
@cp -rfp driver/ghc-usage.txt _build/bindist/lib/targets/$(@F)/lib/
@cp -rfp driver/ghci-usage.txt _build/bindist/lib/targets/$(@F)/lib/
Expand Down Expand Up @@ -1123,13 +1141,11 @@ CANONICAL_TEST_HC_OPTS = \
-Werror=compat -dno-debug-output

# Build timeout utility (needed for some tests) if not already built.
.PHONY: testsuite-timeout
testsuite-timeout:
testsuite/timeout/install-inplace/bin/timeout:
$(MAKE) -C testsuite/timeout

# --- Test Target ---

test: _build/bindist testsuite-timeout
test: $(TEST_GHC) $(TEST_GHC_PKG) $(TEST_HP2PS) $(TEST_HPC) $(TEST_RUN_GHC) testsuite/timeout/install-inplace/bin/timeout
@echo "::group::Running tests with THREADS=$(THREADS)" >&2
# If any required tool is missing, testsuite logic will skip related tests.
TEST_HC='$(TEST_GHC)' \
Expand Down
5 changes: 5 additions & 0 deletions cabal.project.stage1
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ package ghc-boot-th-next
package hsc2hs
flags: +in-ghc-tree

-- libffi-clib produces C warnings that are promoted to errors by default.
-- Suppress -Werror to prevent build failures from upstream code.
package libffi-clib
ghc-options: -optc-Wno-error

--
-- Program options
--
Expand Down
2 changes: 1 addition & 1 deletion cabal.project.stage2
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if !os(windows)
import: cabal.project.rts

package libffi-clib
ghc-options: -no-rts
ghc-options: -no-rts -optc-Wno-error

-- We end up injecting the following depednency:
--
Expand Down
3 changes: 2 additions & 1 deletion compiler/GHC/Driver/DynFlags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,8 @@ packageFlagsChanged idflags1 idflags0 =
[ Opt_HideAllPackages
, Opt_HideAllPluginPackages
, Opt_AutoLinkPackages
, Opt_NoRts ]
, Opt_NoRts
, Opt_NoGhcInternal ]

instance Outputable PackageFlag where
ppr (ExposePackage n arg rn) = text n <> braces (ppr arg <+> ppr rn)
Expand Down
1 change: 1 addition & 0 deletions compiler/GHC/Driver/Flags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ data GeneralFlag
-- temporary flags
| Opt_AutoLinkPackages
| Opt_NoRts
| Opt_NoGhcInternal
| Opt_ImplicitImportQualified

-- keeping stuff
Expand Down
5 changes: 5 additions & 0 deletions compiler/GHC/Driver/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,11 @@ dynamic_flags_deps = [
(NoArg (setGeneralFlag Opt_NoHsMain))
, make_ord_flag defGhcFlag "no-rts"
(NoArg (setGeneralFlag Opt_NoRts))
-- Prevent ghc-internal from being auto-injected when building RTS sublibraries.
-- When building rts sublibaries with GHC, we may try to load ghc-internal
-- due to auto-injection. This flag, like -no-rts, prevents that.
, make_ord_flag defGhcFlag "no-ghc-internal"
Copy link

Choose a reason for hiding this comment

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

Why is this needed now?

Copy link
Author

Choose a reason for hiding this comment

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

We have the following dependeny as visible to cabal:

ghc-internal
+ rts

however, ghc will try to insert:

ghc-internal
+ rts-sublib (based on the -threaded / -debug flag)
  + rts

If we try to build the rts-sublib with ghc, we can end up trying to load ghc-internal, due to auto-injection of libraries.

Maybe a better solution is to add a flag to outright disable ghc's auto population of libs, instead of having separate ones for each lib 😅

(NoArg (setGeneralFlag Opt_NoGhcInternal))
, make_ord_flag defGhcFlag "fno-state-hack"
(NoArg (setGeneralFlag Opt_G_NoStateHack))
, make_ord_flag defGhcFlag "fno-opt-coercion"
Expand Down
Loading
Loading