Closed Bug 1444914 Opened 7 years ago Closed 5 years ago

Make it possible to cross-compile a Windows build with clang-cl from Linux

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1617794

People

(Reporter: ted, Unassigned)

References

Details

Google has worked out a linux->windows cross compile using clang-cl: https://chromium.googlesource.com/chromium/src/+/refs/heads/master/docs/win_cross.md It would be nice if we could work out the details to get this working for Firefox as well. Some potential benefits: * Developers could do Windows development on a Linux machine, where builds are faster and the environment is more conducive to development. * We could potentially switch our Windows builds in CI to be built on Linux, which would make them faster and also let us have more control over the build environment because we could use the same Docker image we use for other builds. * This would make it fairly straightforward to do a Windows build inside a WSL shell. I did a bunch of work on this in bug 1311729 (still ongoing), but because we have to invoke MSVC, which is a Windows binary, we have to deal with all sorts of path translation issues. If we were using native Linux clang-cl binaries this would be much simpler. Most of this ought to be fairly straightforward. In fact, my WSL patches have probably covered a lot of ground here--I had a build working with `--host=x86_64-pc-linux-gnu` and `--target=x86_64-pc-mingw32`, where the host compiler was gcc and the target compiler was MSVC. Additionally, we have mingw32 builds running in CI now, which are pretty similar, although they disable some features that we need to ship like accessibility. Google seems to have a few workarounds in their tree for the cross-compile case. They've got a Python reimplementation of rc.exe which we could probably use: https://chromium.googlesource.com/chromium/src/+/master/build/toolchain/win/rc/ They've also got checked-in copies of the output of some tools like midl.exe which don't have versions that run on Linux: https://chromium.googlesource.com/chromium/src/+/master/third_party/win_build_output/README.chromium We'd have to figure something out there for actual cross-compiles, certainly, but for the WSL case we could make this work by just running the Windows binaries.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #0) > Additionally, we > have mingw32 builds running in CI now, which are pretty similar, although > they disable some features that we need to ship like accessibility. That's temporary. widl should be updated to support a new option that it just doesn't support right now. > They've also got checked-in copies of the output of some tools like midl.exe > which don't have versions that run on Linux: > https://chromium.googlesource.com/chromium/src/+/master/third_party/ > win_build_output/README.chromium The first one that comes to mind is fxc. Graphics recently took out their compiled output and were loathe to reintroduce it for MinGW. MinGW uses wine and a tiny wrapper around a Windows dll that will do the compilation for us: https://github.com/mozilla/fxc2
Version: Version 3 → 3 Branch
Blocks: 1567506
Version: 3 Branch → Trunk
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.