tpoechtrager / wclang

Cross compile source code easily for Windows with clang on Linux/Unix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docs for MXE integration

avih opened this issue · comments

It seems wclang is MXE-aware at least to some degree.

Some docs on how to use it with MXE would be appreciated (including if MXE is not installed globally).

Specifically:

  • can it be made MXE's default cross compiler (per target)?
  • can it be used to build MXE "internal" packages?
  • etc and stuff I didn't think of?

Install MXE the normal way (including make gcc etc.) and ensure the MXE bin directory (where the MXE-gcc binary is located) is added to your PATH variable. After that install wclang the normal way.

Then you should be able to use MXE libraries with [i686/x86_64]-w64-mingw32*-clang[++].

If you have problems, please read: #13, #14 and #15.

can it be made MXE's default cross compiler (per target)?
can it be used to build MXE "internal" packages?

I don't know, actually I have no clue about MXE. Theoretically "yes", should be possible.
Maybe @procedural can help a little bit further here, or ask the MXE guys.

can it be made MXE's default cross compiler (per target)?

Sure, although I use only CMake projects: just set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER variables to w32-clang and w32-clang++ for example in mxe/usr/i686-w64-mingw32.shared/share/cmake/mxe-conf.cmake and use it as a toolchain file for your project, passing -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe-conf.cmake as an argument on project initialization.

can it be used to build MXE "internal" packages?

No need for that since you can just link libraries compiled with mingw. Also, clang for windows doesn't support C++ exceptions, since most of the libraries use them it will be nearly imposible to compile something with wclang outside of your app.

Also, clang for windows doesn't support C++ exceptions, since most of the libraries use them it will be nearly imposible to compile something with wclang outside of your app.

I have some good news there. It seems like clang 3.7 will finally have support for C++ exceptions on Windows (at least for x86_64 SEH exceptions).

llvm-mirror/clang@4702b3a

Woah! :D That's great news indeed...

But I'm not sure it's possible to use wclang to compile MXE packages, I'm probably wrong and it will be better to ask them directly by opening an issue here: https://github.com/mxe/mxe/issues

Also, from my experience, mingw is a fast compiler, compiling MXE packages takes so long because they use makefiles, using faster compiler won't help with makefile's horrible switching time compared to, say, ninja build files.

... Also, clang for windows doesn't support C++ exceptions, since most of the libraries use them it will be nearly imposible to compile something with wclang outside of your app.

That's good info, as well as the clang 3.7 info. Thanks.