wclang icon indicating copy to clipboard operation
wclang copied to clipboard

Docs for MXE integration

Open avih opened this issue 10 years ago • 5 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?

avih avatar Feb 08 '15 07:02 avih

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: https://github.com/tpoechtrager/wclang/pull/13, https://github.com/tpoechtrager/wclang/issues/14 and https://github.com/tpoechtrager/wclang/issues/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.

tpoechtrager avatar Feb 08 '15 08:02 tpoechtrager

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.

ghost avatar Feb 08 '15 09:02 ghost

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).

https://github.com/llvm-mirror/clang/commit/4702b3a50719d5eb7503af64a88885929b705288

tpoechtrager avatar Feb 08 '15 10:02 tpoechtrager

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.

ghost avatar Feb 08 '15 10:02 ghost

... 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.

avih avatar Feb 08 '15 12:02 avih