[cfe-dev] Windows clang+mingw dev plans?
jon.forums at gmail.com
Thu Jun 7 13:24:39 PDT 2012
Seeing the recent Windows (VC++) related posts (particularly the `lib/Driver/WindowsToolChain.cpp` patch) has me curious as to what goodies are on The Dev List for users of clang + mingw/mingw-w64 on Windows.
Specifically, the following issues:
a) currently active mingw/mingw-w64 clang dev efforts and who's taking lead on each
b) updated clang build integration with previously installed mingw/mingw-w64 toolchains 
c) posix vs. win32 thread models 
 *** CLANG/MINGW INTEGRATION ISSUES ***
After applying the following hacky patch to source from `branches/release_31`
C:\Users\Jon\Documents\CDev\llvm-svn>svn diff tools\clang
--- tools/clang/lib/Frontend/InitHeaderSearch.cpp (revision 158160)
+++ tools/clang/lib/Frontend/InitHeaderSearch.cpp (working copy)
@@ -213,7 +213,13 @@
// FIXME: temporary hack: hard-coded paths.
- AddPath("/usr/local/include", System, true, false, false);
+ //AddPath("/usr/local/include", System, true, false, false);
+ AddPath("c:/devkit/mingw/lib/gcc/mingw32/4.6.2/include/c++", System, true, false, false);
+ AddPath("c:/devkit/mingw/lib/gcc/mingw32/4.6.2/include/c++/mingw32", System, true, false, false);
+ AddPath("c:/devkit/mingw/lib/gcc/mingw32/4.6.2/include/c++/backward", System, true, false, false);
+ AddPath("c:/devkit/mingw/lib/gcc/mingw32/4.6.2/include", System, true, false, false);
+ AddPath("c:/devkit/mingw/include", System, true, false, false);
+ AddPath("c:/devkit/mingw/lib/gcc/mingw32/4.6.2/include-fixed", System, true, false, false);
...I build the clang 3.1 (tied to a specific msys/mingw toolchain) with this simple helper:
sh ../llvm-svn/configure --prefix=%INSTALL_DIR% --enable-optimized --disable-assertions \
--disable-docs --disable-pic --disable-pthreads --enable-targets=x86 LDFLAGS=-static
...and get the following clang+mingw:
clang version 3.1 (branches/release_31 157536)
Thread model: posix
Using built-in specs.
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-
c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable
-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --buil
Thread model: win32
gcc version 4.6.2 (GCC)
The clang/mingw combo seems to work fine for the types of C stuff I've tried it with (e.g. - build Ruby/mruby), but it's not very adaptable or easy to use. I've not yet tried to build a clang that uses one of my msys+mingw-w64 toolchains.
My understanding is clang currently uses gcc only so that it can create correct assembling/linking invocations. I also understand that the gcc dep could be replaced by simple binutils assemble/link deps if the clang toolchain support for mingw/mingw-w64 was created/finished.
How accurate is my understanding, and what's the current thinking as what needs to be done, if anything?
 *** POSIX vs. WIN32 THREAD MODEL ISSUES ***
>From the previous issue, although I built clang with --disable-pthreads, I ended up with a clang stating it's using posix threads and integrating with an existing mingw toolchain stating it's using win32 threads.
While I haven't really pushed clang that hard, I also haven't run into any issues. I suspect it's because I've only used clang for C-based projects, and if I try with C++ threading, I'll soon find the brambles.
Is this threading mis-match a real issue, or simply my bad build config? If it's a real issue, what's the bottom-line issue, the workaround options, and current best ideas for fixing?
More information about the cfe-dev