Changed page "UsingTheRightCompiler" by ryandesign@macports.org from 70.253.87.255* Page URL: <http://trac.macports.org/wiki/UsingTheRightCompiler> Diff URL: <http://trac.macports.org/wiki/UsingTheRightCompiler?action=diff&version=8> Revision 8 Comment: refinements -------8<------8<------8<------8<------8<------8<------8<------8<-------- Index: UsingTheRightCompiler ========================================================================= --- UsingTheRightCompiler (version: 7) +++ UsingTheRightCompiler (version: 8) @@ -15,7 +15,7 @@ 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`" and this can be a problem if the user has changed what "`gcc`" is. +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, 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, @@ -50,9 +50,9 @@ the default compiler chosen by MacPorts is the one that should be used, unless that compiler doesn't work with that port for some reason. In that case, -you can select a different compiler for that port by overwriting ${configure.cc} and friends, +the maintainer can select a different compiler for that port by overwriting ${configure.cc} and friends, but what you probably want to do instead is overwrite the ${configure.compiler} variable, -which sets everything for you as a group. +which sets all the related variables for you simultaneously. MacPorts knows about a handful of compilers: * gcc @@ -77,10 +77,9 @@ So do those whose names begin with "apple" (e.g. "apple-gcc-4.0" corresponds to the apple-gcc40 port). The remaining compiler names refer to compilers installed by Xcode -(e.g. "gcc-4.0" is the gcc 4.0.1 compiler installed by Xcode -which is the default compiler on Mac OS X 10.4 and 10.5). +(e.g. "gcc-4.0" is the gcc 4.0.1 compiler installed by Xcode). Note that if you set ${configure.compiler} to a compiler provided by a MacPorts port, -you must also declare a build dependency on that port. +you must also declare a library dependency on that port. For the MacPorts gcc 4 compilers, additional environment variables FC, F77 and F90 are set to the path of the Fortran compiler. @@ -99,12 +98,12 @@ Setting the CC, CXX and CPP environment variables at configure time is all that most software needs in order to use the compiler we want. -But some ports have unusual configure scripts that don't obey these settings. -Some ports don't have a configure phase at all. +But some ports have unusual configure scripts that don't obey these settings, +and some ports don't have a configure script at all. For such ports, it can be necessary to set the variables at build time: {{{ -build.env-append CC=${configure.cc} \ +build.args-append CC=${configure.cc} \ CXX=${configure.cxx} \ CPP=${configure.cpp} }}} @@ -112,7 +111,7 @@ Some ports' Makefiles do not use the CC variable and always try to run "`gcc`" or "`cc`". In these cases, patches are needed. For example, "`gcc`" or "`cc`" can be replaced with "$(CC)" in the Makefile, -possibly in combination with setting ${build.env} as above. +possibly in combination with setting ${build.args} as above. Such patches should usually be sent upstream for inclusion in the next version of the software. -------8<------8<------8<------8<------8<------8<------8<------8<-------- * The IP shown here might not mean anything if the user or the server is behind a proxy. -- MacPorts <http://www.macports.org/> Ports system for Mac OS This is an automated message. Someone at http://www.macports.org/ added your email address to be notified of changes on UsingTheRightCompiler. If it was not you, please report to .