Live data from Hacker News

Clang Is Now Used to Build Chrome for Windows

blog.llvm.org

91–100 of 105 posts

Re: Clang Is Now Used to Build Chrome for Windows

#91
post #8

And why not use mingw gcc? Do they find somthing wrong with it? Edit Mingw-w64 its quite nice and includes gcc without all stuff cgwin does.

I used to use mingw to cross-build a project.

At one point, after updating the toolchain from gcc 4.x to 7.x and from mingw32 to mingw-w64, it started to produce broken binaries.

The manifestation of that brokenness was that binaries refused to start properly on systems where the toolchain was not installed. It just silently exited during startup - no crash, or error message, or anything.

This applied both to binaries that were cross-built on linux, and binaries built using MSYS2 on Windows.

I decided to just switch to clang-cl + MSVC headers instead, which worked properly. The only gotcha there was the need to store the headers on a case insensitive file system (I chose vfat) when compiling on linux, because the case of the includes aren't consistent (e.g. Windows.h vs. windows.h), even in the MSVC headers themselves.

Re: Clang Is Now Used to Build Chrome for Windows

#93
> On the other hand, if all platforms use the same compiler, if it builds on your machine then it’s probably going to build on all platforms.

This also works the other way: buggy code that "works" in Clang may now go unnoticed.

This means it will be harder to build Chromium using GCC or MSVC. I see that Arch Linux already has to depend on Clang to build Chromium [1], which isn't very reassuring.

[1] https://www.archlinux.org/packages/extra/x86_64/chromium/

Re: Clang Is Now Used to Build Chrome for Windows

#94
post #8

And why not use mingw gcc? Do they find somthing wrong with it? Edit Mingw-w64 its quite nice and includes gcc without all stuff cgwin does.

I used to use mingw to cross-build a project. At one point, after updating the toolchain from gcc 4.x to 7.x and from mingw32 to mingw-w64, it started to produce broken binaries. The manifestation of that brokenness was that binaries refused to start properly on systems where the toolchain was not installed. It just silently exited during startup - no crash, or error message, or anything. This applied both to binarie…

were you missing compiler runtime libraries? like any code compiled with gcc anywhere that links the runtimes as shared libraries, they'll need to be present for executables to run. depending which variant of mingw-w64 you used, there are more runtime library dependencies than there used to be, like winpthreads for c++11 thread support.

Re: Clang Is Now Used to Build Chrome for Windows

#95
post #74

Earlier quoted context omitted.

Why, though? What does Chrome do that calls into C++ code compiled by anyone but Google?

File dialogs (to save/load web pages, to upload files), print support, TCP sockets… all of these involve calling into system code.

do any of those require ABI compatibility at the C++ level? win32 API's are generally exposed as C

Re: Clang Is Now Used to Build Chrome for Windows

#96
post #94

Earlier quoted context omitted.

I used to use mingw to cross-build a project. At one point, after updating the toolchain from gcc 4.x to 7.x and from mingw32 to mingw-w64, it started to produce broken binaries. The manifestation of that brokenness was that binaries refused to start properly on systems where the toolchain was not installed. It just silently exited during startup - no crash, or error message, or anything. This applied both to binarie…

were you missing compiler runtime libraries? like any code compiled with gcc anywhere that links the runtimes as shared libraries, they'll need to be present for executables to run. depending which variant of mingw-w64 you used, there are more runtime library dependencies than there used to be, like winpthreads for c++11 thread support.

Fairly certain that wasn't the case.

As far as I could tell, the only DLLs the binaries referenced were msvcrt.dll and standard windows DLLs (KERNEL32, USER32, etc).

The application was also plain C.

Even if missing compiler runtime libraries were the issue, I would have expected the program crash or fail with an error message.

Re: Clang Is Now Used to Build Chrome for Windows

#97

Great work by the Clang team, well done! I'm a bit surprised to see that build times in Clang are worse, and that resulting binary performance is comparable. Maybe that will change when the Clang build starts to use LTCG, as the article mentions.

Yeah, just things that aren't optimized yet. Windows headers, etc have very different hot spots and need different paths to be fast than linux/mac ones.

For reference, in distributed builds, the build times are ridiculously faster using clang. (it shaves many hours off the time).

Re: Clang Is Now Used to Build Chrome for Windows

#98
post #95

Earlier quoted context omitted.

File dialogs (to save/load web pages, to upload files), print support, TCP sockets… all of these involve calling into system code.

do any of those require ABI compatibility at the C++ level? win32 API's are generally exposed as C

> win32 API's are generally exposed as C

A lot of newer Win32 APIs are IUnknown-based COM interfaces. APIs that are probably relevant for Chrome are shell interop, drag & drop, Direct2D, Direct Write, Media Foundation.

Re: Clang Is Now Used to Build Chrome for Windows

#99

Interesting. It seems Google is moving away from anything gpl/gnu lately (fuchsia, etc...)

So, as the person responsible for deciding to make just about all of the compiler switches happen (and i used to run opensource licensing for Google), this is just coincidence[1].

In this case, we just felt clang/llvm was a better architecture to build on at this point. These are also many-year projects.

I was a GCC/gdb/etc maintainer for many years, so i've got nothing against GPL software.

[1] Well, part of it is that by numbers, most newer open source projects are not GPL. The percent of GPL'd new projects before, say, 2010 and after 2010 is very different. I haven't gone far back to see when that starts, but the percentages are quite significant. It used to be 40-50% of new projects, and now it's like 10-20, maybe.

Re: Clang Is Now Used to Build Chrome for Windows

#100

Interesting. It seems Google is moving away from anything gpl/gnu lately (fuchsia, etc...)

I think it is mainly due to their concerns over the Tivoization clause which is added to GPLv3

Again, no, we didn't care.

First: We were already publishing all our GCC changes, as we did all our work upstream (we worked on a staging branch in the gcc repo, and changes were moved to trunk as fast as possible) Plenty of other companies used our branch and we were happy with it.

We do all our work upstream for clang/llvm as well, and pull compiler releases when upstream is green according to our internal testing. (Pretty much the only cherry picks are a small number of reverts sometimes)

Second, literally nobody has ever come and expressed a concern about using GCC to me.

I've had to explain the runtime and libstdc++ exceptions to people, but that was the other way around -- They weren't worrying, and I needed to make sure they worried and shipped source when they ship it as a .so.

Post reply on HN