Hi,<br><br>Using a Clang (built with GCC 4.6.3 and MinGW-w64), which uses that GCC's libstdc++, I am attempting to let it reproduce (ie build itself). This Clang is currently revision 160923, so very recent, although below problem has been present for a long time. To reproduce, you can download <a href="http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/experimental">this package</a>, which includes the necessary Clang and GCC stuff to have a working 32-bit Clang on Windows. It is an older revision, but exhibits the same problem.<br>
<br>Easiest is by using configure under MSYS (a bash environment for Windows), setting CXX=clang++. Another possibility is using attached CMake scripts (put them in share/cmake-2.8/Modules/Platform) and calling cmake with -DCMAKE_CXX_COMPILER=clang++.<br>
<br>The link error is the following:<br><br><span style="font-family:courier new,monospace">Linking CXX shared library ..\..\..\..\bin\liblibclang.dll</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Creating library file: ..\..\..\..\lib\liblibclang.dll.a</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangFrontend.a(ASTUnit.cpp.obj):fake:(.rdata$_ZTVN4llvm37CrashRecoveryContextReleaseRefCleanupIN5clang17DiagnosticsEngineEEE[vtable for llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>]+0x0): multiple definition of `vtable for llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">CMakeFiles\libclang.dir/objects.a(CIndex.cpp.obj):fake:(.data$_ZTVN4llvm37CrashRecoveryContextReleaseRefCleanupIN5clang17DiagnosticsEngineEEE[vtable for llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangFrontend.a(ASTUnit.cpp.obj):fake:(.rdata$_ZTVN4llvm31CrashRecoveryContextCleanupBaseINS_37CrashRecoveryContextReleaseRefCleanupIN5clang17DiagnosticsEngineEEES3_EE[vtable for llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>, clang::DiagnosticsEngine>]+0x0): multiple definition of `vtable for llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>, clang::DiagnosticsEngine>'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">CMakeFiles\libclang.dir/objects.a(CIndex.cpp.obj):fake:(.data$_ZTVN4llvm31CrashRecoveryContextCleanupBaseINS_37CrashRecoveryContextReleaseRefCleanupIN5clang17DiagnosticsEngineEEES3_EE[vtable for llvm::CrashRecoveryContextCleanupBase<llvm::CrashRecoveryContextReleaseRefCleanup<clang::DiagnosticsEngine>, clang::DiagnosticsEngine>]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangAST.a(AttrImpl.cpp.obj): In function `ZN5clang27X86ForceAlignArgPointerAttrD1Ev':</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">M:/Development/Source/LLVM/tools/clang/lib/AST/AttrImpl.cpp:20: multiple definition of `clang::InheritableAttr::~InheritableAttr()'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangSerialization.a(ASTReaderDecl.cpp.obj):fake:(.text$_ZN5clang15InheritableAttrD0Ev[clang::InheritableAttr::~InheritableAttr()]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangAST.a(AttrImpl.cpp.obj): In function `ZN5clang27X86ForceAlignArgPointerAttrD1Ev':</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">M:/Development/Source/LLVM/tools/clang/lib/AST/AttrImpl.cpp:20: multiple definition of `clang::InheritableParamAttr::~InheritableParamAttr()'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">..\..\..\..\lib\libclangSerialization.a(ASTReaderDecl.cpp.obj):fake:(.text$_ZN5clang20InheritableParamAttrD0Ev[clang::InheritableParamAttr::~InheritableParamAttr()]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">collect2: ld returned 1 exit status</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">clang++: error: linker (via gcc) command failed with exit code 1 (use -v to see</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">invocation)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">mingw32-make[2]: *** [bin/liblibclang.dll] Error 1</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">mingw32-make[1]: *** [tools/clang/tools/libclang/CMakeFiles/libclang.dir/all] Error 2</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">mingw32-make: *** [all] Error 2</span><br>
<br>This does not happen when building with GCC. I can upload the fies in question or info from these files if you want. I just don't know where to start looking. All files (including the AttrImpl.inc file) are identical in both builds. Could this have something to do with weak symbols, which are absent on Windows, and static+inline or something? I can't find a visual multiple definition of the InheritableAttr destructor, and vtable definitions are hard to find at best.<br>
<br>Any help is much appreciated!<br><br>Ruben<br><br>PS: please reply to me as well, I'm not subscribed to cfe-dev<br>PS2: another build failed when linking the clang executable:<br><span style="font-family:courier new,monospace">llvm[4]: Linking Release executable clang (without symbols)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">M:/Development/msys/home/Ruben/LLVm/Release/lib/libclangAST.a(AttrImpl.o):fake:(.text$_ZN5clang15InheritableAttrD0Ev+0x0): multiple definition of `clang::InheritableAttr::~InheritableAttr()'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">M:/Development/msys/home/Ruben/LLVm/Release/lib/libclangSerialization.a(ASTReaderDecl.o):fake:(.text$_ZN5clang15InheritableAttrD0Ev[clang::InheritableAttr::~InheritableAttr()]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">M:/Development/msys/home/Ruben/LLVm/Release/lib/libclangAST.a(AttrImpl.o):fake:(.text$_ZN5clang20InheritableParamAttrD0Ev+0x0): multiple definition of `clang::InheritableParamAttr::~InheritableParamAttr()'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">M:/Development/msys/home/Ruben/LLVm/Release/lib/libclangSerialization.a(ASTReaderDecl.o):fake:(.text$_ZN5clang20InheritableParamAttrD0Ev[clang::InheritableParamAttr::~InheritableParamAttr()]+0x0): first defined here</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">m:/development/mingw32-dw2/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: M:/Development/msys/home/Ruben/LLVm/Release/lib/libclangSerialization.a(ASTReaderDecl.o): bad reloc address 0x24 in section `.text$_ZN</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">5clang11DeclVisitorINS_13ASTDeclReaderEvE5VisitEPNS_4DeclE[clang::DeclVisitor<clang::ASTDeclReader, void>::Visit(clang::Decl*)]'</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">collect2: ld returned 1 exit status</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">clang++: error: linker (via gcc) command failed with exit code 1 (use -v to see</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">invocation)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">make[4]: *** [/usr/home/Ruben/LLVm/Release/bin/clang.exe] Error 1</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">make[4]: Leaving directory `/home/Ruben/LLVm/tools/clang/tools/driver'</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">make[3]: *** [all] Error 1</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">make[3]: Leaving directory `/home/Ruben/LLVm/tools/clang/tools'</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">make[2]: *** [all] Error 1</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">make[2]: Leaving directory `/home/Ruben/LLVm/tools/clang'</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">make[1]: *** [clang/.makeall] Error 2</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">make[1]: Leaving directory `/home/Ruben/LLVm/tools'</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">make: *** [all] Error 1</span><br>
<br><br>