[MacPorts] UsingTheRightCompiler modified

MacPorts noreply at macports.org
Wed Sep 18 22:03:22 PDT 2013


Page "UsingTheRightCompiler" was changed by ryandesign at macports.org
Diff URL: <https://trac.macports.org/wiki/UsingTheRightCompiler?action=diff&version=27>
Revision 27
Comment: edit default-compiler section
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: UsingTheRightCompiler
=========================================================================
--- UsingTheRightCompiler (version: 26)
+++ UsingTheRightCompiler (version: 27)
@@ -14,39 +14,27 @@
 
 == The problem with the default compiler == #default-compiler
 
-The default version of gcc can be run simply as "`gcc`".
-There's also "`cc`" which points to the default compiler (which might not necessarily be gcc).
-The default gcc can be changed using the "`port select`" mechanism.
-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.
-
-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 port select mechanism 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,
-and "`cc`" varies by Xcode version as well.
+If not instructed otherwise, most software builds C code using "`cc`" or "`gcc`".
+But "`/usr/bin/cc`" and "`/usr/bin/gcc`" are not specific compilers; they're symlinks to some suitable default compiler, but it varies based on Xcode version.
+Users might also have created a "`/opt/local/bin/gcc`" symlink, pointing to any installed compiler, by using "`port select --set gcc`".
+So we cannot rely on "`cc`" oc "`gcc`" being any particular compiler.
 
 Most port authors will not have used "`port select --set gcc $value`"
 and will therefore have the usual default version of gcc on their machine,
 and will not have tested to see what happens if a different gcc is selected.
 To remove this testing burden from maintainers,
 and to prevent users from running into unanticipated problems,
-MacPorts arranges for ports to always compile using the correct default version for the current operating system,
-and does not use the unpredictable "`gcc`".
+MacPorts arranges for ports to compile by default using the same compiler that the installed version of Xcode would use,
+and does not use the unpredictable "`cc`" or "`gcc`" symlinks.
 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 OS X 10.8, CC is set to the value "`/usr/bin/clang`"
+For example, with Xcode 4.2 and later, CC is set to "`/usr/bin/clang`"
 so that there is no ambiguity.
 
 In fact there are more variables than just CC:
 there's also CXX for the C++ compiler and CPP for the C pre-processor.
 During the configure phase,
-MacPorts sets each of these variables to the right value for the user's OS.
+MacPorts sets each of these variables to the right value for the user's Xcode version.
 It does this through the use of a number of similarly-named Tcl variables:
 ${configure.cc}, ${configure.cxx} and ${configure.cpp}.
 
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/UsingTheRightCompiler>
MacPorts <http://www.macports.org/>
Ports system for OS X

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 mailing list