solc-typed-ast icon indicating copy to clipboard operation
solc-typed-ast copied to clipboard

Native compiler for Apple Silicon

Open gas1cent opened this issue 1 year ago • 1 comments

Description

Starting from v0.8.24, solc binaries for macos have become compatible with Apple Silicon chips. It would be very nice to add support for them at some point.

Context

You can find the related discussion here: https://github.com/ethereum/solidity/issues/12291

gas1cent avatar Feb 19 '24 14:02 gas1cent

Greetings.

On one hand - there are WASM builds, that should run fine, aside from native. On the other hand, if we would like to support this, we need to change something in following lines:

https://github.com/Consensys/solc-typed-ast/blob/9a70060c2eef771d80790f90a9b37e611fb28721/src/compile/kinds/md.ts#L7-L32

Following logic of downloading proper compiler should work as intended:

https://github.com/Consensys/solc-typed-ast/blob/9a70060c2eef771d80790f90a9b37e611fb28721/src/compile/kinds/compiler.ts#L96-L193

Running

# Locate cache with downloaded compilers:
sol-ast-compile --locate-compiler-cache

# Pre-download native compilers:
sol-ast-compile --download-compilers native

Should result downloading of proper compilers for the current platform.

Some very basic requirement is to successfully compile empty contract with native compiler:

echo 'contract Test {}' | sol-ast-compile --stdin --compiler-kind native --mode sol --tree
SourceUnit #2 -> stdin
|   ContractDefinition #1 -> contract Test

Also we do not run tests against multiple platforms due to our time and resourse constraints. I also do not have Silicon-based hardware in my reach.

[!TIP] We would gladly accept incoming PRs and external help.

blitz-1306 avatar Feb 21 '24 05:02 blitz-1306