MinGW Target on TaskCluster

As part of our work with Tor, we=E2=80=99ve been working on getting a MinGW=
-based
build of Windows into TaskCluster. Tor is currently using ESR releases, and
every ESR they have to go through a large amount of work to get the build
working under MinGW again; by continually building (and testing) that build
we=E2=80=99ll be able to cut weeks to months of effort for them each ESR re=
lease.
(Not breaking the MinGW build is also a necessity if they were ever to move
off ESRs.)

Unlike our normal Windows builds with msvc or clang-cl, this is a
cross-compile on Linux for Windows, as well as the first time in a long
time we=E2=80=99ve built for Windows with gcc. Building with gcc for Window=
s has
exposed a number of new warnings
<https://bugzilla.mozilla.org/show_bug.cgi?id=3D1394433> to clean up, as we=
ll
as some C++ spec incompatibilities that MSVC (and clang-cl) accept. All of
the breaks have been resolved; and a lot of the warnings and similar are
either resolved or in-progress.

Effective this weekend, MinGW is on Treeherder, with the single build
target win32-mingw32 (debug). Its toolchain builds are under TMW (with a
few under TL because they are generic Linux packages.)

The one-click loaner system works for MinGW, and we=E2=80=99re going to all=
ow this
to bake at Tier 2 for a while. Your help in keeping the build green is
greatly appreciated, and if you hit a MinGW bug you can=E2=80=99t decipher,=
 I=E2=80=99ll be
happy to help, just send me an email or a needinfo. Some of the most common
things that cause errors for MinGW:


 - #include <Windows.h> instead of #include <windows.h> and similar

 - _uuidof() instead of IID_* ref
<https://stackoverflow.com/questions/18606546/how-to-use-uuidof-in-mingw>

 - Casting nullptr to bool or int

 - Using the (in)correct assembly code

 - Breaking --disable-webrtc, --disable-sandbox, or --disable-accessibility

 - MinGW lagging behind on defining new constants Microsoft has defined

There are a few things left outstanding
<https://bugzilla.mozilla.org/showdependencytree.cgi?id=3D1330608&hide_reso=
lved=3D1>
for the MinGW build, including webrtc
<https://bugzilla.mozilla.org/show_bug.cgi?id=3D1393901>, stylo
<https://bugzilla.mozilla.org/show_bug.cgi?id=3D1390583> (which may be the
most difficult in this list), the sandbox
<https://bugzilla.mozilla.org/show_bug.cgi?id=3D1230910>,
--enable-accessibility
<https://sourceforge.net/p/mingw-w64/bugs/648/>, cleaning
up warnings <https://bugzilla.mozilla.org/show_bug.cgi?id=3D1394433>, and r=
unning
tests <https://bugzilla.mozilla.org/show_bug.cgi?id=3D1395047>. In the
future, there is hope (by me at least) to throw all of this work away.
Compiling on Linux for Windows with clang (or clang-cl) would probably be a
significant improvement for Tor=E2=80=99s builds, and would enable them to =
take
advantage of CFI and SEH, as well as simplifying the number of platforms
Mozilla supports. Chrome has been pushing towards this
<https://bugs.chromium.org/p/chromium/issues/detail?id=3D495204>, so we=E2=
=80=99re
keeping an eye on their progress.

Finally, I want to thank everyone who brought this long process to this
point: everyone who wrote patches, explained things (sometimes over and
over again), and reviewed. That=E2=80=99s including but not limited to: bok=
lm,
dmajor, froydnj, glandium, georg, jacek, jrmuizel, and ted; plus the dozen
or so more people who have reviewed my patches all over the codebase.


-tom
0
Tom
10/9/2017 5:31:37 AM
mozilla.dev.platform 6108 articles. 0 followers. Post Follow

2 Replies
24 Views

Similar Articles

[PageSpeed] 47

Am 09.10.2017 um 07:31 schrieb Tom Ritter:
> As part of our work with Tor, we’ve been working on getting a MinGW-based
> build of Windows into TaskCluster. 

A maybe too obvious question from the side lines: Why is the Tor browser
cross-compiled and not using MSVC?

Philipp
0
Philipp
10/9/2017 3:31:52 PM
On Mon, Oct 9, 2017 at 10:31 AM, Philipp Wagner <news@philipp-wagner.com>
wrote:

> Am 09.10.2017 um 07:31 schrieb Tom Ritter:
> > As part of our work with Tor, we=E2=80=99ve been working on getting a M=
inGW-based
> > build of Windows into TaskCluster.
>
> A maybe too obvious question from the side lines: Why is the Tor browser
> cross-compiled and not using MSVC?
>
>
Building on Linux allows Tor Browser (including its entire toolchain and
dependencies) to be built deterministically and thus reproducibly using an
entirely open source toolchain. (There are a few small exceptions but
they're quite small.)

Reproducible builds significantly reduce the trust inherent in an
organization's build infrastructure and when recreated independently ensure
that nothing unexpected was inserted into the final executable. Having the
entire toolchain open source ensures that anyone who wants to inspect the
code or reason about its behavior can do so. (And as I've learned in the
past year Tor actually has a good amount of anonymous contributors reading
the source code of its toolchain and reporting things.)

You can read more about the philosophy behind this movement at
https://blog.torproject.org/deterministic-builds-part-one-cyberwar-and-glob=
al-compromise
https://reproducible-builds.org/
CCleaner is a good example of attackers backdooring compiled software.

The next step, past reproducible builds, is Binary Transparency, which
ensures that before an update is applied, it is publicly known, so
attackers cannot surreptitiously subvert the update mechanism.  Tor is
exploring some avenues there. FLAME is a good example of attacking the
update mechanism.

I would describe Mozilla as 'curious' about reproducible builds (see
https://bugzilla.mozilla.org/show_bug.cgi?id=3D885777); but we are actively
working on Binary Transparency (see
https://bugzilla.mozilla.org/show_bug.cgi?id=3D1341395).

-tom
0
Tom
10/9/2017 4:14:26 PM
Reply: