News for hackers. Stuff that matters.
Re:LLVM 6.0.0 Release by m1h4 on Thursday March 08, 2018 @10:41AM (#16544982)
Would love to see better transparency from Apple with regards to their adoption/flavour of Clang. The current and next versions of Xcode (9.2 and 9.3) still do not support std::variant/std::optional in Cpp17 for example…
Re:LLVM 6.0.0 Release by AlexeyBrin on Thursday March 08, 2018 @10:50AM (#16545037)
Apple's LLVM and Clang from Xcode 9 are based on version 4.0 of the main LLVM/Clang. You'll need at least LLVM/Clang 5.0 for more C++17 compatibility.

To be fair, modern C++ support is not a priority for Apple, their efforts are more toward Swift.

Re:LLVM 6.0.0 Release by saagarjha on Thursday March 08, 2018 @01:13PM (#16546294)
> Apple's LLVM and Clang from Xcode 9 are based on version 4.0 of the main LLVM/Clang.

How do you know this? Is this documented anywhere?

Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @12:12PM (#16545794)
It's fine if it's not a priority, but why ship a crippled compiler when they could ship the upstream compiler? ABI issues maybe? (I've heard from OS X users that XCode updates have broken the string ABI multiple times anyway...).

I don't really care too much since I'm not an OS X user, but some people insist on trying to compile/run some of the software I work on on OS X...

Re:LLVM 6.0.0 Release by Joky on Thursday March 08, 2018 @02:22PM (#16546859)
Talking of Apple Clang as a crippled compiler comes across as very uneducated opinion to me. It goes through an extensive validation / stabilization for many months before being released. So yes it adds some delay in getting new shiny features, but calling it "crippled" seems like a very much uneducated opinion here.

You can have an idea about the integration exactly what version from upstream Apple is integrating by looking at Swift (they somehow have to be in sync). I guess the last Xcode update was: https://github.com/apple/swift-clang/commits/swift-4.1-branc... The next minor update will likely be this one: https://github.com/apple/swift-clang/commits/swift-4.2-branc... ; so judging at the history I bet you'll get a version of clang that is based of clang-5.0 upstream. And likely the next major Xcode (10?) would be based of this: https://github.com/apple/swift-llvm/tree/swift-5.0-branch ; which is based off clang-6.0. Note that this branch will very likely get many bug fixes in the next ~6 months. (the above are only guesses based on past release, I don't know anything about their current plan or schedule).

The Apple engineers will try to build all variants of the Apple OS for all the HW they ship with this new clang-6.0 based branch. The usual process is to fix upstream the development of clang-7.0 and cherry-pick in these branches.

So the compiler that you'll get with the next major Xcode, even if based of clang-6.0 will have many/most of the bug-fixes that will be in clang-7.0 (release in July), but not most of the new features (and new bugs!). Caveat: this apply only to ARM64 and X86, of course Apple does not try to backport bugfixes for platform they don't support.

(Note that libc++ is handled a bit differently.)

Disclaimer: I was part of the Apple clang team until ~1y ago.

Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @03:04PM (#16547204)
I'm sure a lot of work goes into it, but often features that are present in upstream clang seem to be removed or heavily delayed. Fom the perspective of a Linux "developer" whose software (C++ scientific tools) sometimes gets compiled with the Xcode clang++, I've seen (i.e. been told of by Apple users) all sorts of problems that don't happen with upstream clang or modern gcc. The fact that the versioning isn't coherent with upstream clang makes things even more confusing.
Re:LLVM 6.0.0 Release by pertymcpert on Friday March 09, 2018 @06:42AM (#16551119)
What features?
Re:LLVM 6.0.0 Release by cozzyd on Friday March 09, 2018 @11:35AM (#16552877)
Well the one I'm familiar with is Apple's explicit disabling of thread-local storage for a long time. See e.g. https://stackoverflow.com/a/23850891, which thankfully has been fixed since then (but it took something like 2 years).
Re:LLVM 6.0.0 Release by m1h4 on Friday March 09, 2018 @05:29AM (#16550913)
Thank you for the info/insight.

I assumed that the specified language features, especially ones also depending on core libraries like libc++, would most likely be released as part of the next major OS update (since these are very essential for the complete system and need to be tested along side it as one whole).

I didn't check the macOS 10.13.4 beta, but I'm assuming that the features I mentioned are coming as part of macOS 10.14 and Xcode 10.

Re:LLVM 6.0.0 Release by BozeWolf on Thursday March 08, 2018 @12:24PM (#16545903)
Can’t you just install a more up to date compiler with brew? I don’t know if signing binaries works though.
Re:LLVM 6.0.0 Release by gumby on Thursday March 08, 2018 @01:31PM (#16546443)
Brew's approach to compilers adds tremendous friction.

Brew doesn't download a binary, it builds the compilers (both gcc and clang) and installs them but doesn't make bin/ links.

It's because of this that our build process (I'm not OP BTW) builds with all of brew gcc, brew clang and xcode (thank goodness for xcodebuild at least, so I can do this all from a Makefile). CMake is really helpful here.

Re:LLVM 6.0.0 Release by saagarjha on Thursday March 08, 2018 @04:18PM (#16547698)
Homebrew has bottles so you don't have to do compilation on your machine–you just download a precompiled version.
Re:LLVM 6.0.0 Release by gumby on Thursday March 08, 2018 @07:57PM (#16549084)
Yes, but GCC and clang are not provided that way, and, as I mentioned, not linked into /usr/local/bin. I understand why they don't do the latter (it could confuse the unsuspecting user) but it does add friction.
Re:LLVM 6.0.0 Release by saagarjha on Friday March 09, 2018 @07:17AM (#16551204)
> but GCC and clang are not provided that way

What? On my machine both are available as bottles:

    $ brew info gcc | head -n 1
    gcc: stable 7.3.0 (bottled), HEAD
    $ brew info llvm | head -n 1
    llvm: stable 5.0.1 (bottled), HEAD [keg-only]
Re:LLVM 6.0.0 Release by gumby on Friday March 09, 2018 @07:23PM (#16556260)
Huh, interesting; our site config seems to require building so I had assumed that was the case!
Re:LLVM 6.0.0 Release by hs86 on Saturday March 10, 2018 @10:20AM (#16558772)
Make sure that you install (or reinstall after a big macOS upgrade) the XCode command line tools. If they are not present, homebrew falls back to compiling GCC from source.
Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @03:05PM (#16547208)
Probably, but it's probably best not to ask all users to do that...
Re:LLVM 6.0.0 Release by abritinthebay on Thursday March 08, 2018 @06:43PM (#16548721)
"crippled" is rather hyperbolic. Older, less feature rich, but not crippled.
Re:LLVM 6.0.0 Release by ddavis on Thursday March 08, 2018 @10:56AM (#16545085)
Chances are the next macOS upgrade will come with an Xcode upgrade which usually comes with an llvm/clang upgrade... but I do agree with you.
Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @11:38AM (#16545474)
The problem is that Apple uses its own version numbers for clang, making feature detection difficult. See e.g. http://www.agner.org/optimize/vectorclass/read.php?i=156
Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @10:49AM (#16545028)
I can't remember, has Apple bothered enabling thread-local storage in its clang distribution yet?
Re:LLVM 6.0.0 Release by neilc on Thursday March 08, 2018 @12:51PM (#16546121)
Apple's clang supports thread_local as of XCode 8: https://stackoverflow.com/questions/28094794/why-does-apple-...
Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @03:09PM (#16547240)
Better late than never, I suppose. The answer indicates it might be ABI incompatible with upstream clang though? I'm sure that can cause a lot of fun...
Re:LLVM 6.0.0 Release by ComputerGuru on Thursday March 08, 2018 @11:24AM (#16545347)
The last time I checked, only for POC. In my uuid library [0], macOS is basically the only one I can’t create a per-thread rng and instead have to spin up a new one each time.

0: https://github.com/neosmart/uuidxx

Re:LLVM 6.0.0 Release by cozzyd on Thursday March 08, 2018 @11:33AM (#16545425)
It's frustrating, because TLS works fine on vanilla clang or newish gcc on Mac OS x.
Re:LLVM 6.0.0 Release by wahern on Thursday March 08, 2018 @02:11PM (#16546765)
FWIW, macOS has arc4random(3) and arc4random_buf(3).
Re:LLVM 6.0.0 Release by ComputerGuru on Thursday March 08, 2018 @03:02PM (#16547183)
Thank you. It was supposed to be a platform-agnostic uuid library embracing the benefits of C++11 and beyond. But that was a pipe dream :)