If anyone is confused or curious about the MinGW builds, here are some
fast facts:

 - We do these to avoid breaking the build for Tor, they already have
a high maintenance burden keeping up with us, so it's very helpful to
them to keep these working
 - Tor uses MinGW because the Windows SDK is not free as in speech
 - We do not have the Tor-style reproducible builds in Treeherder, but
there are some other reproducible jobs in-tree, and they do help
 - Tor Browser follows ESR on Desktop, and the normal Release train
for Android, although sometimes android releases will be delayed if
there are not marked security bugs
 - Sometimes the MinGW build breaks because MinGW doesn't have a
function or constant you need specified in their headers.
Instructions for debugging this will follow.
 - If you hit this case, you can #ifdef your way to a green build, but
I strongly request you file a bug blocking
https://bugzilla.mozilla.org/show_bug.cgi?id=mingw-clang that just
says "I had to ifdef stuff over in Bug <foo>, we should clean that up
when we can."  I'll get around to it.  (I just did a cleanup the other
week.)
 - MinGW builds (which target Windows) are not buildable on Windows, only Linux.
 - It is moderate difficulty to get your own MinGW builds working
locally, but doable. Terse instructions will follow.
 - It is not easy to `./mach test` tests built with MinGW, because
they have to be transferred from the linux machine to Windows. I say
'not easy', because obviously taskcluster does it somehow, but no one
I know has ever succeeded in doing it.
 - Before we had mingw clang builds, we had mingw-gcc builds.  These
builds had _no_ debugging symbols or information at all. A great man
named David Major found and fixed a _lot_ of MinGW header errors
working with WinDBG in this environment.

--------------------
Debugging missing symbols

Go to https://searchfox.org/mingw-moz/source/ and see if the symbol is
in the MinGW headers.  This is the mingw version we use in -central,
although we add some patches:
https://searchfox.org/mozilla-central/source/taskcluster/scripts/misc/build-clang-mingw.sh#40-50

If it's not there, that's going to be your problem.  For curiosity's
sake, look at https://searchfox.org/mingw/source/ and see if the
symbol is in MinGW upstream tip.  After satiating your curiosity, use
some #ifndef __MINGW32__ to avoid the problematic function calls or
some #define to define the constants you need.

It's possible to clone mingw-w64 upstream, edit the files, git commit
and git format-patch, and copy the patch into the build-clang-mingw
patch list, then hg add the patch and send it in to try to see if that
fixes things.  You don't have to do this, but you're a saint if you
do.

-----------------
Local MinGW Builds

Browse 
https://firefox-ci-tc.services.mozilla.com/tasks/index/gecko.cache.level-3.toolchains.v3
and download the following toolchains (you'll probably have the rest,
like wine and upx):
 - linux64-clang-mingw-x86 or x64
 - mingw32-rust
 - sysroot-wasm32-wasi
 - linux64-mingw-fxc2-x86  (it's x86 for both the x86 and x64 builds)

Set up a mozconfig that looks like the following:

# x86 Builds
#ac_add_options --target=i686-pc-windows-gnu
#ac_add_options --with-toolchain-prefix=i686-w64-mingw32-

# x64 Builds
ac_add_options --target=x86_64-pc-windows-gnu
ac_add_options --with-toolchain-prefix=x86_64-w64-mingw32-

ac_add_options --disable-warnings-as-errors
mk_add_options "export WIDL_TIME_OVERRIDE=0"

# This replicates Tor's configuration
ac_add_options --enable-proxy-bypass-protection

# These aren't supported on mingw at this time
ac_add_options --disable-webrtc # Bug 1393901
ac_add_options --disable-geckodriver # Bug 1489320
ac_add_options --disable-update-agent # Bug 1561797
ac_add_options --disable-default-browser-agent # WinToast does not
build on mingw
ac_add_options --disable-notification-server

# Find our toolchain
HOST_CC="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/clang"
HOST_CXX="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/clang++"

# x86 Builds
#CC="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/i686-w64-mingw32-clang"
#CXX="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/i686-w64-mingw32-clang++"

# x64 Builds
CC="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/x86_64-w64-mingw32-clang"
CXX="/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin/x86_64-w64-mingw32-clang++"

CXXFLAGS="-fms-extensions"

RUSTC="/home/tom/Documents/moz/mozilla-unified/toolchain/rustc/bin/rustc"

mk_add_options "export
PATH=/home/tom/Documents/moz/mozilla-unified/toolchain/clang/bin:/home/tom/Documents/moz/mozilla-unified-4/toolchain/fxc2/bin:$PATH"

ac_add_options 
--with-wasi-sysroot=/home/tom/Documents/moz/mozilla-unified/toolchain/sysroot-wasm32-wasi

-tom

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CADua4_uPnx2iaHQygG4RV3zWa-uSyvPWAtP1CK_eiQ%2Barp%2BrQQ%40mail.gmail.com.

Reply via email to