Building GCC on Macintosh

19 Nov 2018

iMac: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
macOS 10.14.1, Xcode 10.1.0.
Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0

gcc-7-20181115:
C, C++, Fortran bootstrap built successfully.
Prebuild: 75,779 files, 670,680 KB.
Postbuild: 100,958 files, 5,554,352 KB.
31 minutes 3 seconds.

gcc-8-20181116:
C, C++, Fortran bootstrap built successfully.
Prebuild: 80,817 files, 708,624 KB.
Postbuild: 107,123 files, 5,907,912 KB.
36 minutes, 6 seconds.

gcc-9-20181118:
C, C++, Fortran bootstrap built successfully.
Prebuild: 86,466 files, 762,420 KB.
Postbuild: 113,472 files, 6,102,376 KB.
41 minutes, 33 seconds.


23 Oct 2018

iMac: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
macOS 10.14.0, Xcode 10.0.0.
Apple LLVM version 10.0.0 (clang-1000.11.45.2) Target: x86_64-apple-darwin18.0.0

gcc-7-20181018:
C, C++, Fortran bootstrap built successfully.
Prebuild: 75,764 files, 670,600 KB.
Postbuild: 100,949 files, 5,632,960 KB.
31 minutes 25 seconds.

gcc-8-20181019:
C, C++, Fortran bootstrap built successfully.
Prebuild: 80,783 files, 708,472 KB.
Postbuild: 107,089 files, 5,921,120 KB.
36 minutes, 26 seconds.

gcc-9-20181021:
C, C++, Fortran bootstrap built successfully.
Prebuild: 82,634 files, 721,168 KB.
Postbuild: 109,113 files, 6,044,812 KB.
40 minutes, 39 seconds.


10 Oct 2018

iMac: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
macOS 10.14.0, Xcode 10.0.0. - First GCC builds on Mojave!
Apple LLVM version 10.0.0 (clang-1000.11.45.2) Target: x86_64-apple-darwin18.0.0
du -s used for file sizes, files|wc used for number of files.

gcc-7-20181004:
C, C++, Fortran bootstrap built successfully.
Prebuild: 75,726 files, 670,412 KB.
Postbuild: 100,911 files, 5,628,292 KB.
31 minutes 14 seconds.

gcc-8-20181005:
C, C++, Fortran bootstrap built successfully.
Prebuild: 80,736 files, 708,252 KB.
Postbuild: 107,042 files, 5,914,820 KB.
37 minutes 49 seconds.

gcc-9-20181007:
C, C++, Fortran bootstrap built successfully.
Prebuild: 82,377 files, 719,668 KB.
Postbuild: 108,799 files, 6,036,972 KB.
41 minutes 49 seconds.


18 Sep 2018

iMac: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
macOS 10.13.6, Xcode 10.0.0.
Apple LLVM version 10.0.0 (clang-1000.11.45.2) Target: x86_64-apple-darwin17.7.0

gcc-7-20180913:
C, C++, Fortran bootstrap built successfully.
Prebuild: 75,723 files, 946,752 KB.
Postbuild: 100,908 files, 5,692,408 KB.
31 minutes 33 seconds.

gcc-8-20180914:
C, C++, Fortran bootstrap built successfully.
Prebuild: 80,720 files, 1,003,232 KB.
Postbuild: 107,026 files, 6,071,400 KB.
36 minutes 44 seconds.

gcc-9-20180916:
C, C++, Fortran bootstrap built successfully.
Prebuild: 81,713 files, 1,013,704 KB.
Postbuild: 108,129 files, 6,132,856 KB.
40 minutes 54 seconds.


28 Aug 2018

Using Xcode 9.4.1CL.
gcc-7-20180823:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 453,124,658 bytes (969.4 MB on disk) for 79,875 items
Postbuild: 5,155,097,977 bytes (5.82 GB on disk) for 99,510 items
31 minutes 45 seconds.

gcc-8-20180824:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 476,030,382 bytes (1.03 GB on disk) for 85,082 items
Postbuild: 5,500,092,261 bytes (6.21 GB on disk) for 105,520 items
37 minutes 40 seconds.

gcc-9-20180826:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 479,923,618 bytes (1.04 GB on disk) for 85,990 items
Postbuild: 5,446,320,260 bytes (6.16 GB on disk) for 106,520 items
42 minutes 26 seconds.


26 Jul 2018

Using Xcode 9.4.1CL.
gcc-7-20180719:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 453,081,740 bytes (969.3 MB on disk) for 79,863 items
Postbuild: 5,154,953,534 bytes (5.82 GB on disk) for 99,492 items
32 minutes 44 seconds.

gcc-8-20180719:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 498,073,217 bytes (1.05 GB on disk) for 85,126 items
Postbuild: 5,487,929,155 bytes (6.19 GB on disk) for 105,408 items
40 minutes 28 seconds.

gcc-9-20180722:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 478,208,672 bytes (1.03 GB on disk) for 85,611 items
Postbuild: 5,445,409,973 bytes (6.16 GB on disk) for 106,074 items
42 minutes 24 seconds.


9 Jul 2018

Using Xcode 9.4.1CL.
gcc-7-20180705:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 453,073,906 bytes (969.3 MB on disk) for 79,856 items
Postbuild: 5,154,942,816 bytes (5.82 GB on disk) for 99,485 items
31 minutes 20 seconds.

gcc-8-20180706:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 475,829,721 bytes (1.03 GB on disk) for 85,005 items
Postbuild: 5,498,337,470 bytes (6.21 GB on disk) for 105,437 items
36 minutes 1 second.

gcc-9-20180708:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 477,677,352 bytes (1.03 GB on disk) for 85,421 items
Postbuild: 5,433,179,464 bytes (6.14 GB on disk) for 105,875 items
46 minutes 35 seconds.


30 Jun 2018

Using Xcode 9.4.1CL.
gcc-7-20180628:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 453,060,790 bytes (969.2 MB on disk) for 79,851 items
Postbuild: 5,152,081,395 bytes (5.82 GB on disk) for 99,480 items
31 minutes 0 seconds.

gcc-8-20180622:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 475,765,893 bytes (1.03 GB on disk) for 84,984 items
Postbuild: 5,496,725,657 bytes (6.2 GB on disk) for 105,416 items
36 minutes 13 seconds.

gcc-9-20180624:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
Prebuild: 477,144,287 bytes (1.03 GB on disk) for 85,213 items
Postbuild: 5,432,772,081 bytes (6.14 GB on disk) for 105,658 items
39 minutes 49 seconds.


22 Jun 2018

Using Xcode 9.4.1CL.
gcc-7-20180614:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
33 minutes 10 seconds.

gcc-8-20180615:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
38 minutes 11 seconds.

gcc-9-20180617:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
39 minutes 38 seconds.


9 Jun 2018

gcc-9-20180603:
C, C++, Fortran bootstrap built successfully once again! (Mid May snapshots would not build with clang.)
C31 2013.12: 3.1GHz i7, 8MB L3, 16GB 1600MHz, 1.1TB Fusion, GT750M 1GB, 1920x1080, G+802.11ac.
48 minutes 44 seconds, 5.5 GB, 105687 files.


7 Jun 2018

gcc-8-20180601:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
36 minutes 7 seconds, 5.50 GB, 105286 files.
gcc-7-20180531:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
38 minutes 26 seconds, 5.15 GB, 99362 files.


25 May 2018

gcc-8-20180518:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
40 minutes 10 seconds, 5.49 GB, 105247 files.

gcc-7-20180517:
C, C++, Fortran bootstrap built successfully.
C31 2013.12: 3.1GHz i7, 8MB L3, 16GB 1600MHz, 1.1TB Fusion, GT750M 1GB, 1920x1080, G+802.11ac.
34 minutes 3 seconds, 5.15 GB, 99352 files.


9 May 2018

gcc-9-20180506:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
41 minutes 11 seconds, 5.49 GB, 105253 files.


2 May 2018

gcc-8-20180427:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
36 minutes 54 seconds, 5.49 GB, 105022 files.

gcc-7-20180426:
C, C++, Fortran bootstrap built successfully.
C31 2013.12: 3.1GHz i7, 8MB L3, 16GB 1600MHz, 1.1TB Fusion, GT750M 1GB, 1920x1080, G+802.11ac.
37 minutes 15 seconds, 5.15 GB, 99325 files.


19 Apr 2018

gcc-8-20180415:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
36 minutes 39 seconds, 5.49 GB, 105136 files.

gcc-7-20180412:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
31 minutes 6 seconds, 5.15 GB, 99305 files.


10 Apr 2018

gcc-8-20180408:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
36 minutes 48 seconds, 5.49 GB, 105072 files.

https://twitter.com/danallen46/status/983792188277440513


6 Apr 2018

gcc-8-20180401:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
38 minutes 47 seconds, 5.49 GB, 104983 files.


31 Mar 2018

gcc-8-20180325:
C, C++, Fortran bootstrap built successfully.
C40 2017.04: 4.0GHz i7 QC, 8MB L3, 16GB 1866MHz, 3.1TB Fusion, M395+2GB, 5120x2880, G+802.11ac.
37 minutes 26 seconds, 5.49 GB, 104928 files.

gcc-7-20180329:
C, C++, Fortran bootstrap built successfully.
C31 2013.12: 3.1GHz i7, 8MB L3, 16GB 1600MHz, 1.1TB Fusion, GT750M 1GB, 1920x1080, G+802.11ac.
36 minutes 34 seconds, 5.15 GB, 99274 files.


21 Mar 2018

I built gcc-8-20180318 today on my iMac 27" (4.0 GHz i7, 16 GB RAM, 3 TB Fusion). I used macOS 10.13.3 and the Xcode 9.2 command line toolset (Apple clang-900.39.2). It took 37 minutes 48 seconds to do a triple bootstrap build of C, C++, and Fortran. It resulted in 104,835 files using 5.78 GB of drive space.


19 Mar 2018

I built the latest snapshots of gcc-7 and gcc-8 today. I used macOS 10.13.3 and the Xcode 9.2 command line tools.
gcc-7-20180315 built fine in 37m 9s on a 3.1GHz i7 iMac.
gcc-8-20180311 built fine in 36m 15s on a 4.0GHz i7 iMac.

https://twitter.com/danallen46/status/975775233507442689


8 Mar 2018

I bootstrap built gcc-8-20180304 (C, C++, Fortran) ok in 36m 57s.
104,658 files used 5.49 GB for the build.
iMac 27", 4.0 GHz i7, 16 GB RAM, 3 TB Fusion, macOS 10.13.3, Xcode 9.2.

https://twitter.com/danallen46/status/971819963743813632


11 Aug 2016

Update: I built gcc-6.1 using Xcode 7.3.1's command-line tools and did not have to make this fix. gcc-6.1 bootstrapped itself perfectly without any issues.


4 Jun 2016

Fix for building gcc-4.8.5 using Xcode 7

Building gcc-4.8.5 with Apple's Xcode 7 on the Mac will not complete due to a bug in gcc code generating some assembly language that Xcode 7 will not allow, while earlier versions of Xcode worked. If you are using an earlier Xcode before El Capitan 10.11, this fix is therefore not needed.

So to fix this problem, in the source file:


  gcc-4.8.5/gcc/config/darwin.c

there is the darwin_mark_decl_preserved function. All you need to do is to add one line of code to the start of the function. The fixed function in its entirety is shown below, with the change noted by my DKA comment.

void
darwin_mark_decl_preserved (const char *name)
{
  if (darwin_label_is_anonymous_local_objc_name (name)) return; /* DKA 4 Jun 2016 */
  fprintf (asm_out_file, "\t.no_dead_strip ");
  assemble_name (asm_out_file, name);
  fputc ('\n', asm_out_file);
}

You should be able to do a

  ./configure
  make -j8
and a while later have a working C, C++, and Fortran compiler. I have personally built gcc-4.8.5 using Xcode 7.3.1 successfully once I made this fix.

I did not invent the fix. I found the fix here:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66523
 Created:  4 Jun 2016
Modified: 19 Nov 2018