homebrew-i386-elf-toolchain
homebrew-i386-elf-toolchain copied to clipboard
Failed to brew install i386-elf-gcc on M1 Mac
I just tried to install the i386-elf-toolchain. Installing binutils seemed to proceed normally, however I ran into a link failure when trying to install i386-elf-gcc
I'm running this on a Mac M1 and just installed XCode 13.2.1 This is what I did and got.
-> % brew install nativeos/i386-elf-toolchain/i386-elf-gcc
==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/manifests/1.2.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/blobs/sha256:658a1d260b6
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz
######################################################################## 100.0%
==> Installing i386-elf-gcc from nativeos/i386-elf-toolchain
==> Installing dependencies for nativeos/i386-elf-toolchain/i386-elf-gcc: libmpc
==> Installing nativeos/i386-elf-toolchain/i386-elf-gcc dependency: libmpc
==> Pouring libmpc--1.2.1.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/libmpc/1.2.1: 12 files, 415.7KB
==> Installing nativeos/i386-elf-toolchain/i386-elf-gcc
==> ../configure --prefix=/opt/homebrew/Cellar/i386-elf-gcc/11.2.0_1 --target=i3
==> make all-gcc
Last 15 lines from /Users/kartikaiyer/Library/Logs/Homebrew/i386-elf-gcc/02.make:
gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o)
gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o)
gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o)
gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o)
toplev::main(int, char**) in libbackend.a(toplev.o)
toplev::main(int, char**) in libbackend.a(toplev.o)
ld: symbol(s) not found for architecture arm64
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [lto-dump] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [lto1] Error 1
rm gcc.pod
make: *** [all-gcc] Error 2
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/nativeos/homebrew-i386-elf-toolchain/issues
Ye, GCC 11.x is still not compatible natively with the Apple M1, you have to use Rosetta and an amd64 version of Homebrew. Maybe this is useful: https://github.com/nativeos/homebrew-i386-elf-toolchain/issues/10#issuecomment-1030810217. Sorry, I should update the README to note this, because I do not know when GCC 12 is going to be released...
GCC 12 still has issues.
gcc build command:
curl -O https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
tar xf gcc-12.2.0.tar.gz
mkdir gcc-build
cd gcc-build
../gcc-12.2.0/configure --target=$TARGET \
--prefix="$PREFIX" \
--disable-nls \
--disable-libssp \
--enable-languages=c \
--without-headers \
--with-gmp=/opt/homebrew/Cellar/gmp/6.2.1_1 \
--with-mpfr=/opt/homebrew/Cellar/mpfr/4.1.0 \
--with-mpc=/opt/homebrew/Cellar/libmpc/1.2.1
Error:
checking for AF_INET6... yes
checking for _LK_LOCK... no
checking if mkdir takes one argument... no
*** Configuration aarch64-apple-darwin21.3.0 not supported
make: *** [configure-gcc] Error 1
GCC 12 still has issues.
Sad to hear.
I don't have an M1 anymore since I left my previous job so I'd suggest to continue using the Rosetta-based version at the moment or use clang (which is what I do nowadays anyway, although I like to maintain this repository to help the community).
Please, Tim Cook, just announce an M2-powered Mac Mini 😆
Guess who owns a Mac Mini M2 now.
I have solved this problem by installed it by mac port
And I think the problem is because the conflict version of gcc.11, and port can install gcc.12, and it works
And I think the problem is because the conflict version of gcc.11, and port can install gcc.12, and it works
You are right. I have solved this! thanks
I tested it successfully with GCC 12.2 (matching the version in Ports)
See #24