[MacPorts] UsingTheRightCompiler modified
noreply at macports.org
Mon Feb 18 17:52:32 PST 2013
Page "UsingTheRightCompiler" was changed by ryandesign at macports.org
Diff URL: <https://trac.macports.org/wiki/UsingTheRightCompiler?action=diff&version=17>
Comment: rewrite some paragraphs
--- UsingTheRightCompiler (version: 16)
+++ UsingTheRightCompiler (version: 17)
@@ -1,28 +1,33 @@
= Introduction = #introduction
-Most software is built using a C compiler called gcc,
-and the various versions of Xcode for Mac OS X come with different versions of gcc.
-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.
-With Xcode 3.1 on Mac OS X 10.5, gcc 4.2 is also available;
-with Xcode 3.2 on Mac OS X 10.6, gcc 4.2 is the default compiler.
+Much of the software in MacPorts is built using a C or C++ compiler,
+and the various versions of Xcode for OS X come with different compiler suites and versions.
+With Xcode 2.5 on OS X 10.4, gcc 3.3 and 4.0 are available, with 4.0 being the default.
+With Xcode 3.1 on OS X 10.5, gcc 4.2 is also available.
+With Xcode 3.2 on OS X 10.6, llvm-gcc-4.2 and clang are also available; gcc 4.2 is the default.
+With Xcode 4.0 and 4.1 on OS X 10.6 or 10.7, llvm-gcc-4.2 is the default.
+With Xcode 4.2 or later, clang is the default and gcc is no longer included.
+The 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.
= The problem with the default compiler = #default-compiler
The default version of gcc can be run simply as "`gcc`".
-But this default can be changed using the "`gcc_select`" command.
+There's also "`cc`" which points to the default compiler (which might not necessarily be gcc).
+The default gcc can be changed using the "`gcc_select`" command.
Some users may have used this command to change their default gcc,
for example on Leopard to test new functionality in gcc 4.2,
or on Tiger to downgrade to gcc 3.3 to compile old software that is not compatible with gcc 4.
-Software by default builds using "`gcc`" (or, equivalently, "`cc`") and this can be a problem if the user has changed what this is.
-On the one hand, gcc 4 may be too new to compile some very old software,
+If not instructed otherwise, software builds using "`gcc`" or "`cc`" and this can be a problem if the user has changed what this is.
+For example, on the one hand, gcc 4 may be too new to compile some very old software,
but on the other hand gcc 3.3 is probably too old to compile a lot of modern software.
The problem is further complicated by the various gcc ports which can be installed using MacPorts,
which have different capabilities than the Apple versions of gcc.
For example, only the Apple versions can create universal binaries in a single step.
The gcc_select port can be used to make any of them the default compiler.
-So we cannot rely on "`gcc`" being any particular version of gcc with any particular capabilities.
+So we cannot rely on "`gcc`" being any particular version of gcc with any particular capabilities,
+and "`cc`" varies by Xcode version as well.
Most port authors will not have used "`gcc_select`"
and will therefore have the usual default version of gcc on their machine,
@@ -33,7 +38,7 @@
and does not use the unpredictable "`gcc`".
It does this by specifying the desired compiler's complete path in the CC environment variable
during the port's configure phase.
-For example, on Mac OS X 10.4 and 10.5, CC is set to the value "`/usr/bin/gcc-4.0`"
+For example, on OS X 10.4 and 10.5, CC is set to the value "`/usr/bin/gcc-4.0`"
so that there is no ambiguity.
In fact there are more variables than just CC:
Page URL: <https://trac.macports.org/wiki/UsingTheRightCompiler>
Ports system for Mac OS
This is an automated message. Someone added your email address to be
notified of changes on 'UsingTheRightCompiler' page.
If it was not you, please report to .
More information about the macports-changes