apollographql / federation-rs

Contains source code for Apollo Federation's Rust<--> JavaScript interop
Other
35 stars 23 forks source link

chore: provide prebuilt binaries for `aarch64-apple-darwin` #142

Open EverlastingBugstopper opened 2 years ago

EverlastingBugstopper commented 2 years ago

Situation

Developers want to run rover compiled for the ARM architecture which runs on their new Mac computers with Apple processors. Rover downloads pre-built supergraph binaries that are built from source code in this repository. We currently provide pre-built binaries for architectures x86_64-apple-darwin, x86_64-pc-windows-msvc, and x86_64-unknown-linux-gnu. Our next releases (2.0.6 and 0.36.2) will also have support for the aarch64-unknown-linux-gnu architecture.

Problem

We're blocked on support for aarch64-apple-darwin for a few reasons:

1) CircleCI can only run workflows on MacOS with an x86_64 processor 2) You can cross-compile for aarch64-apple-darwin on an x86_64 machine, but v8 will still generate snapshots (bytecode) in x86_64. This means that running supergraph compose on an M1 when it was compiled on Intel will fail miserably.

Resolution for now

Only deliver prebuilt aarch64-unknown-linux-gnu binaries, and forgo native ARM support for Macs processors. Many other tools at the moment do not provide binaries for this architecture because Apple makes it incredibly hard to support. This should be fine! M1 users can run x86_64-apple-darwin binaries because of Apple's emulation software Rosetta. This should work by default with no configuration because we sign our binaries. Running in Docker will also work because we provide pre-built binaries for aarch64-unknown-linux-gnu.

Long term resolutions

There are a few paths forward here:

1) If Circle (or Apple) start renting out CI servers that run on Apple's processors, we'll use that to provide these binaries. 2) If Federation gets oxidized (see: rewritten in 🦀 Rust), this shouldn't be a problem anymore since we won't need to build and embed v8 snapshots into these plugin binaries - we'll just cross compile from x86_64 macs and it will Just Work 3) For unsupported architectures, we could enable Rover's installer script to clone Rover and run cargo build (this would be a slow installation but maybe better than nothing) 4) We decide that x86_64 emulation is good enough and never build for aarch64-apple-darwin

EverlastingBugstopper commented 1 year ago

this is no longer blocked because circle has ARM machines we can run now. building for arm is not prioritized at the moment though.

EverlastingBugstopper commented 11 months ago

CircleCI is deprecating x86 machines, we need to

1) start producting aarch64-apple-darwin binaries 1) ensure those binaries work on Intel machines using Rosetta in the reverse direction 1) if it works, start downloading only aarch64-apple-darwin binaries regardless of architecture. installers should be version aware, i.e. before 2.5.5 download x86, after 2.5.5 download aarch64