solidity
solidity copied to clipboard
Support Apple Silicon in Release Builds
macOS release builds are currently x86_64 architecture only. Apple has moved away from x86_x64 in favor of arm64 for its laptop and desktop machines. It would be beneficial to developers on Mac machines to provide macOS arm64 builds in releases.
This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:
- Apple M1 (Apple Silion) Support on CircleCI
- https://github.com/actions/virtual-environments/issues/2187
All we can do currently is to cross-compile for that platform on Intel-based macOS runners but we would not be able to run tests against these executables so we're not comfortable including them in the official releases.
In the meantime, you should still be able to get a native build of the compiler using our homebrew formulas because that will build the compiler from source on your own M1 machine.
Also note that we provide wasm builds which should run on any platform and many frameworks use them via solc-js. You can already use the compiler on M1 this way with e.g. Hardhat or Truffle.
Related issue for Linux on ARM: #11351.
In practice #11351 was tracking this issue as we're still waiting for CircleCI.
And if someone builds Solidity from source on macOS, it is automatically built for ARM. No flag or setting needed.
In practice #11351 was tracking this issue as we're still waiting for CircleCI.
Might still be better to have to separate issues because I suspect that we won't be implementing both at the same time. But we could also close this one and just update the title of the other one to make it clear that it's about macOS too.
BTW, you reminded me that on the last call with CircleCI they said that added support for Linux on ARM.
Thanks @cameel, I missed the Linux ARM issue in my search. Building the repo on my system at the 0.7.6 tag worked. Installing 0.8.9 or 0.8.10 via Homebrew also worked. However, the Homebrew 0.7.6 formula built for the wrong architecture, still x86.
However, the Homebrew 0.7.6 formula built for the wrong architecture, still x86.
Interesting. @axic is this something we had to explicitly add support for in our CMake config? 0.7 and 0.8 formulas are nearly identical and the only significant difference is which Solidity source tarball gets used.
Hmm, disregard the Homebrew issue. I'm not sure what I did the first time but installing again just now has the right architecture:
$ brew install solidity@7
$ which solc
/opt/homebrew/bin/solc
$ solc --version
solc, the solidity compiler commandline interface
Version: 0.7.6+commit.7338295f.Darwin.appleclang
$ file $(which solc)
/opt/homebrew/bin/solc: Mach-O 64-bit executable arm64
This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:
- Apple M1 (Apple Silion) Support on CircleCI
- Support for VMs on Apple M1 actions/virtual-environments#2187
All we can do currently is to cross-compile for that platform on Intel-based macOS runners but we would not be able to run tests against these executables so we're not comfortable including them in the official releases.
In the meantime, you should still be able to get a native build of the compiler using our homebrew formulas because that will build the compiler from source on your own M1 machine.
Also note that we provide wasm builds which should run on any platform and many frameworks use them via solc-js. You can already use the compiler on M1 this way with e.g. Hardhat or Truffle.
In practice #11351 was tracking this issue as we're still waiting for CircleCI.
Might still be better to have to separate issues because I suspect that we won't be implementing both at the same time. But we could also close this one and just update the title of the other one to make it clear that it's about macOS too.
BTW, you reminded me that on the last call with CircleCI they said that added support for Linux on ARM.
@cameel
Thanks for the information, it is much appreciated :) By any chance, do you have any updates with regards to where GitHub Actions is at with respect to its support for an Apple M1 runner?
No idea about Github Actions, though we'd only really use it as the last resort since almost all of our CI and build infrastructure is on CircleCI.
As for CircleCI, they showed it on their roadmap last time we talked to them and it's definitely coming (obstacles seem to be mostly of legal nature) but there's no concrete ETA for it at this moment.
Thanks for that info. Looking forward to seeing what happens with apple silicon support
Comment from CircleCI from 2022-01-11 on Support new M1 ARM-based Macs:
Update: We are planning to add Apple Silicon support to our upcoming dedicated host offering. I will post an update once I have a timeline available to share! We are also looking into ways to support this new hardware in our non-dedicated host solution, though we're still researching this and are unable to provide any concrete details at this time.
This is probably because AWS started offering M1 recently. The "dedicated host" option AFAIK means using the VM service which basically runs CI on your own Amazon AWS account rather than on CircleCI infrastructure. That looks like a lot of hassle compared to our current setup but should be doable once they release it. Not sure if we want to get into that though.
Github did make Big Sur generally available in August but there's no mention of M1 so I'm assuming that's still all on x86.
This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:
- Apple M1 (Apple Silion) Support on CircleCI
- Support for VMs on Apple M1 actions/virtual-environments#2187
All we can do currently is to cross-compile for that platform on Intel-based macOS runners but we would not be able to run tests against these executables so we're not comfortable including them in the official releases.
In the meantime, you should still be able to get a native build of the compiler using our homebrew formulas because that will build the compiler from source on your own M1 machine.
Also note that we provide wasm builds which should run on any platform and many frameworks use them via solc-js. You can already use the compiler on M1 this way with e.g. Hardhat or Truffle.
Is there an easy way to cross compile solc to apple silicon from x86 linux?
All we can do currently is to cross-compile for that platform on Intel-based macOS runners but we would not be able to run tests against these executables so we're not comfortable including them in the official releases.
We'd really love to have cross-compiled binaries that are officially released.
For context, people really need the ARM builds and have started to create self-hosted repositories of binaries for usage in solidity version managers:
- https://github.com/crytic/solc (not arm but same point)
- https://github.com/nikitastupin/solc/
- https://github.com/roynalnaruto/solc-builds
This is arguably more dangerous than having an official release which you can put under an experimental path in your APIs.
I'm sorry, but we don't want to release binaries that did not go through our testing pipeline.
It's by the way totally fine and danger-free to work with a compiler someone else built because you can cross-check the bytecode with an official compiler binary.
Got it. Hopefully there will be a runner soon https://github.com/actions/runner/issues/805#issuecomment-1041968059
It's by the way totally fine and danger-free to work with a compiler someone else built because you can cross-check the bytecode with an official compiler binary.
A simple way to do that is by uploading the JSON to https://sourcify.dev and see if it can verify it 😅
Looks like M1 support on CircleCI is coming soon:
We are now targeting end of February 2023 for our M1 launch. We thank everyone for their patience and are excited to have you try out these resources!
Finally it is here: https://circleci.com/blog/m1-mac-resource-class/
Incredible. Please keep us posted if you folks end up doing official releases using that.
any update on this? was this covered in 0.8.21 or not?
@aarlt, what part is missing here? Wasn't it fixed by https://github.com/ethereum/solidity/pull/14725?
@aarlt, what part is missing here? Wasn't it fixed by #14725?
I would also agree that this was fixed by https://github.com/ethereum/solidity/pull/14725. However, I'm not very sure I think that @cameel added that Part of in the PR - maybe @cameel thought that there is still something missing. Not sure. @cameel do you still see something missing here?
The thing that's missing is that we don't have ARM binaries for anything below 0.8.24.
The arm binaries starting at v0.8.24 are still under solc-bin/macosx-amd64/, right?
Yes. They're now universal binaries supporting both ARM and Intel.
Is there any plan to also provide universal binaries for older solc versions?
We may add them eventually, but at the moment we have other priorities.
@zerosnacks Since version 0.8.24 we are releasing universal binaries of the compiler. These universal binaries can run natively on apple silicon.