Re:Intel seems awfully scared of Graviton2. Why pay for this...
by liftm on Monday December 13, 2021 @04:03AM
(#29537964)
It remains that easy until your Go/Rust project relies on libraries written in other languages, say C.
(This holds true for JS/python/… too.)
Re:Intel seems awfully scared of Graviton2. Why pay for this...
by cure on Monday December 13, 2021 @09:34AM
(#29539912)
Right. But even then it does not become that much worse.
Just tell Go to use the appropriate cross compilation chain for the C bits, e.g. `apt install gcc-aarch64-linux-gnu` and set the `CC=aarch64-linux-gnu-gcc` environment variable to compile for arm64. Compilation becomes a bit slower, but it's still manageable.
It's that easy thanks to the foundations laid by the distribution that ships a solid cross-compiler setup (in this example, thank you Debian!) and of course the brilliance of the Go design and toolchain.
Re:Intel seems awfully scared of Graviton2. Why pay for this...
by creamytaco on Monday December 13, 2021 @04:28AM
(#29538105)
Relying on libraries written in C is not an issue if the library doesn't make assumptions about / isn't tied to, a particular architecture. Some do but most (especially newer codebases written to C11 and beyond) don't.
Re:Intel seems awfully scared of Graviton2. Why pay for this...
by ajdlinux on Monday December 13, 2021 @08:13AM
(#29539250)
There's also the issue of performance-optimised assembly routines, which impacts many native libraries doing things such as crypto, image processing, etc.
Re:Intel seems awfully scared of Graviton2. Why pay for this...
by blihp on Monday December 13, 2021 @04:03AM
(#29537966)
The issue is that someone has to initially write the code to emit the native assembly/machine code for each architecture that a given compiler supports. (i.e. assuming it actually emits native code and not code for another compiled language like C/C++) The flag simply means that someone has already done that work for a particular language on a particular architecture.
I think Go needs a flag specified at compile time to work on ARM. Instead of `go build`, run `env GOOS=linux GOARCH=arm64 go build`.
Rust is similar, except it requires the appropriate toolchain to be installed first (1-liner).
It’s probably less effort what I’ve described because there are GitHub Actions that will generate appropriate binaries out of the box.