Changes between Version 16 and Version 17 of UsingTheRightCompiler


Ignore:
Timestamp:
Feb 19, 2013, 1:52:31 AM (11 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

rewrite some paragraphs

Legend:

Unmodified
Added
Removed
Modified
  • UsingTheRightCompiler

    v16 v17  
    11= Introduction = #introduction
    22
    3 Most software is built using a C compiler called gcc,
    4 and the various versions of Xcode for Mac OS X come with different versions of gcc.
    5 For example, with Xcode 2.5 on Mac OS X 10.4, gcc 3.3 and 4.0 are available, with 4.0 being the default.
    6 With Xcode 3.1 on Mac OS X 10.5, gcc 4.2 is also available;
    7 with Xcode 3.2 on Mac OS X 10.6, gcc 4.2 is the default compiler.
     3Much of the software in MacPorts is built using a C or C++ compiler,
     4and the various versions of Xcode for OS X come with different compiler suites and versions.
     5With Xcode 2.5 on OS X 10.4, gcc 3.3 and 4.0 are available, with 4.0 being the default.
     6With Xcode 3.1 on OS X 10.5, gcc 4.2 is also available.
     7With Xcode 3.2 on OS X 10.6, llvm-gcc-4.2 and clang are also available; gcc 4.2 is the default.
     8With Xcode 4.0 and 4.1 on OS X 10.6 or 10.7, llvm-gcc-4.2 is the default.
     9With Xcode 4.2 or later, clang is the default and gcc is no longer included.
     10The Xcode 4.6 release notes state that it is the last version of Xcode that will include llvm-gcc-4.2, which will leave only clang.
    811
    912
     
    1114
    1215The default version of gcc can be run simply as "`gcc`".
    13 But this default can be changed using the "`gcc_select`" command.
     16There's also "`cc`" which points to the default compiler (which might not necessarily be gcc).
     17The default gcc can be changed using the "`gcc_select`" command.
    1418Some users may have used this command to change their default gcc,
    1519for example on Leopard to test new functionality in gcc 4.2,
    1620or on Tiger to downgrade to gcc 3.3 to compile old software that is not compatible with gcc 4.
    1721
    18 Software by default builds using "`gcc`" (or, equivalently, "`cc`") and this can be a problem if the user has changed what this is.
    19 On the one hand, gcc 4 may be too new to compile some very old software,
     22If not instructed otherwise, software builds using "`gcc`" or "`cc`" and this can be a problem if the user has changed what this is.
     23For example, on the one hand, gcc 4 may be too new to compile some very old software,
    2024but on the other hand gcc 3.3 is probably too old to compile a lot of modern software.
    2125The problem is further complicated by the various gcc ports which can be installed using MacPorts,
     
    2327For example, only the Apple versions can create universal binaries in a single step.
    2428The gcc_select port can be used to make any of them the default compiler.
    25 So we cannot rely on "`gcc`" being any particular version of gcc with any particular capabilities.
     29So we cannot rely on "`gcc`" being any particular version of gcc with any particular capabilities,
     30and "`cc`" varies by Xcode version as well.
    2631
    2732Most port authors will not have used "`gcc_select`"
     
    3439It does this by specifying the desired compiler's complete path in the CC environment variable
    3540during the port's configure phase.
    36 For example, on Mac OS X 10.4 and 10.5, CC is set to the value "`/usr/bin/gcc-4.0`"
     41For example, on OS X 10.4 and 10.5, CC is set to the value "`/usr/bin/gcc-4.0`"
    3742so that there is no ambiguity.
    3843