solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Support Apple Silicon in Release Builds

Open xanderdunn opened this issue 3 years ago • 29 comments

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.

xanderdunn avatar Nov 16 '21 22:11 xanderdunn

This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:

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.

cameel avatar Nov 17 '21 15:11 cameel

Related issue for Linux on ARM: #11351.

cameel avatar Nov 17 '21 15:11 cameel

In practice #11351 was tracking this issue as we're still waiting for CircleCI.

axic avatar Nov 17 '21 15:11 axic

And if someone builds Solidity from source on macOS, it is automatically built for ARM. No flag or setting needed.

axic avatar Nov 17 '21 15:11 axic

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 avatar Nov 17 '21 15:11 cameel

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.

xanderdunn avatar Nov 17 '21 16:11 xanderdunn

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.

cameel avatar Nov 17 '21 17:11 cameel

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

xanderdunn avatar Nov 17 '21 17:11 xanderdunn

This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:

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?

ghost avatar Nov 20 '21 02:11 ghost

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.

cameel avatar Nov 21 '21 16:11 cameel

Thanks for that info. Looking forward to seeing what happens with apple silicon support

ghost avatar Nov 21 '21 22:11 ghost

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.

cameel avatar Jan 24 '22 21:01 cameel

This is on our roadmap but we're blocked by our testing infrastructure. Currently neither Github Actions nor CircleCI support Apple M1 runners. See:

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?

tynes avatar Mar 04 '22 22:03 tynes

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.

gakonst avatar Mar 12 '22 12:03 gakonst

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.

chriseth avatar Mar 14 '22 11:03 chriseth

Got it. Hopefully there will be a runner soon https://github.com/actions/runner/issues/805#issuecomment-1041968059

gakonst avatar Mar 14 '22 11:03 gakonst

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 😅

axic avatar Jun 10 '22 22:06 axic

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!

cameel avatar Jan 25 '23 17:01 cameel

Finally it is here: https://circleci.com/blog/m1-mac-resource-class/

axic avatar Mar 03 '23 10:03 axic

Incredible. Please keep us posted if you folks end up doing official releases using that.

gakonst avatar Mar 10 '23 00:03 gakonst

any update on this? was this covered in 0.8.21 or not?

levx-me avatar Jul 25 '23 08:07 levx-me

@aarlt, what part is missing here? Wasn't it fixed by https://github.com/ethereum/solidity/pull/14725?

r0qs avatar Feb 13 '24 18:02 r0qs

@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?

aarlt avatar Feb 13 '24 18:02 aarlt

The thing that's missing is that we don't have ARM binaries for anything below 0.8.24.

cameel avatar Feb 13 '24 20:02 cameel

The arm binaries starting at v0.8.24 are still under solc-bin/macosx-amd64/, right?

lmittmann avatar Mar 02 '24 10:03 lmittmann

Yes. They're now universal binaries supporting both ARM and Intel.

cameel avatar Mar 02 '24 11:03 cameel

Is there any plan to also provide universal binaries for older solc versions?

lmittmann avatar Mar 03 '24 10:03 lmittmann

We may add them eventually, but at the moment we have other priorities.

cameel avatar Mar 04 '24 14:03 cameel

@zerosnacks Since version 0.8.24 we are releasing universal binaries of the compiler. These universal binaries can run natively on apple silicon.

aarlt avatar Jul 11 '24 16:07 aarlt