<div dir="ltr">You're crossing the relase/debug MSVC CRT streams. Make sure all objects in a given image are using the same CRT.<div><br></div><div>In your specific example, you should add -D_DEBUG to the command line. You want to simulate the effect of passing /MTd to cl.exe or clang-cl.exe.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 11, 2015 at 10:07 AM, Russell Wallace via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to compile some code via IR and link it with the debug libraries on Windows, but getting errors. A minimal test case:<br><div><br></div><div><div>C:\t>type a.cpp</div><div>#define _HAS_EXCEPTIONS 0</div><div>#include <llvm/Support/Signals.h></div><div><br></div><div>int main() {</div><div>  llvm::sys::PrintStackTraceOnErrorSignal();</div><div>  return 0;</div><div>}</div><div><br></div><div>C:\t>clang -I/llvm/build/include -I/llvm/include -S -emit-llvm -fms-compatibility-version=19 a.cpp</div><div><br></div><div>C:\t>clang a.ll \llvm\build\Debug\lib\*.lib</div><div>warning: overriding the module target triple with x86_64-pc-windows-msvc18.0.0 [-Woverride-module]</div><div>1 warning generated.</div><div>LLVMSupport.lib(Signals.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in a-db717b.o</div><div>LLVMSupport.lib(Signals.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in a-db717b.o</div><div>LLVMSupport.lib(Path.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in a-db717b.o</div><div>LLVMSupport.lib(Path.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in a-db717b.o</div><div>LLVMSupport.lib(raw_ostream.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in a-db717b.o</div></div><div>...etc...</div><div><br></div><div>There's probably an option that I'm missing?<br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>