GCC cross-compilation from M1 to Intel for macOS #2499
-
On x86-64 I've used to use Homebrew's Homebrew docs say for cross-compilation there's
but I can't even compile a "hello world":
and the "elf" part of the name makes me suspect it's not even for macOS mach-O executables. It doesn't support
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you need to compile for Intel on M1, use Clang. If you need to use GCC specifically, you might be able to build your own cross-compiler, but that's not something Homebrew provides. Using a Rosetta installation of Homebrew to install an Intel GCC will probably work too. |
Beta Was this translation helpful? Give feedback.
x86_64-elf-gcc
compiles ELF executables. macOS uses Mach-O, not ELF.If you need to compile for Intel on M1, use Clang. If you need to use GCC specifically, you might be able to build your own cross-compiler, but that's not something Homebrew provides.
Using a Rosetta installation of Homebrew to install an Intel GCC will probably work too.