mlabs-haskell / plutip

A Cardano tool to spin up a testnet and run contracts with an EDSL to describe the instructions. Rhymes with tulip for no particular reason.
Apache License 2.0
55 stars 24 forks source link

Can't build local-cluster on Apple M1 / aarch64-darwin #167

Open aljosa opened 1 year ago

aljosa commented 1 year ago

When I clone the repo (commit 7f2d59) and I try to build on macbook pro (Apple M1 Max) I get this error:

$ nix build .#plutip:exe:local-cluster
error: flake 'git+file:///Users/aljosa/plutip' does not provide attribute 'packages.aarch64-darwin.plutip:exe:local-cluster', 'legacyPackages.aarch64-darwin.plutip:exe:local-cluster' or 'plutip:exe:local-cluster'
aljosa commented 1 year ago

I've tried just adding the system:

$ git diff
diff --git a/flake.nix b/flake.nix
index c117ade..899cfae 100644
--- a/flake.nix
+++ b/flake.nix
@@ -17,7 +17,7 @@
   outputs =
     { self, bot-plutus-interface, nixpkgs, haskell-nix, iohk-nix, ... }@inputs:
     let
-      defaultSystems = [ "x86_64-linux" "x86_64-darwin" ];
+      defaultSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];

       perSystem = nixpkgs.lib.genAttrs defaultSystems;

but the build still failed:

nix build .#plutip:exe:local-cluster
warning: Git tree '/Users/aljosa/plutip' is dirty
[35.1 MiB DL]

trace: To make project.plan-nix for plutip a fixed-output derivation but not materialized, set `plan-sha256` to the output of the 'calculateMaterializedSha' script in 'passthru'.
trace: To materialize project.plan-nix for plutip entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.
[1/142/731 built, 418 copied (1729.1 MiB), 596.4 MiB DL] building ghc-8.10.7 (buildPhase): "inplace/bin/ghc-stage1" -hisuf hi

[1/142/731 built, 418 copied (1729.1 MiB), 596.4 MiB DL] building ghc-8.10.7 (buildPhase):      - Module.holeUnitId

error: builder for '/nix/store/11w2dbc4smn5wk8m1cwmqhwij56vbi36-scrypt-lib-scrypt-0.5.0.drv' failed with exit code 1;
       last 10 log lines:
       > /nix/store/qc4fzcja2bs760vsqcsc6v28imjwy0wi-clang-wrapper-11.1.0/resource-root/include/mmintrin.h:525:12: error:
       >      error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
       >         return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
       >                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       >     |
       > 525 |     return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
       >     |            ^
       > fatal error: too many errors emitted, stopping now [-ferror-limit=]
       > 20 errors generated.
       > `clang' failed in phase `C Compiler'. (Exit code: 1)
       For full logs, run 'nix log /nix/store/11w2dbc4smn5wk8m1cwmqhwij56vbi36-scrypt-lib-scrypt-0.5.0.drv'.
error: 1 dependencies of derivation '/nix/store/g3qa4xpwa7yy4frl9badw4q9v9bgd59n-cardano-wallet-core-lib-cardano-wallet-core-2022.7.1-config.drv' failed to build
error: 1 dependencies of derivation '/nix/store/122w813h0w6ax6vv5yp2gmc1gl6j75in-cardano-wallet-core-lib-cardano-wallet-core-2022.7.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fww6kpyzb55aj06zwz7wjxp5hzdy6v4i-plutip-lib-plutip-0.2-config.drv' failed to build
error: 1 dependencies of derivation '/nix/store/dlzl67xscd8qcf2dkwbmy69rj9c26sma-plutip-lib-plutip-0.2.drv' failed to build
error (ignored): error: cannot unlink '/private/tmp/nix-build-prettyprinter-lib-prettyprinter-1.7.1.drv-0/prettyprinter-1.7.1': Directory not empty
error: 1 dependencies of derivation '/nix/store/w36k7jbigxm1ir162ml76wrk4ink0v2v-plutip-exe-local-cluster-0.2.drv' failed to build
szg251 commented 1 year ago

building ghc-8.10.7 is suspicious to me, maybe we can circumvent the problem by using the nix binary caches. Unfortunately the branch is still using our own fork of haskell.nix, making the iohk caches useless. We already have an upgrade in progress, using the upstream haskell.nix, but it's still unfinished... (it is working with CTL, but tests are failing, and with the lack of funding, no one has started working on a fix yet) https://github.com/mlabs-haskell/plutip/pull/164