M1 MacBook Pro에서 GCC 13을 빌드하는 방법은 무엇입니까?

M1 MacBook Pro에서 GCC 13을 빌드하는 방법은 무엇입니까?

내 M1 MacBook Pro에 gcc-13을 빌드하고 싶습니다. 다음과 같은공식 문서, git을 사용하여 소스 코드를 다운로드 configure한 다음 make.

configure저는 Homebrew gcc-12의 방법을 참고했습니다.configure협회. 구체적으로

../configure \
--prefix=/Users/xubaoyu/gcc/build \
--disable-nls \
--enable-checking=release \
--with-gcc-major-version-only \
--enable-languages=c,c++ \
--program-suffix=-13 \
--with-system-zlib \
--build=aarch64-apple-darwin22 \
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk

일반적인 말하기 make -j 10.

그런 다음 오류가 나타납니다.

*** Configuration aarch64-apple-darwin22 not supported
make[2]: *** [configure-stage1-gcc] Error 1
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

빌드 매개변수에 잘못된 값을 사용하고 있다고 생각하여 다음을 통해 gcc12를 확인했습니다 gcc-12 -v.

Using built-in specs.
COLLECT_GCC=gcc-12
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/12.2.0/bin/../libexec/gcc/aarch64-apple-darwin22/12/lto-wrapper
Target: aarch64-apple-darwin22
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-12 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 12.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin22 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Homebrew GCC 12.2.0)

제가 사용하고 있는 타겟과 동일합니다.

그런 다음 다시 시도합니다 make configure-stage1-gcc.

/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in tests
Making all in .
make[4]: Nothing to be done for `all-am'.
Making all in devel
make[4]: Nothing to be done for `all'.
Making all in mpn
make[4]: Nothing to be done for `all'.
Making all in mpz
make[4]: Nothing to be done for `all'.
Making all in mpq
make[4]: Nothing to be done for `all'.
Making all in mpf
make[4]: Nothing to be done for `all'.
Making all in rand
make[4]: Nothing to be done for `all'.
Making all in misc
make[4]: Nothing to be done for `all'.
Making all in cxx
make[4]: Nothing to be done for `all'.
Making all in mpn
make[3]: Nothing to be done for `all'.
Making all in mpz
make[3]: Nothing to be done for `all'.
Making all in mpq
make[3]: Nothing to be done for `all'.
Making all in mpf
make[3]: Nothing to be done for `all'.
Making all in printf
make[3]: Nothing to be done for `all'.
Making all in scanf
make[3]: Nothing to be done for `all'.
Making all in rand
make[3]: Nothing to be done for `all'.
Making all in cxx
make[3]: Nothing to be done for `all'.
Making all in demos
Making all in calc
/Library/Developer/CommandLineTools/usr/bin/make  all-am
make[5]: Nothing to be done for `all-am'.
Making all in expr
make[4]: Nothing to be done for `all'.
make[4]: Nothing to be done for `all-am'.
Making all in tune
make[3]: Nothing to be done for `all'.
Making all in doc
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in doc
make[2]: Nothing to be done for `all'.
Making all in src
/Library/Developer/CommandLineTools/usr/bin/make  all-am
make[3]: Nothing to be done for `all-am'.
Making all in tests
make[2]: Nothing to be done for `all'.
Making all in tune
make[2]: Nothing to be done for `all'.
Making all in tools/bench
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
make[3]: Nothing to be done for `all'.
Making all in tests
make[3]: Nothing to be done for `all'.
Making all in doc
make[3]: Nothing to be done for `all'.
Making all in tools
Making all in bench
make[4]: Nothing to be done for `all'.
Making all in mpcheck
make[4]: Nothing to be done for `all'.
make[4]: Nothing to be done for `all-am'.
make[3]: Nothing to be done for `all-am'.
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in .
make[3]: Nothing to be done for `all-am'.
Making all in doc
make[3]: Nothing to be done for `all'.
Configuring stage 1 in ./gcc
configure: loading cache ./config.cache
checking build system type... aarch64-apple-darwin22
checking host system type... aarch64-apple-darwin22
checking target system type... aarch64-apple-darwin22
checking LIBRARY_PATH variable... ok
checking GCC_EXEC_PREFIX variable... ok
checking whether to place generated files in the source directory... no
checking whether a default linker was specified... no
checking whether a default dsymutil was specified... no
checking whether a default assembler was specified... no
checking for aarch64-apple-darwin22-gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=c++11 accepts -g... yes
checking for aarch64-apple-darwin22-gnatbind... no
checking for gnatbind... no
checking for aarch64-apple-darwin22-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada and is recent enough... rm: conftest.dSYM: is a directory
no
checking for aarch64-apple-darwin22-gdc... no
checking whether the D compiler works... no
checking how to run the C++ preprocessor... g++ -std=c++11 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking how to run the C preprocessor... gcc -E
checking for inline... inline
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of ino_t... 8
checking size of dev_t... 4
checking size of void *... 8
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking for long long... yes
checking size of long long... 8
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking for intmax_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int64_t underlying type... long long
checking for std::swap in <utility>... yes
checking whether g++ -std=c++11 is affected by placement new aliasing bug... no
checking whether g++ -std=c++11 supports -W... yes
checking whether g++ -std=c++11 supports -Wall... yes
checking whether g++ -std=c++11 supports -Wnarrowing... yes
checking whether g++ -std=c++11 supports -Wwrite-strings... yes
checking whether g++ -std=c++11 supports -Wcast-qual... yes
checking whether g++ -std=c++11 supports -Wformat... yes
checking whether gcc supports -Wstrict-prototypes... yes
checking whether gcc supports -Wmissing-prototypes... yes
checking whether g++ -std=c++11 supports -Wmissing-format-attribute... yes
checking whether g++ -std=c++11 supports -Wconditionally-supported... yes
checking whether g++ -std=c++11 supports -Woverloaded-virtual... yes
checking whether gcc supports -Wold-style-definition... yes
checking whether gcc supports -Wc++-compat... yes
checking whether g++ -std=c++11 supports -pedantic -Wlong-long -Wvariadic-macros -Woverlength-strings... yes
checking whether gcc supports -fno-exceptions... yes
checking whether gcc supports -fno-rtti... yes
checking whether gcc supports -fasynchronous-unwind-tables... yes
checking valgrind.h usability... no
checking valgrind.h presence... no
checking for valgrind.h... no
checking for VALGRIND_DISCARD in <valgrind/memcheck.h>... no
checking for VALGRIND_DISCARD in <memcheck.h>... no
checking for multiarch configuration... auto
configure: WARNING: fixed-point is not supported for this target, ignored
checking whether make sets $(MAKE)... yes
checking for gawk... awk
checking whether ln -s works... yes
checking whether ln works... yes
checking for aarch64-apple-darwin22-ranlib... ranlib
checking for a BSD compatible install... /usr/bin/install -c
checking for cmp's capabilities... gnucompare
checking for mktemp... yes
checking for makeinfo... makeinfo
checking for modern makeinfo... yes
checking for recent Pod::Man... yes
checking for flex... flex
checking for bison... bison
checking for python3... python3
checking for modern python3... yes
checking for nm... nm
checking for ar... ar
checking for sphinx-build... texinfo
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking whether string.h and strings.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether termios.h defines TIOCGWINSZ... yes
checking for limits.h... yes
checking for stddef.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for time.h... yes
checking for iconv.h... yes
checking for fcntl.h... yes
checking for ftw.h... yes
checking for unistd.h... (cached) yes
checking for sys/auxv.h... no
checking for sys/file.h... yes
checking for sys/time.h... yes
checking for sys/mman.h... yes
checking for sys/resource.h... yes
checking for sys/param.h... yes
checking for sys/times.h... yes
checking for sys/stat.h... (cached) yes
checking for sys/locking.h... no
checking for direct.h... no
checking for malloc.h... no
checking for langinfo.h... yes
checking for ldfcn.h... no
checking for locale.h... yes
checking for wchar.h... yes
checking for thread.h... no
checking for pthread.h... yes
checking for CHAR_BIT... yes
checking whether byte ordering is bigendian... no
checking how to run the C++ preprocessor... g++ -std=c++11 -E
checking for unordered_map... yes
checking for tr1/unordered_map... yes
checking for ext/hash_map... yes
checking dependency style of g++ -std=c++11... gcc3
checking for collect2 libraries... none required
checking for library containing exc_resume... no
checking for library containing kstat_open... no
checking for library containing gethostbyname... none required
checking for library containing socket... none required
checking for library containing ldexp... none required
checking for library containing dlopen... none required
checking for inttypes.h... yes
checking for zstd.h... no
checking for library containing ZSTD_compress... no
checking for times... yes
checking for clock... yes
checking for kill... yes
checking for getrlimit... yes
checking for setrlimit... yes
checking for atoq... no
checking for popen... yes
checking for sysconf... yes
checking for strsignal... yes
checking for getrusage... yes
checking for nl_langinfo... yes
checking for gettimeofday... yes
checking for mbstowcs... yes
checking for wcswidth... yes
checking for mmap... yes
checking for posix_fallocate... no
checking for setlocale... yes
checking for clearerr_unlocked... yes
checking for feof_unlocked... yes
checking for ferror_unlocked... yes
checking for fflush_unlocked... no
checking for fgetc_unlocked... no
checking for fgets_unlocked... no
checking for fileno_unlocked... yes
checking for fprintf_unlocked... no
checking for fputc_unlocked... no
checking for fputs_unlocked... no
checking for fread_unlocked... no
checking for fwrite_unlocked... no
checking for getchar_unlocked... yes
checking for getc_unlocked... yes
checking for putchar_unlocked... yes
checking for putc_unlocked... yes
checking for madvise... yes
checking for mallinfo... no
checking for mallinfo2... no
checking for fstatat... yes
checking for getauxval... no
checking whether mbstowcs works... yes
checking for ssize_t... yes
checking for caddr_t... yes
checking for sighander_t... no
checking for sys/mman.h... (cached) yes
checking for mmap... (cached) yes
checking whether read-only mmap of a plain file works... yes
checking whether mmap from /dev/zero works... no
checking for MAP_ANON(YMOUS)... yes
checking whether mmap with MAP_ANON(YMOUS) works... yes
checking for pid_t... yes
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for ld used by GCC... ld
checking if the linker (ld) is GNU ld... no
checking for shared library run path origin... done
checking for iconv... yes
checking how to link with libiconv... -liconv
checking for iconv declaration...
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for LC_MESSAGES... yes
checking for nl_langinfo and CODESET... yes
checking whether basename is declared... no
checking whether strstr is declared... yes
checking whether getenv is declared... yes
checking whether atol is declared... yes
checking whether atoll is declared... yes
checking whether asprintf is declared... yes
checking whether sbrk is declared... yes
checking whether abort is declared... yes
checking whether atof is declared... yes
checking whether getcwd is declared... yes
checking whether getwd is declared... yes
checking whether madvise is declared... yes
checking whether stpcpy is declared... yes
checking whether strnlen is declared... yes
checking whether strsignal is declared... yes
checking whether strverscmp is declared... no
checking whether strtol is declared... yes
checking whether strtoul is declared... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking whether setenv is declared... yes
checking whether unsetenv is declared... yes
checking whether errno is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking whether vasprintf is declared... yes
checking whether malloc is declared... yes
checking whether realloc is declared... yes
checking whether calloc is declared... yes
checking whether free is declared... yes
checking whether getopt is declared... yes
checking whether clock is declared... yes
checking whether getpagesize is declared... yes
checking whether ffs is declared... yes
checking whether clearerr_unlocked is declared... yes
checking whether feof_unlocked is declared... yes
checking whether ferror_unlocked is declared... yes
checking whether fflush_unlocked is declared... no
checking whether fgetc_unlocked is declared... no
checking whether fgets_unlocked is declared... no
checking whether fileno_unlocked is declared... yes
checking whether fprintf_unlocked is declared... no
checking whether fputc_unlocked is declared... no
checking whether fputs_unlocked is declared... no
checking whether fread_unlocked is declared... no
checking whether fwrite_unlocked is declared... no
checking whether getchar_unlocked is declared... yes
checking whether getc_unlocked is declared... yes
checking whether putchar_unlocked is declared... yes
checking whether putc_unlocked is declared... yes
checking whether getrlimit is declared... yes
checking whether setrlimit is declared... yes
checking whether getrusage is declared... yes
checking whether mallinfo is declared... no
checking whether mallinfo2 is declared... no
checking whether ldgetname is declared... no
checking whether times is declared... yes
checking whether sigaltstack is declared... yes
checking for struct tms... yes
checking for clock_t... yes
checking for F_SETLKW... yes
checking for O_CLOEXEC... yes
checking for fcntl.h... (cached) yes
checking whether O_NONBLOCK is declared... yes
checking for AF_UNIX... yes
checking for AF_INET6... yes
checking for _LK_LOCK... no
checking if mkdir takes one argument... no
*** Configuration aarch64-apple-darwin22 not supported
make: *** [configure-stage1-gcc] Error 1

이 과정에서 어떤 문제가 발생했으며 어떻게 해결하나요? 미리 감사드립니다!

답변1

친절한 남자GCC 메일링 리스트이 문제를 해결했습니다!

조나단 웨이클리<[email protected]>

내 생각에는 Homebrew가 GCC 패치 버전을 사용하는 것 같습니다. M1 지원에 대한 변경 사항이 업스트림 GCC에서 아직 이루어지지 않았기 때문입니다. 따라서 Homebrew 빌드에 사용되는 동일한 구성이 패치되지 않은 업스트림 소스에서 반드시 작동하는 것은 아닙니다.

이안 샌도우<[email protected]>

Jonathan이 말했듯이 macOS에 대한 M1(Arm64/aarch64) 지원은 아직 제공되지 않습니다. 프로토타입/실험 브랜치는 여기에 있습니다:https://github.com/iains/gcc-darwin-arm64 나는 때때로 이것을 다시 작업할 것입니다(다음 주 정도에 업데이트가 있을 것입니다). 발생할 수 있으니 참고하세요https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107568macOS13 SDK 사용 - 해결 방법은 다음과 같습니다. make BOOT_CFLAGS="-O2 -g -Wno-error=deprecated-declarations"(-jXX 및 사용하는 다른 플래그는 변경되지 않은 상태로 유지됩니다.)

Iain의 저장소와 NOTE를 사용하여 M1 MacBook에서 gcc-13을 성공적으로 구축할 수 있습니다.

관련 정보