Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #943

Merged
merged 34 commits into from
Feb 26, 2023
Merged

Windows support #943

merged 34 commits into from
Feb 26, 2023

Conversation

elopez
Copy link
Member

@elopez elopez commented Feb 17, 2023

This is (very early, untested) support for building Echidna in Windows.

Unfortunately vty does not support Windows, and as vty is a dependency of brick, Echidna on Windows does not support interactive mode.

image

    ghc-9.2.5.exe:  | D:\a\_temp\msys64\home\runneradmin\.local\lib\libsecp256k1.a: unknown symbol `__imp___gmpn_gcdext'
    ghc-9.2.5.exe:  | C:\sr\snapshots\0f12f00e\lib\x86_64-windows-ghc-9.2.5\hevm-0.50.2-8r7d7yHNo9G4MeqIafLjGL\HShevm-0.50.2-8r7d7yHNo9G4MeqIafLjGL.o: unknown symbol `secp256k1_context_create'
    ghc-9.2.5.exe: Could not load Object Code C:\sr\snapshots\0f12f00e\lib\x86_64-windows-ghc-9.2.5\hevm-0.50.2-8r7d7yHNo9G4MeqIafLjGL\HShevm-0.50.2-8r7d7yHNo9G4MeqIafLjGL.o.
This also removes the dependency on gmp
@elopez elopez force-pushed the elopez/windows-build-refresh branch 2 times, most recently from d3d2fd5 to 5fdc3e2 Compare February 18, 2023 00:23
@elopez elopez force-pushed the elopez/windows-build-refresh branch from 5fdc3e2 to ce70f04 Compare February 18, 2023 00:37
@elopez elopez force-pushed the elopez/windows-build-refresh branch from b80795c to 043f8e8 Compare February 18, 2023 05:23
@elopez elopez force-pushed the elopez/windows-build-refresh branch from 130aec8 to ff8088d Compare February 22, 2023 21:17
solc-returned paths use Windows separators (e.g. a\\b\\c.sol:Foo)
so we need to rewrite paths to account for that.
The Windows changes have been merged upstream now.
@elopez elopez force-pushed the elopez/windows-build-refresh branch from cba8c19 to 2317cc5 Compare February 24, 2023 13:21
@elopez elopez marked this pull request as ready for review February 24, 2023 15:20
Copy link
Member

@arcz arcz left a comment

Choose a reason for hiding this comment

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

Can we have a function

@@ -45,6 +46,10 @@ import Echidna.Types.Test (EchidnaTest(..))
import Echidna.Types.Tx (basicTx, createTxWithValue, unlimitedGasPerBlock, initialTimestamp, initialBlockNumber)
import Echidna.Types.World (World(..))

-- | OS-specific path to the "null" file, which accepts writes without storing them
nullFilePath :: String
Copy link
Member

Choose a reason for hiding this comment

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

can we put this somewhere below the call site?

contractId n | T.any (== ':') n = let (splitPath, splitName) = T.breakOn ":" n in
rewritePathSeparators splitPath `T.append` splitName
| otherwise = ":" `append` n
rewritePathSeparators = T.pack . joinPath . splitDirectories . T.unpack
Copy link
Member

Choose a reason for hiding this comment

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

why this is needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

solc-returned paths use Windows separators (e.g. a\b\c.sol:Foo) so we need to rewrite paths to account for that.

lib/Echidna/UI.hs Show resolved Hide resolved
@elopez elopez force-pushed the elopez/windows-build-refresh branch from fef5e5f to 0df567a Compare February 24, 2023 22:00
@arcz arcz merged commit 3a62777 into master Feb 26, 2023
@arcz arcz deleted the elopez/windows-build-refresh branch February 26, 2023 14:38
@rayeaster
Copy link

rayeaster commented Mar 15, 2023

any idea why I get this error using echidna.exe testEchidna.sol --contract xxxTest

echidna.exe: Couldn't compile given file
stdout:
stderr:
ERROR:CryticCompile:[WinError 2] The system cannot find the file specified

@ggrieco-tob
Copy link
Member

@rayeaster can you please create an issue from this so we can track it down more easily? 🙂

@rayeaster
Copy link

@rayeaster can you please create an issue from this so we can track it down more easily? 🙂

No worry, I get it working like a charm on my local windows now with crytic-args option:

.\echidna.exe .\testEchidna.sol --contract xxxTest --crytic-args "--solc C:\Users\xxx\Downloads\solcs\solc0810.exe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants