[LLVMdev] LLVM+Clang 3.2rc2 MinGW binaries' libstdc++ requirement

Pawel Wodnicki root at 32bitmicro.com
Wed Dec 5 22:27:25 PST 2012

> I attempted to run the 3.2rc2 experimental LLVM+Clang package for 
> Mingw32/x86 [1], and ran into difficulty finding a suitable version of 
> MinGW to run it with.  Part of the problem is that Windows G++ changed 
> its C++ ABI in 4.7 [2].

LLVM+Clang 3.2rc2 Mingw32/x86 binaries were built on Windows 7
machine with fresh Minwg32 installation. Minwg32 installation
was performed using latest automated installer and default settings
"mingw-get-inst-20120426.exe"  [4]

> Through experimentation, I've determined that the LLVM binaries do not 
> run using the libraries shipped with TDM-GCC 4.5 because there is a 
> missing symbol.  They segfault with TDM-GCC 4.7, which I assume is 
> caused by the ABI change.  (Through inspection of the assembly, it 
> appears that Clang was not built with 4.7 -- the code doesn't use 
> thiscall.)  TDM-GCC 4.6 is just right, though, so perhaps that should be 
> noted somewhere.  Perhaps the filename should include something like 
> "mingw32-46" in it.

TDM-GCC 4.6 matches g++ version installed with
"mingw-get-inst-20120426.exe"  [4]
"g++ --version" reports  "g++.exe (GCC) 4.6.2"

> I had to download these three files to run LLVM binaries:
> http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%204.6%20series/4.6.1-tdm-1%20DW2/
>      gcc-4.6.1-tdm-1-dw2-core.zip
>      gcc-4.6.1-tdm-1-dw2-c++.zip
>      gcc-4.6.1-tdm-1-dw2-openmp.zip
> The openmp package is needed for pthreadGC2.dll.  It's also important to 
> use DW2.  TDM-GCC also provides SJLJ libraries that do not work with Clang.

Another solution would be to rebuild entire LLVM+Clang package using
your g++ 4.7 based  Mingw32 dev environment.

> I am wondering whether the Clang project will attempt to match MinGW's 
> new ABI.[3]  AIUI, the 4.7 breakage is not intended to be a one-time 
> event.  A stable ABI would be a nice thing.
> [1] 
> http://llvm.org/pre-releases/3.2/rc2/clang+llvm-3.2rc2-i386-mingw32-EXPERIMENTAL.tar.gz
> [2] MinGW 4.7 enabled the thiscall convention, which changes the 
> register/stack usage for all member function calls.  See 
> http://mingw-users.1079350.n2.nabble.com/MinGW-GCC-4-7-0-released-td7578133.html.
> [3] http://llvm.org/bugs/show_bug.cgi?id=12684
> -Ryan

[4] http://sourceforge.net/projects/mingw/files/


More information about the llvm-dev mailing list