From ac0ebfb6e5f7992f24eead9e671bb6b5593bfd6c Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 10 May 2024 03:41:00 +0000 Subject: [PATCH] Try to fixup aarch64 cross build for hydra. --- .github/workflows/ci-nix.yaml | 4 +- flake.lock | 59 +++++++++++++++++------------- flake.nix | 12 +++++- nix/hydra/project.nix | 69 +++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci-nix.yaml b/.github/workflows/ci-nix.yaml index cdfa55be384..68ed016519b 100644 --- a/.github/workflows/ci-nix.yaml +++ b/.github/workflows/ci-nix.yaml @@ -46,10 +46,10 @@ jobs: name: cardano-scaling authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' - - name: ❓Aarch64 + - name: ❓ Aarch64 if: ${{ matrix.package == 'aarch64' }} run: | - nix build .#legacyPackages.x86_64-linux.aarch64.hydra-node + nix build .#legacyPackages.x86_64-linux.aarch64.hydra-node.components.exes.hydra-node - name: ❓ Test (Pure) if: ${{ matrix.package == 'hydra-plutus' diff --git a/flake.lock b/flake.lock index 9fdbfc80c74..7bae888dd3c 100644 --- a/flake.lock +++ b/flake.lock @@ -933,14 +933,14 @@ "type": "github" } }, - "hackage": { + "hackageNix": { "flake": false, "locked": { - "lastModified": 1708561382, - "narHash": "sha256-IDr2G3komoctjHALk8wGvDKOF39BaqrdEmjvAOsob5I=", + "lastModified": 1709684582, + "narHash": "sha256-+rC8Vpaxdd4Nw2fJIn9wzAnzW5arILly5AkTG6chRAw=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "4b07be837c34475fdde3c9bb9903a850b5692bac", + "rev": "c2ed9aa79252ed67a1fb694b3fffaf7dd7ead6d2", "type": "github" }, "original": { @@ -949,14 +949,14 @@ "type": "github" } }, - "hackageNix": { + "hackageNix_2": { "flake": false, "locked": { - "lastModified": 1709684582, - "narHash": "sha256-+rC8Vpaxdd4Nw2fJIn9wzAnzW5arILly5AkTG6chRAw=", + "lastModified": 1715214831, + "narHash": "sha256-HJdB/AIS0LTs/ko37L8o9Thw3v5UVgEiwrwP6mK0NvY=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "c2ed9aa79252ed67a1fb694b3fffaf7dd7ead6d2", + "rev": "6effcc28a0c73517dfbebc4c2a8fc6f26a6c26a4", "type": "github" }, "original": { @@ -1031,7 +1031,9 @@ "ghc-8.6.5-iohk": "ghc-8.6.5-iohk_2", "ghc98X": "ghc98X_2", "ghc99": "ghc99_2", - "hackage": "hackage", + "hackage": [ + "hackageNix" + ], "hls-1.10": "hls-1.10_2", "hls-2.0": "hls-2.0_2", "hls-2.2": "hls-2.2_2", @@ -1041,7 +1043,9 @@ "hls-2.6": "hls-2.6_2", "hpc-coveralls": "hpc-coveralls_2", "hydra": "hydra_2", - "iserv-proxy": "iserv-proxy_2", + "iserv-proxy": [ + "iserv-proxy" + ], "nix-tools-static": "nix-tools-static_2", "nixpkgs": [ "haskellNix", @@ -1059,15 +1063,16 @@ "stackage": "stackage_2" }, "locked": { - "lastModified": 1708563005, - "narHash": "sha256-RgC6n1kuSDo90Jy1ETlCGL3tr125WeWiDl6z6amEXoQ=", + "lastModified": 1710828274, + "narHash": "sha256-GmCvhqJWBTxP4ohSggGWwvJjMdIY8qP0/RhIIRhbbXI=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "83acf6dc3fe8b3b9d218df2ee88ac875d1aeb801", + "rev": "9f55274618f3da19ab10b7b966f0d54c29c71c81", "type": "github" }, "original": { "owner": "input-output-hk", + "ref": "angerman/fix-aarch64-musl", "repo": "haskell.nix", "type": "github" } @@ -1537,18 +1542,18 @@ "iserv-proxy_2": { "flake": false, "locked": { - "lastModified": 1691634696, - "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", - "ref": "hkm/remote-iserv", - "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", - "revCount": 14, - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "lastModified": 1710581758, + "narHash": "sha256-UNUXGiKLGUv1TuQumV70rfjCJERP4w8KZEDxsMG0RHc=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "50ea210590ab0519149bfd163d5ba199be925fb6", + "type": "github" }, "original": { - "ref": "hkm/remote-iserv", - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" } }, "lint-utils": { @@ -2705,9 +2710,11 @@ "CHaP": "CHaP", "cardano-node": "cardano-node", "flake-parts": "flake-parts", + "hackageNix": "hackageNix_2", "haskellNix": "haskellNix_2", "hls": "hls", "iohk-nix": "iohk-nix", + "iserv-proxy": "iserv-proxy_2", "lint-utils": "lint-utils", "mithril": "mithril", "nix-npm-buildpackage": "nix-npm-buildpackage", @@ -2852,11 +2859,11 @@ "stackage_2": { "flake": false, "locked": { - "lastModified": 1708560571, - "narHash": "sha256-/ZxWtAaoskXxeE79aA/K5PirGFUsqdu2TLRLskDj1js=", + "lastModified": 1708906175, + "narHash": "sha256-KJDF0CO077Jx4GjjPK6pNkx6NkY7p1x5RMPfaIe8nl4=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "e0cb41371d5b1e76cddb4e25d748fdb87c176176", + "rev": "bfa4778050cf69fe50f91d39dcefbb9005d6d0d0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a263739bec1..fa0b1729bb3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,17 @@ { inputs = { nixpkgs.follows = "haskellNix/nixpkgs"; - haskellNix.url = "github:input-output-hk/haskell.nix"; + haskellNix.url = "github:input-output-hk/haskell.nix?ref=angerman/fix-aarch64-musl"; + hackageNix = { + url = "github:input-output-hk/hackage.nix"; + flake = false; + }; + haskellNix.inputs.hackage.follows = "hackageNix"; + iserv-proxy = { + url = "github:stable-haskell/iserv-proxy?ref=iserv-syms"; + flake = false; + }; + haskellNix.inputs.iserv-proxy.follows = "iserv-proxy"; iohk-nix.url = "github:input-output-hk/iohk-nix"; flake-parts.url = "github:hercules-ci/flake-parts"; lint-utils = { diff --git a/nix/hydra/project.nix b/nix/hydra/project.nix index c99c48f056a..54c04300c60 100644 --- a/nix/hydra/project.nix +++ b/nix/hydra/project.nix @@ -54,5 +54,74 @@ pkgs.haskell-nix.project { # For this reason, we try to get away without re-installing lib:ghc for now. reinstallableLibGhc = false; } + { + # This is needed to stop GHC from trying to load libc++.a; I hope we'll + # have a better fix for this eventually. For now this will have to do. + packages.double-conversion.ghcOptions = [ + # stop putting U __gxx_personality_v0 into the library! + "-optcxx-fno-rtti" "-optcxx-fno-exceptions" + # stop putting U __cxa_guard_release into the library! + "-optcxx-std=gnu++98" "-optcxx-fno-threadsafe-statics" + ]; + # This is needed to stop failing when `git` can't be found. When + # cross compiling, git does not exist in the target context, and thus can + # not be executed. Template Hsakell does not distinguish between native + # and target. + packages.gitrev.patches = [ + (builtins.toFile "gitrev.patch" '' + diff --git a/src/Development/GitRev.hs b/src/Development/GitRev.hs + index b664692..603ad1b 100644 + --- a/src/Development/GitRev.hs + +++ b/src/Development/GitRev.hs + @@ -62,7 +62,9 @@ runGit :: [String] -> String -> IndexUsed -> Q String + runGit args def useIdx = do + let oops :: SomeException -> IO (ExitCode, String, String) + oops _e = return (ExitFailure 1, def, "") + + none :: SomeException -> IO (Maybe FilePath) + + none _e = return Nothing + - gitFound <- runIO $ isJust <$> findExecutable "git" + + gitFound <- runIO $ isJust <$> findExecutable "git" `catch` none + if gitFound + then do + -- a lot of bookkeeping to record the right dependencies + '') + ]; + } + # This is needed because plutus-tx, force loads the PlutusTx.Plugin, and then + # we fail with + # + # > : error: + # > Plugins require -fno-external-interpreter + # + # during the build. Plugins and cross compilers are still WIP :-/ + + (pkgs.lib.mkIf (pkgs.hostPlatform.isMusl && pkgs.hostPlatform.isAarch64) { + packages.plutus-tx.patches = [ + (builtins.toFile "plutus-tx.patch" '' + From 895a8a4af848ec29f9165fbff585f391d2c3358b Mon Sep 17 00:00:00 2001 + From: Moritz Angermann + Date: Sun, 10 Dec 2023 16:23:24 +0800 + Subject: [PATCH] Update TH.hs + + Just don't force load it. + --- + src/PlutusTx/TH.hs | 1 - + 1 file changed, 1 deletion(-) + + diff --git a/src/PlutusTx/TH.hs b/src/PlutusTx/TH.hs + index 49f26f6585e..02a0f927dd5 100644 + --- a/src/PlutusTx/TH.hs + +++ b/src/PlutusTx/TH.hs + @@ -46,7 +46,6 @@ going to typecheck, and the result is always a 'CompiledCode', so that's also fi + -- | Compile a quoted Haskell expression into a corresponding Plutus Core program. + compileUntyped :: TH.Q TH.Exp -> TH.Q TH.Exp + compileUntyped e = do + - TH.addCorePlugin "PlutusTx.Plugin" + loc <- TH.location + let locStr = TH.pprint loc + -- See note [Typed TH] + '') + ]; + }) ]; }