From 33c431bd00509c9af1ddb28e75454ea9e17748a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Fri, 26 Apr 2024 12:09:53 -0300 Subject: [PATCH 01/15] Upgrade hevm to latest `echidna-patches` commit --- flake.nix | 6 +++--- lib/Echidna/Events.hs | 2 +- stack.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index dd888c6db..2b3bcd043 100644 --- a/flake.nix +++ b/flake.nix @@ -49,10 +49,10 @@ hevm = pkgs: pkgs.haskell.lib.dontCheck ( pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { - owner = "ethereum"; + owner = "trail-of-forks"; repo = "hevm"; - rev = "release/0.53.0"; - sha256 = "sha256-/B+McCJBcIxYCmYMcJ5FiwMqPeSCL97WbNusabTUb34="; + rev = "4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e"; + sha256 = "sha256-NLdqY3DIb9G2JJRZrXBBh9LxxylZM8Mnr7rqSJdrPUg="; }) { secp256k1 = pkgs.secp256k1; }); # FIXME: figure out solc situation, it conflicts with the one from diff --git a/lib/Echidna/Events.hs b/lib/Echidna/Events.hs index 7300fbaac..645112f9b 100644 --- a/lib/Echidna/Events.hs +++ b/lib/Echidna/Events.hs @@ -36,7 +36,7 @@ extractEvents decodeErrors dappInfo vm = ++ concatMap ((catMaybes . flatten) . fmap showTrace) forest where showTrace trace = - let ?context = DappContext { info = dappInfo, env = vm.env.contracts } in + let ?context = DappContext { info = dappInfo, contracts = vm.env.contracts, labels = vm.labels } in let codehash' = fromJust $ maybeLitWord trace.contract.codehash maybeContractName = maybeContractNameFromCodeHash dappInfo codehash' in case trace.tracedata of diff --git a/stack.yaml b/stack.yaml index 7958d0c76..932acff27 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,8 +4,8 @@ packages: - '.' extra-deps: -- git: https://github.com/ethereum/hevm.git - commit: a39b1c07a3f643330f920042eb94a43d7e6454b5 +- git: https://github.com/trail-of-forks/hevm.git + commit: 4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e - restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968 - s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525 From 2a2718fcc3ed4f695a4b185f17fc64a4b86ff232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 29 Apr 2024 18:50:58 -0300 Subject: [PATCH 02/15] Upgrade build to GHC 9.6 --- .github/workflows/ci.yml | 2 +- flake.lock | 6 +-- flake.nix | 48 ++++++++++++----- lib/Echidna/UI.hs | 15 +++--- package.yaml | 112 ++++++++++++++++++++------------------- stack.yaml | 12 ++--- 6 files changed, 108 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cee2c1d6..550362b8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: id: stack if: matrix.container == '' with: - ghc-version: '9.4' + ghc-version: '9.6' enable-stack: true stack-version: 'latest' diff --git a/flake.lock b/flake.lock index 6f81b13f4..27cbdfd65 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703499205, - "narHash": "sha256-lF9rK5mSUfIZJgZxC3ge40tp1gmyyOXZ+lRY3P8bfbg=", + "lastModified": 1713284584, + "narHash": "sha256-rRuPBJD9+yjz7tY3xC/BvFUwloutynR9piiVE6fhGqo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870", + "rev": "2b6ee326ad047870526d9a3ae88dfd0197da898d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2b3bcd043..2ea1f1cb0 100644 --- a/flake.nix +++ b/flake.nix @@ -47,22 +47,37 @@ ncurses-static = pkgsStatic.ncurses.override { enableStatic = true; }; - hevm = pkgs: pkgs.haskell.lib.dontCheck ( - pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { - owner = "trail-of-forks"; + cc-workaround-nix-23138 = + pkgs.writeScriptBin "cc-workaround-nix-23138" '' + if [ "$1" = "--print-file-name" ] && [ "$2" = "c++" ]; then + echo c++ + else + exec cc "$@" + fi + ''; + + hevm = pkgs: pkgs.lib.pipe (pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { + owner = "elopez"; repo = "hevm"; - rev = "4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e"; - sha256 = "sha256-NLdqY3DIb9G2JJRZrXBBh9LxxylZM8Mnr7rqSJdrPUg="; - }) { secp256k1 = pkgs.secp256k1; }); + rev = "3065046b2a3d2ac0ea23347ba2699a0f008d26c7"; + sha256 = "sha256-tTgtOgNzmjaLQjJj1/bYvEp0DXabswpl47usTmfqLP8="; + }) { secp256k1 = pkgs.secp256k1; }) + ([ + pkgs.haskell.lib.compose.dontCheck + ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + (pkgs.haskell.lib.compose.appendConfigureFlag "--ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138") + ]); - # FIXME: figure out solc situation, it conflicts with the one from - # solc-select that is installed with slither, disable tests in the meantime - echidna = pkgs: pkgs.haskell.lib.dontCheck ( - with pkgs; lib.pipe + echidna = pkgs: with pkgs; lib.pipe (haskellPackages.callCabal2nix "echidna" ./. { hevm = hevm pkgs; }) - [ + ([ + # FIXME: figure out solc situation, it conflicts with the one from + # solc-select that is installed with slither, disable tests in the meantime + haskell.lib.compose.dontCheck (haskell.lib.compose.addTestToolDepends [ haskellPackages.hpack slither-analyzer solc ]) (haskell.lib.compose.disableCabalFlag "static") + ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + (pkgs.haskell.lib.compose.appendConfigureFlag "--ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138") ]); echidna-static = with pkgsStatic; lib.pipe @@ -78,7 +93,6 @@ "--extra-lib-dirs=${stripDylib (ncurses-static)}/lib" ] ++ (if stdenv.hostPlatform.isDarwin then [ "--extra-lib-dirs=${stripDylib (libiconv.override { enableStatic = true; })}/lib" - "--extra-lib-dirs=${stripDylib (libcxxabi)}/lib" ] else []))) (haskell.lib.compose.enableCabalFlag "static") ]; @@ -108,10 +122,12 @@ # get the list of dynamic libs from otool and tidy the output libs=$(${otool} -L $out/bin/echidna | tail -n +2 | sed 's/^[[:space:]]*//' | cut -d' ' -f1) # get the path for libcxx - cxx=$(echo "$libs" | ${grep} '^/nix/store/.*-libcxx-') + cxx=$(echo "$libs" | ${grep} '^/nix/store/.*/libc++\.') + cxxabi=$(echo "$libs" | ${grep} '^/nix/store/.*/libc++abi\.') # rewrite /nix/... library paths to point to /usr/lib chmod 777 $out/bin/echidna ${install_name_tool} -change "$cxx" /usr/lib/libc++.1.dylib $out/bin/echidna + ${install_name_tool} -change "$cxxabi" /usr/lib/libc++abi.dylib $out/bin/echidna # fix TERMINFO path in ncurses ${perl} -i -pe 's#(${ncurses-static}/share/terminfo)#"/usr/share/terminfo" . "\x0" x (length($1) - 19)#e' $out/bin/echidna # check that no nix deps remain @@ -145,7 +161,11 @@ devShell = with pkgs; haskellPackages.shellFor { packages = _: [ (echidna pkgs) ]; - shellHook = "hpack"; + shellHook = '' + hpack + '' + (if pkgs.stdenv.isDarwin then '' + cabal configure --ghc-options=-pgml=${cc-workaround-nix-23138}/bin/cc-workaround-nix-23138 + '' else ""); buildInputs = [ solc slither-analyzer diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index 257aaee9e..f489cd6f7 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -8,7 +8,10 @@ import Brick import Brick.BChan import Brick.Widgets.Dialog qualified as B import Data.Sequence ((|>)) -import Graphics.Vty (Config, Event(..), Key(..), Modifier(..), defaultConfig, inputMap, mkVty) +import Graphics.Vty.Config (VtyUserConfig, defaultConfig, configInputMap) +import Graphics.Vty.CrossPlatform (mkVty) +import Graphics.Vty.Input.Events +import Graphics.Vty (Event(..), Key(..), Modifier(..)) import Graphics.Vty qualified as Vty import System.Posix import Echidna.UI.Widgets @@ -245,12 +248,12 @@ stopWorkers :: MonadIO m => [(ThreadId, a)] -> m () stopWorkers workers = forM_ workers $ \(threadId, _) -> liftIO $ killThread threadId -vtyConfig :: IO Config +vtyConfig :: IO VtyUserConfig vtyConfig = do - config <- Vty.standardIOConfig - pure config { inputMap = (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]) : - (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) : - inputMap defaultConfig } + pure defaultConfig { configInputMap = [ + (Nothing, "\ESC[6;2~", EvKey KPageDown [MShift]), + (Nothing, "\ESC[5;2~", EvKey KPageUp [MShift]) + ] } -- | Check if we should stop drawing (or updating) the dashboard, then do the right thing. monitor :: MonadReader Env m => m (App UIState UIEvent Name) diff --git a/package.yaml b/package.yaml index 926c6b8ec..9186b5999 100644 --- a/package.yaml +++ b/package.yaml @@ -13,51 +13,17 @@ ghc-options: - -optP-Wno-nonportable-include-path - -fspecialize-aggressively - -fexpose-all-unfoldings + - -Wunused-packages dependencies: - - base - aeson - - base16-bytestring - - binary - - bytestring - - code-page + - base - containers - - data-bword - - data-dword - - deepseq - - extra - directory - - exceptions - - filepath - - hashable - hevm - - html-entities - - ListLike - MonadRandom - mtl - - optparse-applicative - - optics - - optics-core - - process - - random - - rosezipper - - semver - - split - text - - transformers - - time - - unliftio - - utf8-string - - vector - - with-utf8 - - word-wrap - - yaml - - http-conduit - - html-conduit - - warp - - wai-extra - - xml-conduit - - strip-ansi-escape language: GHC2021 @@ -73,20 +39,59 @@ default-extensions: library: source-dirs: lib/ - -when: - - condition: "!os(windows)" - cpp-options: -DINTERACTIVE_UI - dependencies: - - brick - - unix - - vty + dependencies: + - base16-bytestring + - binary + - bytestring + - data-bword + - data-dword + - deepseq + - exceptions + - extra + - filepath + - hashable + - html-conduit + - html-entities + - http-conduit + - ListLike + - optics + - optics-core + - process + - random + - rosezipper + - semver + - split + - strip-ansi-escape + - time + - unliftio + - utf8-string + - vector + - wai-extra + - warp + - word-wrap + - xml-conduit + - yaml + when: + - condition: "!os(windows)" + cpp-options: -DINTERACTIVE_UI + dependencies: + - brick + - unix + - vty + - vty-crossplatform executables: echidna: main: Main.hs source-dirs: src/ - dependencies: echidna + dependencies: + - code-page + - echidna + - filepath + - hashable + - optparse-applicative + - time + - with-utf8 ghc-options: - -threaded - '"-with-rtsopts=-A64m -N"' @@ -99,23 +104,25 @@ executables: - -O2 - -optl-pthread - condition: os(darwin) - extra-libraries: c++ ld-options: -Wl,-keep_dwarf_unwind ghc-options: -fcompact-unwind - - condition: os(windows) && impl(ghc >= 9.4) - dependencies: system-cxx-std-lib - - condition: os(windows) && impl(ghc < 9.4) - extra-libraries: stdc++ tests: echidna-testsuite: main: Spec.hs source-dirs: src/test dependencies: + - data-dword - echidna + - exceptions + - optics-core + - process + - semver + - split - tasty - tasty-hunit - tasty-quickcheck + - yaml when: - condition: (os(linux) || os(windows)) && flag(static) ghc-options: @@ -125,13 +132,8 @@ tests: - -O2 - -optl-pthread - condition: os(darwin) - extra-libraries: c++ ld-options: -Wl,-keep_dwarf_unwind ghc-options: -fcompact-unwind - - condition: os(windows) && impl(ghc >= 9.4) - dependencies: system-cxx-std-lib - - condition: os(windows) && impl(ghc < 9.4) - extra-libraries: stdc++ flags: static: diff --git a/stack.yaml b/stack.yaml index 932acff27..d55494932 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,17 +1,13 @@ -resolver: lts-21.17 +resolver: lts-22.19 packages: - '.' extra-deps: -- git: https://github.com/trail-of-forks/hevm.git - commit: 4605dd0f2ed958f2cabe055bd4d5dac8c0e2b77e +- git: https://github.com/elopez/hevm.git + commit: 3065046b2a3d2ac0ea23347ba2699a0f008d26c7 -- restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968 -- s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525 -- semver-range-0.2.8@sha256:44918080c220cf67b6e7c8ad16f01f3cfe1ac69d4f72e528e84d566348bb23c3,1941 -- HSH-2.1.3@sha256:71ded11b224f5066373ce985ec63b10c87129850b33916736dd64fa2bea9ea0a,1705 -- spool-0.1@sha256:77780cbfc2c0be23ff2ea9e474062f3df97fcd9db946ee0b3508280a923b83e2,1461 - smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421 - spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162 +- spool-0.1@sha256:77780cbfc2c0be23ff2ea9e474062f3df97fcd9db946ee0b3508280a923b83e2,1461 - strip-ansi-escape-0.1.0.0@sha256:08f2ed93b16086a837ec46eab7ce8d27cf39d47783caaeb818878ea33c2ff75f,1628 From e253a1a87c3653fff9e7c0c1668f24d4a4ef8127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 29 Apr 2024 20:35:49 -0300 Subject: [PATCH 03/15] Refactor terminal and signal support in preparation for Windows UI --- lib/Echidna/UI.hs | 11 ++++++----- package.yaml | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index f489cd6f7..d065bf3fb 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -13,7 +13,8 @@ import Graphics.Vty.CrossPlatform (mkVty) import Graphics.Vty.Input.Events import Graphics.Vty (Event(..), Key(..), Modifier(..)) import Graphics.Vty qualified as Vty -import System.Posix +import System.Console.ANSI (hSupportsANSI) +import System.Signal import Echidna.UI.Widgets #endif @@ -164,12 +165,12 @@ ui vm world dict initialCorpus = do NonInteractive outputFormat -> do serverStopVar <- newEmptyMVar #ifdef INTERACTIVE_UI - -- Handles ctrl-c, TODO: this doesn't work on Windows + -- Handles ctrl-c liftIO $ forM_ [sigINT, sigTERM] $ \sig -> - let handler = Catch $ do + let handler = \_ -> do stopWorkers workers void $ tryPutMVar serverStopVar () - in installHandler sig handler Nothing + in installHandler sig handler #endif let forwardEvent = putStrLn . ppLogLine uiEventsForwarderStopVar <- spawnListener forwardEvent @@ -337,7 +338,7 @@ monitor = do isTerminal :: IO Bool isTerminal = #ifdef INTERACTIVE_UI - (&&) <$> queryTerminal (Fd 0) <*> queryTerminal (Fd 1) + hSupportsANSI stdout #else pure False #endif diff --git a/package.yaml b/package.yaml index 9186b5999..0409f3c88 100644 --- a/package.yaml +++ b/package.yaml @@ -75,8 +75,9 @@ library: - condition: "!os(windows)" cpp-options: -DINTERACTIVE_UI dependencies: + - ansi-terminal - brick - - unix + - signal - vty - vty-crossplatform From fe8c2067da64b21ce1066470e060a6b796056adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 29 Apr 2024 20:47:18 -0300 Subject: [PATCH 04/15] Enable UI on all platforms --- package.yaml | 15 ++++++--------- stack.yaml | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.yaml b/package.yaml index 0409f3c88..8c170f8d6 100644 --- a/package.yaml +++ b/package.yaml @@ -39,9 +39,12 @@ default-extensions: library: source-dirs: lib/ + cpp-options: -DINTERACTIVE_UI dependencies: + - ansi-terminal - base16-bytestring - binary + - brick - bytestring - data-bword - data-dword @@ -60,26 +63,20 @@ library: - random - rosezipper - semver + - signal - split - strip-ansi-escape - time - unliftio - utf8-string - vector + - vty + - vty-crossplatform - wai-extra - warp - word-wrap - xml-conduit - yaml - when: - - condition: "!os(windows)" - cpp-options: -DINTERACTIVE_UI - dependencies: - - ansi-terminal - - brick - - signal - - vty - - vty-crossplatform executables: echidna: diff --git a/stack.yaml b/stack.yaml index d55494932..a8848f7f3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -11,3 +11,4 @@ extra-deps: - spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162 - spool-0.1@sha256:77780cbfc2c0be23ff2ea9e474062f3df97fcd9db946ee0b3508280a923b83e2,1461 - strip-ansi-escape-0.1.0.0@sha256:08f2ed93b16086a837ec46eab7ce8d27cf39d47783caaeb818878ea33c2ff75f,1628 +- vty-windows-0.2.0.3@sha256:0c010b1086a725046a8bb08bb1e6bfdfdb3cfe1c72d6fa77c37306ef9ec774d8,2844 From ec547685655ae440001cfffd67b84d24ac9c113e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Tue, 30 Apr 2024 09:21:45 -0300 Subject: [PATCH 05/15] Use pkgsStatic for Linux pkgsMusl fails to build for some reason. --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 2ea1f1cb0..d1071ae29 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ pkgs = nixpkgs.legacyPackages.${system}; # prefer musl on Linux, static glibc + threading does not work properly # TODO: maybe only override it for echidna-redistributable? - pkgsStatic = if pkgs.stdenv.hostPlatform.isLinux then pkgs.pkgsMusl else pkgs; + pkgsStatic = if pkgs.stdenv.hostPlatform.isLinux then pkgs.pkgsStatic else pkgs; # this is not perfect for development as it hardcodes solc to 0.5.7, test suite runs fine though # would be great to integrate solc-select to be more flexible, improve this in future solc = pkgs.stdenv.mkDerivation { @@ -88,7 +88,7 @@ "--extra-lib-dirs=${stripDylib (gmp.override { withStatic = true; })}/lib" "--extra-lib-dirs=${stripDylib secp256k1-static}/lib" "--extra-lib-dirs=${stripDylib (libff.override { enableStatic = true; })}/lib" - "--extra-lib-dirs=${zlib.static}/lib" + "--extra-lib-dirs=${zlib.override { static = true; shared = false; }}/lib" "--extra-lib-dirs=${stripDylib (libffi.overrideAttrs (_: { dontDisableStatic = true; }))}/lib" "--extra-lib-dirs=${stripDylib (ncurses-static)}/lib" ] ++ (if stdenv.hostPlatform.isDarwin then [ From 07794d44744fca2ecd82b3ca484b8b06a671c077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 1 May 2024 16:36:39 -0300 Subject: [PATCH 06/15] Remove conditional UI compilation All platforms now support the Echidna UI --- lib/Echidna/UI.hs | 38 +++++++++++--------------------------- lib/Echidna/UI/Widgets.hs | 4 ---- package.yaml | 1 - 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index d065bf3fb..b41399b0d 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -1,23 +1,10 @@ {-# LANGUAGE CPP #-} -{-# OPTIONS_GHC -Wno-unused-imports #-} module Echidna.UI where -#ifdef INTERACTIVE_UI import Brick import Brick.BChan import Brick.Widgets.Dialog qualified as B -import Data.Sequence ((|>)) -import Graphics.Vty.Config (VtyUserConfig, defaultConfig, configInputMap) -import Graphics.Vty.CrossPlatform (mkVty) -import Graphics.Vty.Input.Events -import Graphics.Vty (Event(..), Key(..), Modifier(..)) -import Graphics.Vty qualified as Vty -import System.Console.ANSI (hSupportsANSI) -import System.Signal -import Echidna.UI.Widgets -#endif - import Control.Concurrent (killThread, threadDelay) import Control.Exception (AsyncException) import Control.Monad @@ -29,7 +16,14 @@ import Data.ByteString.Lazy qualified as BS import Data.List.Split (chunksOf) import Data.Map (Map) import Data.Maybe (fromMaybe, isJust) +import Data.Sequence ((|>)) import Data.Time +import Graphics.Vty.Config (VtyUserConfig, defaultConfig, configInputMap) +import Graphics.Vty.CrossPlatform (mkVty) +import Graphics.Vty.Input.Events +import Graphics.Vty qualified as Vty +import System.Console.ANSI (hSupportsANSI) +import System.Signal import UnliftIO ( MonadUnliftIO, newIORef, readIORef, hFlush, stdout , writeIORef, timeout) import UnliftIO.Concurrent hiding (killThread, threadDelay) @@ -49,6 +43,7 @@ import Echidna.Types.Test (EchidnaTest(..), didFail, isOptimizationTest) import Echidna.Types.Tx (Tx) import Echidna.Types.World (World) import Echidna.UI.Report +import Echidna.UI.Widgets import Echidna.Utility (timePrefix, getTimestamp) data UIEvent = @@ -94,7 +89,6 @@ ui vm world dict initialCorpus = do uncurry (spawnWorker env perWorkerTestLimit) case effectiveMode of -#ifdef INTERACTIVE_UI Interactive -> do -- Channel to push events to update UI uiChannel <- liftIO $ newBChan 1000 @@ -158,20 +152,17 @@ ui vm world dict initialCorpus = do liftIO . putStrLn =<< ppCampaign vm states pure states -#else - Interactive -> error "Interactive UI is not available" -#endif NonInteractive outputFormat -> do serverStopVar <- newEmptyMVar -#ifdef INTERACTIVE_UI + -- Handles ctrl-c liftIO $ forM_ [sigINT, sigTERM] $ \sig -> let handler = \_ -> do stopWorkers workers void $ tryPutMVar serverStopVar () in installHandler sig handler -#endif + let forwardEvent = putStrLn . ppLogLine uiEventsForwarderStopVar <- spawnListener forwardEvent @@ -243,7 +234,6 @@ ui vm world dict initialCorpus = do workerStates workers = forM workers $ \(_, stateRef) -> readIORef stateRef -#ifdef INTERACTIVE_UI -- | Order the workers to stop immediately stopWorkers :: MonadIO m => [(ThreadId, a)] -> m () stopWorkers workers = @@ -332,16 +322,10 @@ monitor = do , appAttrMap = const attrs , appChooseCursor = neverShowCursor } -#endif -- | Heuristic check that we're in a sensible terminal (not a pipe) isTerminal :: IO Bool -isTerminal = -#ifdef INTERACTIVE_UI - hSupportsANSI stdout -#else - pure False -#endif +isTerminal = hSupportsANSI stdout -- | Composes a compact text status line of the campaign statusLine diff --git a/lib/Echidna/UI/Widgets.hs b/lib/Echidna/UI/Widgets.hs index d648b01c9..6cbef07f3 100644 --- a/lib/Echidna/UI/Widgets.hs +++ b/lib/Echidna/UI/Widgets.hs @@ -2,8 +2,6 @@ module Echidna.UI.Widgets where -#ifdef INTERACTIVE_UI - import Brick hiding (style) import Brick.AttrMap qualified as A import Brick.Widgets.Border @@ -387,5 +385,3 @@ strBreak = strWrapWith $ defaultWrapSettings { breakLongWords = True } txtBreak :: Text -> Widget n txtBreak = txtWrapWith $ defaultWrapSettings { breakLongWords = True } - -#endif diff --git a/package.yaml b/package.yaml index 8c170f8d6..56131107f 100644 --- a/package.yaml +++ b/package.yaml @@ -39,7 +39,6 @@ default-extensions: library: source-dirs: lib/ - cpp-options: -DINTERACTIVE_UI dependencies: - ansi-terminal - base16-bytestring From 0a354ab82071d59f5f0a438aad13073253f2ebdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 1 May 2024 16:37:20 -0300 Subject: [PATCH 07/15] Enable UI on ConHost as well See the introduction on https://hackage.haskell.org/package/ansi-terminal-1.1.1/docs/System-Console-ANSI.html --- lib/Echidna/UI.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index b41399b0d..7cb92c2a3 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -22,7 +22,7 @@ import Graphics.Vty.Config (VtyUserConfig, defaultConfig, configInputMap) import Graphics.Vty.CrossPlatform (mkVty) import Graphics.Vty.Input.Events import Graphics.Vty qualified as Vty -import System.Console.ANSI (hSupportsANSI) +import System.Console.ANSI (hNowSupportsANSI) import System.Signal import UnliftIO ( MonadUnliftIO, newIORef, readIORef, hFlush, stdout , writeIORef, timeout) @@ -325,7 +325,7 @@ monitor = do -- | Heuristic check that we're in a sensible terminal (not a pipe) isTerminal :: IO Bool -isTerminal = hSupportsANSI stdout +isTerminal = hNowSupportsANSI stdout -- | Composes a compact text status line of the campaign statusLine From 64ee7c35026dbfbe5e779b9a237da9e8d137818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 1 May 2024 18:02:04 -0300 Subject: [PATCH 08/15] Enable `eager-blackholing` Observed a ~2% speedup on longer runs when compiling both hevm and echidna with this flag. Besides, the Haskell documentation encourages enabling it for parallel code: https://downloads.haskell.org/~ghc/9.6.5/docs/users_guide/using-concurrent.html#compile-time-options-for-smp-parallelism --- flake.nix | 4 ++-- package.yaml | 1 + stack.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index d1071ae29..bc6220499 100644 --- a/flake.nix +++ b/flake.nix @@ -59,8 +59,8 @@ hevm = pkgs: pkgs.lib.pipe (pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { owner = "elopez"; repo = "hevm"; - rev = "3065046b2a3d2ac0ea23347ba2699a0f008d26c7"; - sha256 = "sha256-tTgtOgNzmjaLQjJj1/bYvEp0DXabswpl47usTmfqLP8="; + rev = "c263a35ca676c4d10df72d3f81536e5fb0297dc2"; + sha256 = "sha256-GO5rDgVV+Nj8OhmxEylJ0qv0hDxf+sJ1DLA8syjdNyM="; }) { secp256k1 = pkgs.secp256k1; }) ([ pkgs.haskell.lib.compose.dontCheck diff --git a/package.yaml b/package.yaml index 56131107f..e1b29373d 100644 --- a/package.yaml +++ b/package.yaml @@ -9,6 +9,7 @@ ghc-options: - -O2 - -Wall - -fno-warn-orphans + - -feager-blackholing # https://github.com/haskell/cabal/issues/4739 - -optP-Wno-nonportable-include-path - -fspecialize-aggressively diff --git a/stack.yaml b/stack.yaml index a8848f7f3..39a831c40 100644 --- a/stack.yaml +++ b/stack.yaml @@ -5,7 +5,7 @@ packages: extra-deps: - git: https://github.com/elopez/hevm.git - commit: 3065046b2a3d2ac0ea23347ba2699a0f008d26c7 + commit: c263a35ca676c4d10df72d3f81536e5fb0297dc2 - smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421 - spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162 From 14629cff8171e27d601735f197d772e1e3aba9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 1 May 2024 18:43:21 -0300 Subject: [PATCH 09/15] Resolve hlint warnings --- lib/Echidna/UI.hs | 2 +- lib/Echidna/UI/Widgets.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index 7cb92c2a3..784734c09 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -158,7 +158,7 @@ ui vm world dict initialCorpus = do -- Handles ctrl-c liftIO $ forM_ [sigINT, sigTERM] $ \sig -> - let handler = \_ -> do + let handler _ = do stopWorkers workers void $ tryPutMVar serverStopVar () in installHandler sig handler diff --git a/lib/Echidna/UI/Widgets.hs b/lib/Echidna/UI/Widgets.hs index 6cbef07f3..3310d2463 100644 --- a/lib/Echidna/UI/Widgets.hs +++ b/lib/Echidna/UI/Widgets.hs @@ -145,10 +145,10 @@ logPane uiState = showLogLine :: (LocalTime, CampaignEvent) -> Widget Name showLogLine (time, event@(WorkerEvent workerId _)) = - (withAttr (attrName "time") $ str $ (timePrefix time) <> "[Worker " <> show workerId <> "] ") + withAttr (attrName "time") (str $ timePrefix time <> "[Worker " <> show workerId <> "] ") <+> strBreak (ppCampaignEvent event) showLogLine (time, event) = - (withAttr (attrName "time") $ str $ (timePrefix time) <> " ") <+> strBreak (ppCampaignEvent event) + withAttr (attrName "time") (str $ timePrefix time <> " ") <+> strBreak (ppCampaignEvent event) summaryWidget :: Env -> UIState -> Widget Name summaryWidget env uiState = @@ -179,7 +179,7 @@ summaryWidget env uiState = <=> str ("New coverage: " <> timeElapsed uiState uiState.lastNewCov <> " ago") <+> fill ' ' rightSide = - padLeft (Pad 1) $ + padLeft (Pad 1) (rpcInfoWidget uiState.fetchedContracts uiState.fetchedSlots env.chainId) timeElapsed :: UIState -> LocalTime -> String @@ -304,7 +304,7 @@ tracesWidget vm = do let traces = stripAnsiEscapeCodes $ showTraceTree dappInfo vm pure $ if T.null traces then str "" - else str "Traces" <+> str ":" <=> (txtBreak traces) + else str "Traces" <+> str ":" <=> txtBreak traces failWidget :: MonadReader Env m From 6e2eccb6c663a96d8a0b1f22e45f895c7386482f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 1 May 2024 19:09:54 -0300 Subject: [PATCH 10/15] Update Linux Stack CI to 9.6 --- .github/container-linux-static/Dockerfile | 8 ++++---- .github/container-linux-static/stack-config.yaml | 5 +++++ .github/workflows/ci.yml | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .github/container-linux-static/stack-config.yaml diff --git a/.github/container-linux-static/Dockerfile b/.github/container-linux-static/Dockerfile index 3b37e2bcc..9ab126465 100644 --- a/.github/container-linux-static/Dockerfile +++ b/.github/container-linux-static/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.18.4 +FROM alpine:3.18.6 # Based on https://github.com/fpco/alpine-haskell-stack/blob/9.2.8v2/ghc-Dockerfile RUN apk upgrade --no-cache &&\ @@ -36,12 +36,12 @@ RUN ln -s /usr/lib/libncurses.a /usr/lib/libtinfo.a COPY stack-config.yaml /root/.stack/config.yaml RUN cd /tmp && \ - curl -sSLo /tmp/ghc.tar.xz https://downloads.haskell.org/~ghc/9.4.7/ghc-9.4.7-x86_64-alpine3_12-linux.tar.xz && \ + curl -sSLo /tmp/ghc.tar.xz https://downloads.haskell.org/~ghc/9.6.5/ghc-9.6.5-x86_64-alpine3_12-linux.tar.xz && \ tar xf ghc.tar.xz && \ - cd ghc-9.4.7-x86_64-unknown-linux && \ + cd ghc-9.6.5-x86_64-unknown-linux && \ ./configure --prefix=/usr/local && \ make install && \ - rm -rf /tmp/ghc.tar.xz /tmp/ghc-9.4.7-x86_64-unknown-linux + rm -rf /tmp/ghc.tar.xz /tmp/ghc-9.6.5-x86_64-unknown-linux RUN apk upgrade --no-cache &&\ apk add --no-cache \ diff --git a/.github/container-linux-static/stack-config.yaml b/.github/container-linux-static/stack-config.yaml new file mode 100644 index 000000000..9b5d485a6 --- /dev/null +++ b/.github/container-linux-static/stack-config.yaml @@ -0,0 +1,5 @@ +extra-include-dirs: +- /usr/include +extra-lib-dirs: +- /lib +- /usr/lib diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 550362b8d..17128f0dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: env: # Tag for cache invalidation - CACHE_VERSION: v6 + CACHE_VERSION: v7 jobs: build: @@ -22,7 +22,7 @@ jobs: include: - os: ubuntu-20.04 shell: bash - container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.4.7\", \"options\": \"--user 1001\"}" + container: "{\"image\": \"elopeztob/alpine-haskell-stack-echidna:ghc-9.6.5\", \"options\": \"--user 1001\"}" - os: macos-13 # x86_64 macOS shell: bash - os: windows-latest From 523f6abc5b01b5fd3048d5d492d986f58fb93178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Sun, 5 May 2024 12:57:15 -0300 Subject: [PATCH 11/15] Fix compilation failure after merge --- lib/Echidna/SymExec.hs | 1 + lib/Echidna/UI.hs | 3 +-- lib/Echidna/UI/Widgets.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Echidna/SymExec.hs b/lib/Echidna/SymExec.hs index 752dfcdfa..3c0b973d2 100644 --- a/lib/Echidna/SymExec.hs +++ b/lib/Echidna/SymExec.hs @@ -131,6 +131,7 @@ vmMakeSymbolic vm , config = vm.config , forks = vm.forks , currentFork = vm.currentFork + , labels = vm.labels } frameStateMakeSymbolic :: FrameState Concrete s -> FrameState Symbolic s diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index 18328359a..0d1dc3db1 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -15,7 +15,7 @@ import Control.Monad.ST (RealWorld) import Data.ByteString.Lazy qualified as BS import Data.List.Split (chunksOf) import Data.Map (Map) -import Data.Maybe (fromMaybe, isJust) +import Data.Maybe (isJust) import Data.Sequence ((|>)) import Data.Text (Text) import Data.Time @@ -41,7 +41,6 @@ import Echidna.Types.Campaign import Echidna.Types.Config import Echidna.Types.Corpus qualified as Corpus import Echidna.Types.Coverage (scoveragePoints) -import Echidna.Types.Solidity (SolConf(..)) import Echidna.Types.Test (EchidnaTest(..), didFail, isOptimizationTest) import Echidna.Types.Tx (Tx) import Echidna.Types.World (World) diff --git a/lib/Echidna/UI/Widgets.hs b/lib/Echidna/UI/Widgets.hs index 3ad5eb09b..2cbdc1800 100644 --- a/lib/Echidna/UI/Widgets.hs +++ b/lib/Echidna/UI/Widgets.hs @@ -145,7 +145,7 @@ logPane uiState = showLogLine :: (LocalTime, CampaignEvent) -> Widget Name showLogLine (time, event@(WorkerEvent workerId workerType _)) = - (withAttr (attrName "time") $ str $ (timePrefix time) <> "[Worker " <> show workerId <> symSuffix <> "] ") + withAttr (attrName "time") (str $ timePrefix time <> "[Worker " <> show workerId <> symSuffix <> "] ") <+> strBreak (ppCampaignEvent event) where symSuffix = case workerType of From 533105dc3d5503f27a20d7da3497b907bcd8cc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Thu, 25 Jul 2024 11:25:16 +0200 Subject: [PATCH 12/15] Upgrade hevm to `echidna-patches-20240725` --- flake.nix | 6 +++--- stack.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index bc6220499..33029968f 100644 --- a/flake.nix +++ b/flake.nix @@ -57,10 +57,10 @@ ''; hevm = pkgs: pkgs.lib.pipe (pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { - owner = "elopez"; + owner = "trail-of-forks"; repo = "hevm"; - rev = "c263a35ca676c4d10df72d3f81536e5fb0297dc2"; - sha256 = "sha256-GO5rDgVV+Nj8OhmxEylJ0qv0hDxf+sJ1DLA8syjdNyM="; + rev = "3aba82f06a2d1e0a4a4c26458f747a46dad0e7e2"; + sha256 = "sha256-NXXhEqHTQEL2N9RhXa1eczIsQtIM3mvPfyWXlBXpxK4="; }) { secp256k1 = pkgs.secp256k1; }) ([ pkgs.haskell.lib.compose.dontCheck diff --git a/stack.yaml b/stack.yaml index 39a831c40..12aa54f57 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,8 +4,8 @@ packages: - '.' extra-deps: -- git: https://github.com/elopez/hevm.git - commit: c263a35ca676c4d10df72d3f81536e5fb0297dc2 +- git: https://github.com/trail-of-forks/hevm.git + commit: 3aba82f06a2d1e0a4a4c26458f747a46dad0e7e2 - smt2-parser-0.1.0.1@sha256:1e1a4565915ed851c13d1e6b8bb5185cf5d454da3b43170825d53e221f753d77,1421 - spawn-0.3@sha256:b91e01d8f2b076841410ae284b32046f91471943dc799c1af77d666c72101f02,1162 From 298db5030ca215c59175d8527ab15aac0d394d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Thu, 25 Jul 2024 11:55:58 +0200 Subject: [PATCH 13/15] Fix lint warnings, unused imports --- lib/Echidna/UI.hs | 2 -- lib/Echidna/UI/Widgets.hs | 1 - 2 files changed, 3 deletions(-) diff --git a/lib/Echidna/UI.hs b/lib/Echidna/UI.hs index 7ac966b05..dcbccdc13 100644 --- a/lib/Echidna/UI.hs +++ b/lib/Echidna/UI.hs @@ -29,7 +29,6 @@ import UnliftIO ( MonadUnliftIO, IORef, newIORef, readIORef, hFlush, stdout , writeIORef, timeout) import UnliftIO.Concurrent hiding (killThread, threadDelay) -import EVM.Solidity (SolcContract) import EVM.Types (Addr, Contract, VM, VMType(Concrete), W256) import Echidna.ABI @@ -43,7 +42,6 @@ import Echidna.Types.Corpus qualified as Corpus import Echidna.Types.Coverage (scoveragePoints) import Echidna.Types.Test (EchidnaTest(..), didFail, isOptimizationTest) import Echidna.Types.Tx (Tx) -import Echidna.Types.World (World) import Echidna.UI.Report import Echidna.UI.Widgets import Echidna.Utility (timePrefix, getTimestamp) diff --git a/lib/Echidna/UI/Widgets.hs b/lib/Echidna/UI/Widgets.hs index e33685bcd..cfa851bf3 100644 --- a/lib/Echidna/UI/Widgets.hs +++ b/lib/Echidna/UI/Widgets.hs @@ -341,7 +341,6 @@ failWidget b test = do ( failureBadge <+> str (" with " ++ show test.result) , shrinkWidget b test <=> titleWidget <=> s <=> str " " <=> traces ) - where optWidget :: MonadReader Env m From 965a62cde1f888c506b46e184f507d1a6b70244e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Thu, 25 Jul 2024 11:58:21 +0200 Subject: [PATCH 14/15] flake: align nixpkgs with hevm --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 27cbdfd65..fc545ab1e 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713284584, - "narHash": "sha256-rRuPBJD9+yjz7tY3xC/BvFUwloutynR9piiVE6fhGqo=", + "lastModified": 1720368505, + "narHash": "sha256-5r0pInVo5d6Enti0YwUSQK4TebITypB42bWy5su3MrQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2b6ee326ad047870526d9a3ae88dfd0197da898d", + "rev": "ab82a9612aa45284d4adf69ee81871a389669a9e", "type": "github" }, "original": { From cb2c3b1da46d4b9e6d5ff2453bf02e90ee6fd9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Thu, 25 Jul 2024 12:13:43 +0200 Subject: [PATCH 15/15] flake: fix libiconv for x86_64 darwin > app/utf8-troubleshoot/cbits/locale.c:10:10: error: > fatal error: 'libcharset.h' file not found > | > 10 | #include > | ^ > #include > ^~~~~~~~~~~~~~ Also link iconv dynamically on Darwin as well --- flake.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 33029968f..0e4157443 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,16 @@ ncurses-static = pkgsStatic.ncurses.override { enableStatic = true; }; + hsPkgs = ps : + ps.haskellPackages.override { + overrides = hfinal: hprev: { + with-utf8 = + if (with ps.stdenv; hostPlatform.isDarwin && hostPlatform.isx86) + then ps.haskell.lib.compose.overrideCabal (_ : { extraLibraries = [ps.libiconv]; }) hprev.with-utf8 + else hprev.with-utf8; + }; + }; + cc-workaround-nix-23138 = pkgs.writeScriptBin "cc-workaround-nix-23138" '' if [ "$1" = "--print-file-name" ] && [ "$2" = "c++" ]; then @@ -56,7 +66,7 @@ fi ''; - hevm = pkgs: pkgs.lib.pipe (pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub { + hevm = pkgs: pkgs.lib.pipe ((hsPkgs pkgs).callCabal2nix "hevm" (pkgs.fetchFromGitHub { owner = "trail-of-forks"; repo = "hevm"; rev = "3aba82f06a2d1e0a4a4c26458f747a46dad0e7e2"; @@ -69,7 +79,7 @@ ]); echidna = pkgs: with pkgs; lib.pipe - (haskellPackages.callCabal2nix "echidna" ./. { hevm = hevm pkgs; }) + ((hsPkgs pkgs).callCabal2nix "echidna" ./. { hevm = hevm pkgs; }) ([ # FIXME: figure out solc situation, it conflicts with the one from # solc-select that is installed with slither, disable tests in the meantime @@ -84,16 +94,14 @@ (echidna pkgsStatic) [ (haskell.lib.compose.appendConfigureFlags - ([ + [ "--extra-lib-dirs=${stripDylib (gmp.override { withStatic = true; })}/lib" "--extra-lib-dirs=${stripDylib secp256k1-static}/lib" "--extra-lib-dirs=${stripDylib (libff.override { enableStatic = true; })}/lib" "--extra-lib-dirs=${zlib.override { static = true; shared = false; }}/lib" "--extra-lib-dirs=${stripDylib (libffi.overrideAttrs (_: { dontDisableStatic = true; }))}/lib" "--extra-lib-dirs=${stripDylib (ncurses-static)}/lib" - ] ++ (if stdenv.hostPlatform.isDarwin then [ - "--extra-lib-dirs=${stripDylib (libiconv.override { enableStatic = true; })}/lib" - ] else []))) + ]) (haskell.lib.compose.enableCabalFlag "static") ]; @@ -124,10 +132,12 @@ # get the path for libcxx cxx=$(echo "$libs" | ${grep} '^/nix/store/.*/libc++\.') cxxabi=$(echo "$libs" | ${grep} '^/nix/store/.*/libc++abi\.') + iconv=$(echo "$libs" | ${grep} '^/nix/store/.*/libiconv\.') # rewrite /nix/... library paths to point to /usr/lib chmod 777 $out/bin/echidna ${install_name_tool} -change "$cxx" /usr/lib/libc++.1.dylib $out/bin/echidna ${install_name_tool} -change "$cxxabi" /usr/lib/libc++abi.dylib $out/bin/echidna + ${install_name_tool} -change "$iconv" /usr/lib/libiconv.dylib $out/bin/echidna # fix TERMINFO path in ncurses ${perl} -i -pe 's#(${ncurses-static}/share/terminfo)#"/usr/share/terminfo" . "\x0" x (length($1) - 19)#e' $out/bin/echidna # check that no nix deps remain