www. O S N E W S .com
News Features Interviews
BlogContact Editorials
.
Clang is now used to build Chrome for Windows
By Thom Holwerda on 2018-03-06 20:08:43

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.

 Email a friend - Printer friendly - Related stories
.
Read Comments: 1-10 -- 11-18
.
slow decline of GCC ?
By yoshi314@gmail.com on 2018-03-07 07:52:32
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
Permalink - Score: 2
.
RE: slow decline of GCC ?
By agentj on 2018-03-07 08:24:58
GPL3. No large company is going to touch such software with a stick most of the time when it comes to development.
Permalink - Score: 0
.
RE: slow decline of GCC ?
By kwan_e on 2018-03-07 08:27: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.
Permalink - Score: 2
.
RE: slow decline of GCC ?
By malxau on 2018-03-07 09:10: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?
Permalink - Score: 3
.
RE[2]: slow decline of GCC ?
By kwan_e on 2018-03-07 09:49:31
> 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.
Permalink - Score: 4
.
RE: slow decline of GCC ?
By ahferroin7 on 2018-03-07 13:26:51
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).
Permalink - Score: 3
.
RE[3]: slow decline of GCC ?
By jessesmith on 2018-03-07 15:11:40
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.
Permalink - Score: 4
.
RE[2]: slow decline of GCC ?
By Bill Shooter of Bul on 2018-03-07 21:32:29
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.
Permalink - Score: 3
.
RE[2]: slow decline of GCC ?
By dylansmrjones on 2018-03-08 01:31:03
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.
Permalink - Score: 3
.
RE[4]: slow decline of GCC ?
By viton on 2018-03-08 11:06:34
> 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
Permalink - Score: 4

Read Comments 1-10 -- 11-18

No new comments are allowed for stories older than 10 days.
This story is now archived.

.
News Features Interviews
BlogContact Editorials
.
WAP site - RSS feed
© OSNews LLC 1997-2007. All Rights Reserved.
The readers' comments are owned and a responsibility of whoever posted them.
Prefer the desktop version of OSNews?