Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#61418 closed defect (fixed)

Wrong minimum clang version when compiler.thread_local_storage is yes and compiler.cxx_standard is 2014

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: chrstphrchvz (Christopher Chavez)
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version: 2.6.3
Keywords: Cc: dbevans (David B. Evans), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), chrstphrchvz (Christopher Chavez), mascguy (Christopher Nielsen)
Port:

Description

When compiler.cxx_standard is 2011, MacPorts sets the min clang version to 500.2.75 unless compiler.thread_local_storage is also set in which case it sets the min clang version to 800.0.38. Great.

But when compiler.cxx_standard is 2014, MacPorts sets the min clang version to 602.0.49. It does not increase the min clang version to 800.0.38 if compiler.thread_local_storage is also set, which causes build failure. See for example [59c7bd2a635e363189bcb53e7205e9f8c2d0e5ab/macports-ports] where a port worked around this.

https://github.com/macports/macports-base/blob/master/src/port1.0/portconfigure.tcl#L856-L868

Change History (10)

comment:1 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

I encountered an instance of this issue: https://github.com/macports/macports-ports/pull/8761#issuecomment-708126427

There may be more ports recently impacted by this, as I was cleaning up compiler blacklist usage that looked addressed by https://github.com/macports/macports-base/pull/161 even if compiler.cxx_standard was 2014 or later.

Would the following work instead?

            if {${compiler.cxx_standard} >= 2017} {
                set min_value [max_version $min_value 902.0.39.1]
            } elseif {${compiler.cxx_standard} >= 2014} {
                set min_value [max_version $min_value 602.0.49]
            } elseif {${compiler.cxx_standard} >= 2011} {
                set min_value [max_version $min_value 500.2.75]
            }
            if {${compiler.cxx_standard} >= 2011 && ${compiler.thread_local_storage}} {
                # macOS has supported thread-local storage since Mac OS X Lion.
                # So __thread (GNU extension) and _Thread_local (C11) could be used.
                # However, the C++11 keyword was not supported until Xcode 8
                #    (https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW127)
                #    (https://developer.apple.com/videos/play/wwdc2016-405/?time=354).
                set min_value [max_version $min_value 800.0.38]
            }

comment:2 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:3 Changed 4 years ago by kencu (Ken)

IMHO setting compiler.thread_local_storage to yes should implicitly set the compiler.cxx_standard to at least 2011 if it's not already set to something greater (as obviously you need that at least for thread_local and c++).

Otherwise, the user sees an error about needing thread_local, adds compiler.thread_local_storage yes to the Portfile, and it doesn't work.

Version 1, edited 4 years ago by kencu (Ken) (previous) (next) (diff)

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

I thought the point was that there's thread local with C, and there's thread local with C++. Setting compiler.thread_local_storage doesn't specify which it is. If the software is using thread local with C++, then it needs to set compiler.cxx_standard correctly. If the software is using thread local with C only, then there's no need to impose the higher compiler requirements.

comment:5 Changed 4 years ago by kencu (Ken)

Oh, I see that case -- yes I guess that could happen.

comment:6 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

comment:7 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Owner: set to chrstphrchvz
Resolution: fixed
Status: newclosed

In 618d0363ce349c8a3c80bfa5a6434f52c00234c0/macports-base (master):

restrict compiler for C++14 and thread-local storage

…by revising approach from macports/macports-basehttps://github.com/macports/macports-base/pull/161
Fixes: #61418

comment:8 Changed 4 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 4 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.7.0

comment:10 Changed 3 years ago by chrstphrchvz (Christopher Chavez)

In c48281e65694a04ff88fef6e7d9e5a839f2c1c40/macports-ports (master):

multiple ports: compiler blacklist cleanup

nheko, openimageio, openal-soft, poppler:
macports/macports-basehttps://github.com/macports/macports-ports/pull/214 included in MacPorts 2.7.0
See: #61418

xaos: compiler blacklist is redundant due to
macports/macports-basehttps://github.com/macports/macports-ports/pull/161

Note: See TracTickets for help on using tickets.