Linked by Thom Holwerda on Tue 6th Mar 2018 20:08 UTC
Google

As of Chrome 64, Chrome for Windows is compiled with Clang. We now use Clang to build Chrome for all platforms it runs on: macOS, iOS, Linux, Chrome OS, Android, and Windows. Windows is the platform with the second most Chrome users after Android according to statcounter, which made this switch particularly exciting.

Order by: Score:
slow decline of GCC ?
by yoshi314@gmail.com on Wed 7th Mar 2018 07:52 UTC
yoshi314@gmail.com
Member since:
2009-12-14

I wonder if it's the technical merit of llvm in general, or gpl3 that's turning people away from gcc nowadays.

Granted, this is windows build we're talking about, but it seems that llvm is pushing forward on all fronts.

Edited 2018-03-07 07:53 UTC

Reply Score: 2

RE: slow decline of GCC ?
by agentj on Wed 7th Mar 2018 08:24 UTC in reply to "slow decline of GCC ?"
agentj Member since:
2005-08-19

GPL3. No large company is going to touch such software with a stick most of the time when it comes to development.

Reply Score: 0

Bill Shooter of Bul Member since:
2006-07-14

No, companies that are simply using GPL V3 have nothing to worry about. Its companies that distribute it, that are concerned with GPL V3.

However, you are right that those companies that want to contribute to compilers, don't want o touch GPL V3. Hence they are pouring their efforts into LLVM efforts.

Now, because all the development is going into LLVM, its becoming better than GCC. The technical reasons follow shortly after the political.

Reply Score: 3

RE: slow decline of GCC ?
by kwan_e on Wed 7th Mar 2018 08:27 UTC in reply to "slow decline of GCC ?"
kwan_e Member since:
2007-02-18

I wonder if it's the technical merit of llvm in general, or gpl3 that's turning people away from gcc nowadays.


It's more like the technical demerit of gcc. GCC is a cumbersome code base, and the move to develop in C++ was probably too late.

LLVM Clang is easier to develop for.

Reply Score: 2

RE[2]: slow decline of GCC ?
by FlyingJester on Thu 8th Mar 2018 19:20 UTC in reply to "RE: slow decline of GCC ?"
FlyingJester Member since:
2016-05-11

In the case of several systems such as OpenBSD, it is indeed the license, although a barrier to adoption is LLVM and Clang supporting many fewer targets, and not always being self-hosting.

In my own experience, current versions of LLVM+Clang and GCC take a similar amount of time to download and build (although CMake makes me want to build clang a lot less). The code output is very comparable as well. Sometimes Clang is better, sometimes GCC is better ( https://t.co/k3d4mN7EqE )

Edited 2018-03-08 19:22 UTC

Reply Score: 4

RE[2]: slow decline of GCC ?
by Carewolf on Sun 11th Mar 2018 09:05 UTC in reply to "RE: slow decline of GCC ?"
Carewolf Member since:
2005-09-08

"I wonder if it's the technical merit of llvm in general, or gpl3 that's turning people away from gcc nowadays.


It's more like the technical demerit of gcc. GCC is a cumbersome code base, and the move to develop in C++ was probably too late.

LLVM Clang is easier to develop for.
"
True. I have contributed patches to both and LLVM is by far the easiest code to read.

Yet somehow GCC still produces faster code, and after being challenged by Clang they now also compile faster.. So they must be doing something right.

Reply Score: 2

RE: slow decline of GCC ?
by malxau on Wed 7th Mar 2018 09:10 UTC in reply to "slow decline of GCC ?"
malxau Member since:
2005-12-04

I wonder if it's the technical merit of llvm in general, or gpl3 that's turning people away from gcc nowadays.


For me, it was pure code generation. For my relatively simple projects, clang would produce code that's about 10%-15% smaller than gcc. clang was still not quite as good as Visual C++, but gcc was an outlier. Turning your point around, what would be the reason to use gcc over clang?

Reply Score: 3

RE[2]: slow decline of GCC ?
by kwan_e on Wed 7th Mar 2018 09:49 UTC in reply to "RE: slow decline of GCC ?"
kwan_e Member since:
2007-02-18

For my relatively simple projects, clang would produce code that's about 10%-15% smaller than gcc.


After -O2 or -Os, I find they're both about the same. Clang is a much faster compiler, hands down. My understanding is that GCC can be overly aggressive in optimization so may end up generating code that isn't the best for relatively simple projects.

Reply Score: 4

RE[3]: slow decline of GCC ?
by jessesmith on Wed 7th Mar 2018 15:11 UTC in reply to "RE[2]: slow decline of GCC ?"
jessesmith Member since:
2010-03-11

The optimization thing is definitely true. I have tested code using GCC and Clang with various optimizations turned on. Code compiled with Clang would always run smoothly. Code compiled without optimizations on GCC would also run. But if I turned on optimizations under GCC, the program would crash. Some logic or checks were getting optimized out, but only under GCC, and causing instability.

Warnings and errors are more sane under Clang. The messages are much clearer with references to where things went wrong in Clang. GCC's errors are pretty cryptic in comparison.

I have also noticed GCC throwing incorrect warnings. Like "This variable is declared but unused." But looking through the code shows the variable is, in fact, used and cannot be removed. I still test code under GCC to see if it finds potential problems Clang doesn't, but I do almost all my work with Clang because it is so much more pleasant to use.

Reply Score: 4

RE[4]: slow decline of GCC ?
by viton on Thu 8th Mar 2018 11:06 UTC in reply to "RE[3]: slow decline of GCC ?"
viton Member since:
2005-08-09

But if I turned on optimizations under GCC, the program would crash. Some logic or checks were getting optimized out, but only under GCC, and causing instability.

That means your code is incorrect and suffering from undefined behaviour.
GCC generate more aggressive, faster code than C-lang.
There are a lot of articles on C++ undefined behaviour.

When some parts of your code are optimised-out it means these parts are redundant or not used.

I have also noticed GCC throwing incorrect warnings. Like "This variable is declared but unused."

Check twice. It is pretty safe to assume error is on your side.
Try with different GCC versions. Its is highly unlikely that you found some untested path.

Edited 2018-03-08 11:15 UTC

Reply Score: 4

v RE[5]: slow decline of GCC ?
by Kochise on Thu 8th Mar 2018 13:48 UTC in reply to "RE[4]: slow decline of GCC ?"
RE[6]: slow decline of GCC ?
by viton on Fri 9th Mar 2018 07:11 UTC in reply to "RE[5]: slow decline of GCC ?"
viton Member since:
2005-08-09

Yup, try different gcc versions, forks, branches, vendor revisions, one might by chance fit your need for your project.

That I proposed was a way to diagnose the problem. If you think the problem is compiler specific - try different version to make sure.

A lot of programs in devices around you are compiled with GCC and optimization enabled. If your software is unstable, GCC isn’t the right thing to blame.

Edited 2018-03-09 07:12 UTC

Reply Score: 3

RE[5]: slow decline of GCC ?
by kwan_e on Thu 8th Mar 2018 14:18 UTC in reply to "RE[4]: slow decline of GCC ?"
kwan_e Member since:
2007-02-18

When some parts of your code are optimised-out it means these parts are redundant or not used.


Or you're checking this for null.

Reply Score: 2

RE: slow decline of GCC ?
by ahferroin7 on Wed 7th Mar 2018 13:26 UTC in reply to "slow decline of GCC ?"
ahferroin7 Member since:
2015-10-30

For a large project like Chrome, I'd be more than willing to bet that a large part of the appeal is the compilation performance of Clang compared to GCC. In my own experience, builds that use Clang tend to take between 10 and 15% less time than building the same code with GCC. While that may not sound like much, it becomes very significant when you're dealing with stuff that takes hours to build even on high-end systems (see for example LibreOffice, Firefox, Thunderbird, and the various WebKit libraries).

Reply Score: 3

RE[2]: slow decline of GCC ?
by dylansmrjones on Thu 8th Mar 2018 01:31 UTC in reply to "RE: slow decline of GCC ?"
dylansmrjones Member since:
2005-10-02

Reverse is true for me. I get shorter compilation times with gcc for chromium than with clang (still takes some hours). Otoh, anything obj-c is done with clang. There's no compelling technical reasons to choose one over the other in general. As is evident from assorted tests and comparisons. I rely on both.

Reply Score: 3

RE[3]: slow decline of GCC ?
by ahferroin7 on Thu 8th Mar 2018 12:17 UTC in reply to "RE[2]: slow decline of GCC ?"
ahferroin7 Member since:
2015-10-30

Interesting. I've never built Chromium with Clang, but I have done webkit-gtk and Firefox with it before, and both of those built faster. I've not tried recently though, and performance of GCC may have significantly improved since I last tried.

Reply Score: 2

RE[2]: slow decline of GCC ?
by tylerdurden on Thu 8th Mar 2018 21:20 UTC in reply to "RE: slow decline of GCC ?"
tylerdurden Member since:
2009-03-17

This is Chrome for Windows, it was built using MSVCC not gcc.


clang had a bit of an edge over gcc in compile speed a few years back. But I think they compile speed differential is not that significant anymore when it comes to recent llvm vs gcc toolchains.

Reply Score: 3

RE[2]: slow decline of GCC ?
by Carewolf on Sun 11th Mar 2018 09:07 UTC in reply to "RE: slow decline of GCC ?"
Carewolf Member since:
2005-09-08

No, they did this for the compiler monoculture. They didn't want to deal with different quirks in different compilers, so now they only support one single compiler, and thus ends up depending on their bugs (I am a Chromium embedded and have already had to fix several clang'isms in the Chromium 65 code just a few weeks after they went monoculture).

Reply Score: 2