Errors building llvm with Visual Studio in Debug mode

I'm not sure what causes this. Everything builds fine in Release mode
but when I try to do a Debug build I get an error in Transforms (which
causes all dependant projects to fail as well). I'm not exactly sure
what causes the error, I'll try to investigate tomorrow (unless
someone can figure out what it is by then). Below is the output from
VS:

------ Build started: Project: Transforms, Configuration: Debug Win32 ------
Compiling...
CorrelatedExprs.cpp
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2679: binary '<' : no operator found which takes a right-hand
operand of type '`anonymous-namespace'::Relation' (or there is no
acceptable conversion)
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1385) : see reference to function template
instantiation 'bool
std::_Debug_lt<`anonymous-namespace'::Relation,_Ty>(_Ty1,_Ty2,const
char *)' being compiled
        with
        [
            _Ty=llvm::Value *,
            _Ty1=`anonymous-namespace'::Relation,
            _Ty2=llvm::Value *
        ]
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1397) : see reference to function template
instantiation '_FwdIt std::_Lower_bound<_FwdIt,_Ty,__w64

(_FwdIt,_FwdIt,const _Ty &,_Diff *)' being compiled

        with
        [
            _FwdIt=std::_Vector_iterator<`anonymous-namespace'::Relation,std::allocator<`anonymous-namespace'::Relation>>,
            _Ty=llvm::Value *,
            _Diff=__w64 int
        ]
        c:\dev\libs\llvm\lib\Transforms\Scalar\CorrelatedExprs.cpp(137)
: see reference to function template instantiation '_FwdIt
std::lower_bound<std::_Vector_iterator<_Ty,_Alloc>,llvm::Value*>(_FwdIt,_FwdIt,llvm::Value
&)' being compiled
        with
        [
            _FwdIt=std::_Vector_iterator<`anonymous-namespace'::Relation,std::allocator<`anonymous-namespace'::Relation>>,
            _Ty=`anonymous-namespace'::Relation,
            _Alloc=std::allocator<`anonymous-namespace'::Relation>
        ]
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.40607
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at
"file://c:\dev\libs\llvm\win32\Transforms\Debug\BuildLog.htm"
Transforms - 1 error(s), 0 warning(s)
------ Build started: Project: CodeGen, Configuration: Debug Win32 ------
Compiling...
LiveInterval.cpp
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2678: binary '<' : no operator found which takes a left-hand
operand of type 'llvm::LiveRange' (or there is no acceptable
conversion)
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1449) : see reference to function template
instantiation 'bool
std::_Debug_lt<_Ty,llvm::LiveRange>(_Ty1,_Ty2,const char *)' being
compiled
        with
        [
            _Ty=unsigned int,
            _Ty1=unsigned int,
            _Ty2=llvm::LiveRange
        ]
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1461) : see reference to function template
instantiation '_FwdIt std::_Upper_bound<_FwdIt,_Ty,__w64

(_FwdIt,_FwdIt,const _Ty &,_Diff *)' being compiled

        with
        [
            _FwdIt=std::_Vector_const_iterator<llvm::LiveRange,std::allocator<llvm::LiveRange>>,
            _Ty=unsigned int,
            _Diff=__w64 int
        ]
        c:\dev\libs\llvm\lib\CodeGen\LiveInterval.cpp(36) : see
reference to function template instantiation '_FwdIt
std::upper_bound<std::_Vector_const_iterator<_Ty,_Alloc>,unsigned

(_FwdIt,_FwdIt,const unsigned int &)' being compiled

        with
        [
            _FwdIt=std::_Vector_const_iterator<llvm::LiveRange,std::allocator<llvm::LiveRange>>,
            _Ty=llvm::LiveRange,
            _Alloc=std::allocator<llvm::LiveRange>
        ]
RegAllocLinearScan.cpp
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2678: binary '<' : no operator found which takes a left-hand
operand of type 'llvm::LiveRange' (or there is no acceptable
conversion)
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1449) : see reference to function template
instantiation 'bool
std::_Debug_lt<_Ty,llvm::LiveRange>(_Ty1,_Ty2,const char *)' being
compiled
        with
        [
            _Ty=unsigned int,
            _Ty1=unsigned int,
            _Ty2=llvm::LiveRange
        ]
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1461) : see reference to function template
instantiation '_FwdIt std::_Upper_bound<_FwdIt,_Ty,__w64

(_FwdIt,_FwdIt,const _Ty &,_Diff *)' being compiled

        with
        [
            _FwdIt=llvm::LiveInterval::iterator,
            _Ty=unsigned int,
            _Diff=__w64 int
        ]
        c:\dev\libs\llvm\lib\CodeGen\RegAllocLinearScan.cpp(353) : see
reference to function template instantiation '_FwdIt
std::upper_bound<llvm::LiveInterval::iterator,unsigned

(_FwdIt,_FwdIt,const _Ty &)' being compiled

        with
        [
            _FwdIt=llvm::LiveInterval::iterator,
            _Ty=unsigned int
        ]
Generating Code...
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.40607
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at
"file://c:\dev\libs\llvm\win32\CodeGen\Debug\BuildLog.htm"
CodeGen - 2 error(s), 0 warning(s)
------ Build started: Project: x86, Configuration: Debug Win32 ------
Compiling...
X86FloatingPoint.cpp
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const
std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not
deduce template argument for 'const
std::basic_string<_Elem,_Traits,_Ax> &' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\string(148) : see declaration of 'std::operator`<''
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1385) : see reference to function template
instantiation 'bool
std::_Debug_lt<`anonymous-namespace'::TableEntry,_Ty>(_Ty1,_Ty2,const
char *)' being compiled
        with
        [
            _Ty=unsigned int,
            _Ty1=`anonymous-namespace'::TableEntry,
            _Ty2=unsigned int
        ]
        c:\Program Files\Microsoft Visual Studio
8\VC\include\algorithm(1397) : see reference to function template
instantiation '_FwdIt
std::_Lower_bound<_FwdIt,_Ty,std::iterator_traits<_Iter>::difference_type>(_FwdIt,_FwdIt,const
_Ty &,_Diff *)' being compiled
        with
        [
            _FwdIt=const `anonymous-namespace'::TableEntry *,
            _Ty=unsigned int,
            _Iter=const `anonymous-namespace'::TableEntry *,
            _Diff=std::iterator_traits<const
`anonymous-namespace'::TableEntry *>::difference_type
        ]
        c:\dev\libs\llvm\lib\Target\X86\X86FloatingPoint.cpp(293) :
see reference to function template instantiation '_FwdIt
std::lower_bound<const `anonymous-namespace'::TableEntry*,unsigned

(_FwdIt,_FwdIt,const _Ty &)' being compiled

        with
        [
            _FwdIt=const `anonymous-namespace'::TableEntry *,
            _Ty=unsigned int
        ]
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const _Elem *,const
std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce
template argument for 'const T1 *' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\string(138) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const
std::basic_string<_Elem,_Traits,_Alloc> &,const
std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce
template argument for 'const std::basic_string<_Elem,_Traits,_Ax> &'
from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\string(128) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const
std::_Tree<_Traits> &)' : could not deduce template argument for
'const std::_Tree<_Traits> &' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\xtree(1360) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc>
&,const std::vector<_Ty,_Alloc> &)' : could not deduce template
argument for 'const std::vector<_Ty,_Ax> &' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\vector(1278) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const
std::reverse_iterator<_RanIt1> &,const std::reverse_iterator<_RanIt2>
&)' : could not deduce template argument for 'const
std::reverse_iterator<_RanIt> &' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\xutility(1303) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const
std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for
'const std::pair<_Ty1,_Ty2> &' from 'unsigned int'
        c:\Program Files\Microsoft Visual Studio
8\VC\include\utility(73) : see declaration of 'std::operator`<''
c:\Program Files\Microsoft Visual Studio 8\VC\include\xutility(196) :
error C2677: binary '<' : no global operator found which takes type
'`anonymous-namespace'::TableEntry' (or there is no acceptable
conversion)
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.40607
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://c:\dev\libs\llvm\win32\x86\Debug\BuildLog.htm"
x86 - 8 error(s), 0 warning(s)

It compiles successfully with VC++ 7.1. You are apparently using VC++ 8.0, otherwise known as the Whidbey beta. The cause is no doubt due to bugs in Whidbey and this isn't the first one encountered. I'm sorry, but I cannot support beta Microsoft products (if only because I refuse to have them anywhere near my computer). All I can suggest is that you do a 'clean solution' before or after switching configurations.

Vyacheslav Akhmechet wrote:

Jeff, thanks for the reply. This looks like a bug in Whidbey's STL
implementation, not compiler per se. I'll try to build the project
tonight with STLPort, as well is build it with STLPort on 7.1.