Trying to cross-compile LLVM runtimes to Windows

I have been using this project with great success to achieve this : https://github.com/mstorsjo/llvm-mingw

It generates a linux-based windows cross-compiler with clang, libc++, etc.

I was able to build a large part of Qt with it afterwards for instance.

Best,

Jean-Michaël

I have been using this project with great success to achieve this : GitHub - mstorsjo/llvm-mingw: An LLVM/Clang/LLD based mingw-w64 toolchain

It generates a linux-based windows cross-compiler with clang, libc++, etc.

FWIW, lately I've added prebuilt packages of it that you can run on actual windows as well, even though cross compilation was my first/main focus.

I was able to build a large part of Qt with it afterwards for instance.

Any particular part of Qt which you weren't able to build with it? I regularly build Qt (qtbase) for i686/x86_64/armv7/aarch64, and as part of VLC, I also build a few more Qt modules (qtdeclarative, qtquickcontrols2) for i686 and x86_64.

// Martin

I suspect mingw is going to be incompatible with Petr’s needs. Adding Nico as he probably does the most cross compiling. I did it a little several weeks ago, just not with libc++, and I don’t remember running into any problems.

One thing that’s not clear to me is why the resource compiler is even being invoked at all

Yes, I don't think mingw will fit his needs, but it's at least some datapoint wrt "does anybody do this". But as most of the tool interfaces are different it probably won't hit the same issues anyway.

// Martin

No, it's just that I didn't try to build qtwebkit / qtwebengine / qt3d since I don't use them. Everything else seemed to build fine (including the qml stuff as you mentioned).

Ah, right - yeah, I haven't tried any of those either. Those sound big and complex enough that there probably are some issues to be expected in them. (I had to do half a dozen patches on qtbase itself just to make it work originally.)

// Martin

I haven’t cross-compiled LLVM. We have a working cross build of chrome/win, some notes on it at https://cs.chromium.org/chromium/src/docs/win_cross.md?type=cs&q=win_cross.md&sq=package:chromium&l=34

I don’t have any experience cross-compiling with cmake.

For chrome, we still use the rc.cc at https://github.com/nico/hack/tree/master/res (through this driver: https://cs.chromium.org/chromium/src/build/toolchain/win/rc/rc.py?q=file:rc.py&sq=package:chromium&dr) which was the prototype for llvm-rc. We haven’t switched to llvm-rc yet; my impression was that llvm-rc isn’t super production quality yet (but some people do use it successfully).

Yup, re llvm-rc, I use it for a bunch of projects (with mostly unspectacular resources), where it works fine, but I do know of a few corner case resource types that are unimplemented. As long as you don't use them (menuex is one that I have noted somewhere), it might work fine though.

And if you have resource files with c preprocessor includes, one needs to manually run the preprocessing outside of llvm-rc (contrary to rc.exe which invokes the preprocessor internally).

// Martin