> On Dec 7, 2016, at 12:05 PM, Christopher Jones <jon...@hep.phy.cam.ac.uk> 
> wrote:
> 
> 
>> On 7 Dec 2016, at 5:32 pm, Joshua Root <j...@macports.org> wrote:
>> 
>> On 2016-12-8 04:24 , Chris Jones wrote:
>>> Hi,
>>> 
>>> I'm working on an update to the root6 port, where the minimum compiler
>>> requirement has been increased in the latest release, such that I need
>>> to update the compiler blacklist/fallback to force a macports compiler
>>> to be used on OSX 10.8 and 10.9 (whereas previously the system one was OK).
>>> 
>>> This is all working OK, but I have noticed one thing I am trying to
>>> understand is on 10.8 and 10.9 different fallbacks are being picked.
>>> 
>>> I have
>>> 
>>> compiler.blacklist-append *gcc* {clang < 602} macports-clang-3.3
>>> macports-clang-3.4 macports-clang-3.5 macports-clang-3.6
>>> compiler.fallback-append macports-clang-3.9 macports-clang-3.8
>>> macports-clang-3.7
>>> 
>>> On 10.8 this is causing macports clang 3.9 to be picked, whereas on 10.9
>>> clang 3.8 is being used. I am curious as to what the logic is in the
>>> blacklist portgroup that is leading to this different decisions to be
>>> made ? I thought perhaps it was based on what clang ports where already
>>> installed, but even after uninstalling all clang versions, the same
>>> decisions are being made. Just curious...
>> 
>> The initial value of compiler.fallback differs based on cxx_stdlib because 
>> clang 3.5+ needs libc++. And yes, this will mean trouble for users on 10.8 
>> who are using the default cxx_stdlib.
> 
> Ah, I didn’t consider the cxx_stdlib differences. Still not sure though how 
> that exactly translates into different decisions w.r.t. clang 3.8 versus 3.9 
> though. Is it just the different list means a different (random) decision is 
> taken ? both are >3.5 so on the same field regarding the stdlib used.

No random decisions are taken. MacPorts uses the first acceptable (i.e. not 
blacklisted) compiler from the whitelist (if you specify a whitelist), or the 
first acceptable compiler from the fallback list (if you don't specify a 
whitelist).

You can read the portconfigure::get_compiler_fallback procedure in 
src/port1.0/portconfigure.tcl to see all the nuance that goes into generating 
the list of compilers to try, which varies based on OS version, Xcode version, 
and C++ library:

https://github.com/macports/macports-base/blob/7fb6ab2e5a40a5f4f828430a499b840b43398c56/src/port1.0/portconfigure.tcl#L475

but the relevant part here is:

On OS X versions earlier than Sierra, with libc++ and Xcode 5 or later (i.e. on 
10.9-10.11, or on 10.8 or earlier if the user follows the LibcxxOnOlderSystems 
wiki page) the default compiler fallback is:

clang macports-clang-3.8 macports-clang-3.7 macports-clang-3.6 
macports-clang-3.5

(The intention is that this would list the newest stable version of clang 
first, followed by the next newest stable version, etc. clang 3.9.0 stable was 
released in September 2016 so one would think that macports-clang-3.9 should be 
prepended to that list, but we haven't done that yet; I don't know if there is 
an extenuating circumstance why that has not yet been done.)

With libstdc++ and Xcode 5 or later, the default compiler fallback is:

clang macports-clang-3.4 macports-clang-3.3

To these lists, in your port you append "macports-clang-3.9 macports-clang-3.8 
macports-clang-3.7"

That means the final fallback list for your port for libc++ on 10.11 or earlier 
with Xcode 5 or later is:

clang macports-clang-3.8 macports-clang-3.7 macports-clang-3.6 
macports-clang-3.5 macports-clang-3.9 macports-clang-3.8 macports-clang-3.7

From this, MacPorts picks the first acceptable compiler, which (since you are 
blacklisting clang < 602) is either clang (if its version is >= 602) or 
macports-clang-3.8 (if clang's version is < 602).

For libstdc++ with Xcode 5 or later, the final fallback for your port is:

clang macports-clang-3.4 macports-clang-3.3 macports-clang-3.9 
macports-clang-3.8 macports-clang-3.7

(For earlier Xcode versions, llvm-gcc-4.2 is also in the list, but since you're 
blacklisting *gcc* that won't get used.)

From this, MacPorts picks the first acceptable compiler, which (since you are 
blacklisting clang < 602 and macports-clang-3.3 and macports-clang-3.4) is 
macports-clang-3.9.


Reply via email to