Issues installing solidity `0.8.20` with `solc-select` on M1 mac
eugenioclrc opened this issue · comments
Reproducing steps:
whitehat@4cfb79db3f7b:~/test/echidna$ solc-select install 0.8.20
Installing solc '0.8.20'...
solVersion '0.8.20' installed.
whitehat@4cfb79db3f7b:~/test/echidna$ solc-select use 0.8.20
Switched global version to 0.8.20
whitehat@4cfb79db3f7b:~/test/echidna$ solc --version
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
whitehat@4cfb79db3f7b:~/test/echidna$
- Need to verify on macos as host, on windows as host works with no issues
- It may be a problem with solc-select itself
- Need further investigation
Gonna reupdate everything and re checke, stay tunned
Dunno if maybe one of these answers from solc-select will help:
- https://github.com/crytic/solc-select#oserror-errno-86-bad-cpu-type-in-executable (this one seems Mac related)
Also there are people that uses version 0.2.0 which seems less buggy:
pip3 uninstall solc-select
pip3 install solc-select==0.2.0
solc-select install
WSL ubuntu issue (may be related)
Succeded to replicate the error on mac M1, and solved by building the docker image the following flag:
docker build --platform linux/amd64 -t whitehat-machine .
Then follow the rest of the instructions.
Make sure you have Rosetta installed on your macOS.
solc binaries are built for x86_64 linux, so if you're building arm64 linux containers (e.g. on a M1 Mac) they won't normally run. Older solc versions were fully static binaries, so they work fine if you're using Docker Desktop on M1 because the Intel emulation handles them nicely. Newer solc builds are not static though, and will fail to run on an arm64 container without the proper x86_64 libraries installed.
If you're using Docker Desktop with Rosetta off (i.e, with the classic QEMU user-space emulation), you can use something like this to be able to run newer solc binaries: https://github.com/crytic/slither/blob/master/Dockerfile#L30-L36