From 9c0594b71086de3d2a81fee27866df24d2cc6cf4 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 12:18:47 -0500 Subject: [PATCH 01/11] Add CI, nix build, pin nixpkgs. In lieu of the dap updates, and ghc-whole-program-compiler project updates (to GHC-9.6.6+), we should now be able to test the haskell-debugger with our new dap changes. This is the second PR in a set to upgrade and abstract some facilities for preparing a dap release. - Put project under CI (for both cabal and nix) - Introduce a nixpkgs infra w/ pinning - Add builds for the souffle static analysis C++ code (will make avaialble during runtime) --- .github/workflows/main.yml | 34 ++++++++++++ cabal.project | 45 +++++++++------- default.nix | 106 +++++++++++++++++++++++++++++++++++++ nixpkgs.json | 4 ++ shell.nix | 1 + source.json | 47 ++++++++++++++++ 6 files changed, 217 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 default.nix create mode 100644 nixpkgs.json create mode 100644 shell.nix create mode 100644 source.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..82e8c31 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: Haskell Debugger CI +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/master' + steps: + - uses: DeterminateSystems/nix-installer-action@main + + - name: Nix channel update + run: nix-channel --update + + - name: Cabal install + run: nix-env -iA cabal-install -f . + + - name: Cabal update + run: cabal update + + - name: Install ghc, bzip2 and zlib as build-time dependencies + run: nix-env -iA pkgs.ghc pkgs.bzip2.dev pkgs.zlib.dev -f . + + - name: (x86 - C++) Build ext-stg-gc (souffle-produced reachability analysis for GC) + run: nix-build -A ext-stg-gc + + - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal + run: cabal build dap-estgi-server + + - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ nix + run: nix-build -A dap-estgi-server diff --git a/cabal.project b/cabal.project index 7ad1190..396ef6e 100644 --- a/cabal.project +++ b/cabal.project @@ -1,34 +1,39 @@ -packages: dap-estgi-server +packages: + dap-estgi-server source-repository-package - type: git - location: https://github.com/TeofilC/digest - tag: ac9616b94cb8c4a9e07188d19979a6225ebd5a10 + type: git + location: https://github.com/david-christiansen/final-pretty-printer + tag: 048e8fa2d8b2b7a6f9e4e209db4f67361321eec8 source-repository-package - type: git - location: https://github.com/haskell-debugger/dap - tag: 3784cc0e703cbe300d4e4874328b8b8dd998ea5f + type: git + location: https://github.com/luc-tielen/souffle-haskell + tag: 268a11283ca9293b5eacabf7a0b79d9368232478 + +source-repository-package + type: git + location: https://github.com/TeofilC/digest + tag: ac9616b94cb8c4a9e07188d19979a6225ebd5a10 + +source-repository-package + type: git + location: https://github.com/haskell-debugger/dap + tag: 56d44d27c0cc509fc3e8198de448dbb2e9a6380f source-repository-package type: git - location: https://github.com/grin-compiler/ghc-whole-program-compiler-project - tag: 80e408ebdeaf5c1cea72bfbf86823c32d4fdafbe + location: https://github.com/haskell-debugger/ghc-whole-program-compiler-project + tag: d058105b0bee1ab2e7c7aefd36bf9e0be6e840b7 subdir: external-stg external-stg-syntax external-stg-interpreter -source-repository-package - type: git - location: https://github.com/luc-tielen/souffle-haskell - tag: f8c9fc45eed709110af3d3301393f63f4535c71e - -constraints: - type-errors-pretty == 0.0.1.2, - souffle-haskell == 3.4.0 +package external-stg-interpreter + flags: +external-ext-stg-gc -package digest - flags: -pkg-config +package external-stg-compiler + flags: +external-ext-stg-liveness -allow-newer: type-errors-pretty:base \ No newline at end of file +allow-newer: type-errors-pretty:base diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..548e0bd --- /dev/null +++ b/default.nix @@ -0,0 +1,106 @@ +with (builtins.fromJSON (builtins.readFile ./nixpkgs.json)); + +{ nixpkgs ? builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; + inherit sha256; + } +}: + +let + # all the nix things + pkgs = import nixpkgs {}; + sources = builtins.fromJSON (builtins.readFile ./source.json); + + ghc-wpo-src = + pkgs.fetchFromGitHub sources.ghc-whole-program-compiler-project; + + # this is the reachability analysis binary (cretaed by souffle) that runs + # the mark n' sweep GC pass. This is call by the external-stg-intepreter. + ext-stg-gc = + pkgs.stdenv.mkDerivation { + name = "ext-stg-gc"; + src = "${ghc-wpo-src}/external-stg-interpreter"; + buildInputs = with pkgs; [ souffle openmpi ]; + buildPhase = '' + mkdir -pv $out/bin + g++ -fopenmp $src/datalog/ext-stg-gc.cpp \ + -D_OPENMP -std=c++17 \ + -o $out/bin/ext-stg-gc + ''; + }; + + overrides = self: super: with pkgs.haskell.lib; { + + type-errors-pretty = dontCheck ( + doJailbreak ( + self.callCabal2nix + "type-errors-pretty" + (pkgs.fetchFromGitHub sources.type-errors-pretty) + {} + ) + ); + + digest = + self.callCabal2nix + "digest" + (pkgs.fetchFromGitHub sources.digest) + {}; + + final-pretty-printer = doJailbreak ( + self.callCabal2nix + "final-pretty-printer" + (pkgs.fetchFromGitHub sources.final-pretty-printer) + {} + ); + + dap = doJailbreak ( + self.callCabal2nix + "dap" + (pkgs.fetchFromGitHub sources.dap) + {} + ); + + dap-estgi-server = + self.callCabal2nix + "dap-estgi-server" + ./dap-estgi-server + {}; + + external-stg = + self.callCabal2nix + "external-stg" + "${ghc-wpo-src}/external-stg" + {}; + + external-stg-syntax = + self.callCabal2nix + "external-stg-syntax" + "${ghc-wpo-src}/external-stg-syntax" + {}; + + external-stg-interpreter = + self.callCabal2nixWithOptions + "external-stg-interpreter" + "${ghc-wpo-src}/external-stg-interpreter" + "-fexternal-ext-stg-gc" + {}; + + souffle-haskell = + dontCheck + (doJailbreak + (self.callCabal2nix "souffle-haskell" + (pkgs.fetchFromGitHub sources.souffle-haskell) {} + )); + }; + + hPkgs = + pkgs.haskellPackages.override { inherit overrides; }; + +in + +# this is the set we export for CI, and for shell.nix +{ + inherit (hPkgs) dap-estgi-server; + inherit ext-stg-gc; + inherit pkgs; +} diff --git a/nixpkgs.json b/nixpkgs.json new file mode 100644 index 0000000..c2b4662 --- /dev/null +++ b/nixpkgs.json @@ -0,0 +1,4 @@ +{ + "rev" : "88e992074d86", + "sha256" : "sha256:1k5iv13faiyar5bsfw5klaz898662kcfyn85w5jrl2qkavf6y0y7" +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9294ae8 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./default.nix {}).dap-estgi-server.env diff --git a/source.json b/source.json new file mode 100644 index 0000000..bc696be --- /dev/null +++ b/source.json @@ -0,0 +1,47 @@ +{ + "dap": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "haskell-debugger", + "repo": "dap", + "rev": "56d44d27c0cc509fc3e8198de448dbb2e9a6380f", + "sha256": "sha256-/FKfSyYJuzXqyBu/yFTlVBQYJ4SXgLGDzQ5xAdXajCE=" + }, + "digest": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "TeofilC", + "repo": "digest", + "rev": "ac9616b94cb8c4a9e07188d19979a6225ebd5a10", + "sha256": "sha256-2n2SV4GYAwd09QfWynlxgeCrsj49UI3He6X66ynqfSA=" + }, + "final-pretty-printer": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "david-christiansen", + "repo": "final-pretty-printer", + "rev": "048e8fa2d8b2b7a6f9e4e209db4f67361321eec8", + "sha256": "0d5ya1n85qgs59p2wlx501qa1nrlk7y20riydfknfqkr0fswcpnf" + }, + "ghc-whole-program-compiler-project": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "dmjio", + "repo": "ghc-whole-program-compiler-project", + "rev": "d058105b0bee1ab2e7c7aefd36bf9e0be6e840b7", + "sha256": "sha256-lNNZRaJwHVPRi59pXEsWzxGrOJqwiAR2g56khKq8bic=" + }, + "souffle-haskell" : { + "owner" : "luc-tielen", + "repo" : "souffle-haskell", + "rev" : "268a11283ca9293b5eacabf7a0b79d9368232478", + "hash" : "sha256-n8qqNmrDNxLlM7FRfa1Da58jGCNWjBp9+B/yV3U98gg=" + }, + "type-errors-pretty": { + "fetchSubmodules": false, + "owner": "kowainik", + "repo": "type-errors-pretty", + "rev": "c85d6d0a7bf2278ddb03abddb5782a5b6095d343", + "sha256": "1yylw5c8ffzybcv7cm6ff0k88an4iz0fhc59md09s9zlns03f3d0" + } +} From 74d24dfb6b949cff113659b21b77bfa39244d216 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 12:32:52 -0500 Subject: [PATCH 02/11] Prefix with pkgs --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82e8c31..7e5b851 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: run: nix-channel --update - name: Cabal install - run: nix-env -iA cabal-install -f . + run: nix-env -iA pkgs.cabal-install -f . - name: Cabal update run: cabal update From 2df564524e9b3ae0828258236c0f149d45ea29ae Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 12:35:20 -0500 Subject: [PATCH 03/11] Try a different nix installer --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e5b851..1bd59f2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,10 @@ jobs: if: github.ref != 'refs/heads/master' steps: - uses: DeterminateSystems/nix-installer-action@main + - uses: actions/checkout@v3.5.3 + - uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable - name: Nix channel update run: nix-channel --update From f819bcdbe8506c1da84d05cb53d561c5511b2daf Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 12:38:43 -0500 Subject: [PATCH 04/11] Add Github status badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 994a06f..388cdbd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Haskell ESTGi Debugger +# Haskell ESTGi Debugger ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/haskell-debugger/haskell-estgi-debugger/main.yml?style=flat-square) + # Table of Contents 1. [Introduction](#introduction) From 76eac90fdb1d4b2ee844d77b79467a655e3f48c7 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 12:59:02 -0500 Subject: [PATCH 05/11] Use updated souffle code, bump hash, change remote. - Also add some additional linking flags - Remove -D_OPENMP (already done via -fopenmp) --- default.nix | 3 ++- source.json | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 548e0bd..2ca60cc 100644 --- a/default.nix +++ b/default.nix @@ -24,7 +24,8 @@ let buildPhase = '' mkdir -pv $out/bin g++ -fopenmp $src/datalog/ext-stg-gc.cpp \ - -D_OPENMP -std=c++17 \ + -Wl,-u,__factory_Sf_ext_stg_gc_instance \ + -std=c++17 \ -o $out/bin/ext-stg-gc ''; }; diff --git a/source.json b/source.json index bc696be..bfeb550 100644 --- a/source.json +++ b/source.json @@ -26,10 +26,10 @@ "ghc-whole-program-compiler-project": { "fetchSubmodules": true, "leaveDotGit": false, - "owner": "dmjio", + "owner": "haskell-debugger", "repo": "ghc-whole-program-compiler-project", - "rev": "d058105b0bee1ab2e7c7aefd36bf9e0be6e840b7", - "sha256": "sha256-lNNZRaJwHVPRi59pXEsWzxGrOJqwiAR2g56khKq8bic=" + "rev": "65ecaed", + "sha256": "sha256-T9dUWUrGeva8ghwQ5Pu1paBbBgyjoTp3SQreHs94WRQ=" }, "souffle-haskell" : { "owner" : "luc-tielen", From 595b8a6c526d0ed6db878ebd8a20aa26a56221f9 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 13:50:51 -0500 Subject: [PATCH 06/11] Bump dap to loosen dep. bounds, update digest. --- cabal.project | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index 396ef6e..aa07e19 100644 --- a/cabal.project +++ b/cabal.project @@ -14,12 +14,12 @@ source-repository-package source-repository-package type: git location: https://github.com/TeofilC/digest - tag: ac9616b94cb8c4a9e07188d19979a6225ebd5a10 + tag: 27ffb6396ef322c5185bc919cae563ac449ba235 source-repository-package type: git location: https://github.com/haskell-debugger/dap - tag: 56d44d27c0cc509fc3e8198de448dbb2e9a6380f + tag: 99543ed source-repository-package type: git From 00bfdb44ae258bad7dc2243467775145303d5be8 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 14:10:53 -0500 Subject: [PATCH 07/11] zstd.dev --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bd59f2..ad792b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: run: cabal update - name: Install ghc, bzip2 and zlib as build-time dependencies - run: nix-env -iA pkgs.ghc pkgs.bzip2.dev pkgs.zlib.dev -f . + run: nix-env -iA pkgs.ghc pkgs.bzip2.dev pkgs.zlib.dev pkgs.zstd.dev -f . - name: (x86 - C++) Build ext-stg-gc (souffle-produced reachability analysis for GC) run: nix-build -A ext-stg-gc From ff95957d364786802031e19120f2eb017f93378a Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 14:25:22 -0500 Subject: [PATCH 08/11] Shuffle --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad792b6..cd55f9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,8 +31,9 @@ jobs: - name: (x86 - C++) Build ext-stg-gc (souffle-produced reachability analysis for GC) run: nix-build -A ext-stg-gc + - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ nix + run: nix-build -A dap-estgi-server + - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal run: cabal build dap-estgi-server - - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ nix - run: nix-build -A dap-estgi-server From b76394c885e787e150c7a4734f5e3e8a897692ca Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 14:25:28 -0500 Subject: [PATCH 09/11] Add digest flag --- cabal.project | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cabal.project b/cabal.project index aa07e19..cf5b037 100644 --- a/cabal.project +++ b/cabal.project @@ -36,4 +36,7 @@ package external-stg-interpreter package external-stg-compiler flags: +external-ext-stg-liveness +package digest + flags: -pkg-config + allow-newer: type-errors-pretty:base From da9e04d1c4e065b297b6483e060ec3ea074570aa Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 14:43:56 -0500 Subject: [PATCH 10/11] Try w/ cabal build inside of nix-shell. --- .github/workflows/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd55f9b..14689eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,9 +25,6 @@ jobs: - name: Cabal update run: cabal update - - name: Install ghc, bzip2 and zlib as build-time dependencies - run: nix-env -iA pkgs.ghc pkgs.bzip2.dev pkgs.zlib.dev pkgs.zstd.dev -f . - - name: (x86 - C++) Build ext-stg-gc (souffle-produced reachability analysis for GC) run: nix-build -A ext-stg-gc @@ -35,5 +32,5 @@ jobs: run: nix-build -A dap-estgi-server - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal - run: cabal build dap-estgi-server + run: nix-shell -p pkgs.ghc -p pkgs.bzip2.dev -p pkgs.zlib.dev --run 'cabal build dap-estgi-server' -I=. From 9b05faa4397449dc8be5451b256069b56065cfb1 Mon Sep 17 00:00:00 2001 From: dmjio Date: Thu, 1 May 2025 15:05:21 -0500 Subject: [PATCH 11/11] Comment out cabal build for now --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 14689eb..e559513 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,5 @@ jobs: - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ nix run: nix-build -A dap-estgi-server - - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal - run: nix-shell -p pkgs.ghc -p pkgs.bzip2.dev -p pkgs.zlib.dev --run 'cabal build dap-estgi-server' -I=. - + # - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal + # run: nix-shell -p pkgs.ghc -p pkgs.bzip2.dev -p pkgs.zlib.dev --run 'cabal build dap-estgi-server' -I=.