xcode portgroup and using the right compiler: GCC_VERSION vs CC and CXX
Ryan Schmidt
ryandesign at macports.org
Tue Mar 12 22:37:58 PDT 2013
The xcode-1.0 portgroup doesn't use the configure phase, so it doesn't benefit from the automatic setting of CC, CXX and related variables that MacPorts base does during the configure phase.
Instead it does this:
switch -- [option configure.compiler] {
gcc-3.3 {set gcc_version 3.3}
gcc-4.0 {set gcc_version 4.0}
gcc-4.2 {set gcc_version 4.2}
llvm-gcc-4.2 {set gcc_version com.apple.compilers.llvmgcc42}
clang {set gcc_version com.apple.compilers.llvm.clang.1_0}
}
if {[info exists gcc_version]} {
append xcode_build_args " GCC_VERSION=${gcc_version}"
}
So for any other compiler (i.e. any MacPorts gcc or clang or llvm-gcc) it will do nothing.
Why do we have to use this Xcode-specific GCC_VERSION variable? Could we just use CC and CXX and thereby support all compilers?
Here's where we started using GCC_VERSION:
https://trac.macports.org/changeset/77279
Curiously, Homebrew used to set CC and CXX, and it apparently did have an effect for xcodebuild and two years ago they had a bug report that they should stop doing this:
https://github.com/mxcl/homebrew/issues/6406
But I propose we start doing this. Otherwise it's hard to try to build a port using e.g. a MacPorts clang compiler -- which I do often, as an easier way to test what might happen on older versions of Xcode. If there are individual ports whose Xcode projects specify an older compiler and they don't work with the latest clang, well, that's what compiler.blacklist is for.
More information about the macports-dev
mailing list