[LLVMdev] Compiling LLVM 2.7 with Visual Studio 2010.

Tom van Dijck llvm at tomvandijck.com
Sat May 1 21:53:40 PDT 2010


Sorry for just talking to myself here, just trying to keep people in the
loop on my findings.
The problem seems to be a much larger issue with the Visual Studio 2010 C++
Compiler and not really related to clang/llvm. The following snippet of code
does *NOT *compile in 2010..

#include <vector>
int main(int argc, char* argv[])
{
    std::pair<int, void*> mypair(0, NULL);
    return 0;
}


Tom.


On Sat, May 1, 2010 at 8:57 PM, Tom van Dijck <llvm at tomvandijck.com> wrote:

> Hey,
>
> So I tried to fix these errors, and have everything compiling now... not
> too difficult, just annoying.
>
> error C2248: 'llvm::EquivalenceClasses<
>>
>> ElemTy>::ECValue::ECValue' : cannot access private member declared in
>> class 'llvm::EquivalenceClasses<ElemTy>::ECValue'    C:\Program Files
>> (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory    208
>
>
> I moved:
>
>     // ECValue ctor - Start out with EndOfList pointing to this node, Next
> is Null, isLeader = true.
>     ECValue(const ElemTy &Elt)
>       : Leader(this), Next((ECValue*)(intptr_t)1), Data(Elt) {}
>
> into the public section of the ECValue class, seemed to solve that one..
>
> ------
>
> the cast errors from below... pretty weird, but the Microsofts compiler
> seems to not like passing in 0 as a pointer into the pair<> template if that
> argument is in reality a pointer. seems weird since if (bla == 0) works
> fine, but pair<int, void*>(0,0); does not, anyway, the fix was to just cast
> that 0... so pair<int, void*>(0, (void*)0);
>
> ------
>
> Last there is a gazillion errors around the fact that Microsoft for some
> crazy stupid reason has defined setjmp to _setjmp, and thus the generated
> intrinsics.gen goes completely insane everywhere. I'm sure this is a legacy
> thing in visual studios libraries, but wow...
>
> Anyway, my solution to this was to make a 'intrinsics.gen.proxy', which
> undefs that macro and then includes the intrinsics.gen, and then all
> includes to intrinsics.gen, I modified to include the proxy. This guarantees
> that at least the Instrinsic namespace is always setup correctly... and
> you're left with a couple other files where it still seems to be defined, so
> I just undef'ed it for the whole file in those files as well...
>
> Is there any interest in these changes applied to trunk? and if so how do I
> proceed... I'm fine keeping these changes local and integrate, but I figure
> there is more users out there wanting to move to VS2010 at some point.
>
> Tom.
>
>
> On Sat, May 1, 2010 at 7:59 PM, Tom van Dijck <llvm at tomvandijck.com>wrote:
>
>> Hey,
>>
>> Downloaded the release, used CMake to create solution... building mostly
>> seems to be OK, except for a couple of compiler errors.
>>
>>
>> warning C4090: 'function' : different 'const' qualifiers
>> d:\companyone\external\llvm\source\llvm-2.7\lib\support\regengine.inc    188
>> error C2248: 'llvm::EquivalenceClasses<ElemTy>::ECValue::ECValue' : cannot
>> access private member declared in class
>> 'llvm::EquivalenceClasses<ElemTy>::ECValue'    C:\Program Files
>> (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory    208
>> error C2668: 'llvm::next' : ambiguous call to overloaded function
>> D:\CompanyOne\External\LLVM\source\llvm-2.7\lib\Transforms\Scalar\LoopStrengthReduce.cpp
>> 2820
>> error C2440: 'initializing' : cannot convert from 'int' to 'const
>> llvm::TargetRegisterClass *'    C:\Program Files (x86)\Microsoft Visual
>> Studio 10.0\VC\include\utility    163
>> error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be
>> initialized    C:\Program Files (x86)\Microsoft Visual Studio
>> 10.0\VC\include\utility    163
>>
>> it totals to 15 build errors and 2 warnings, but most of them are repeats
>> of the above 5..
>> Are these known issues? Or did I fail to set some setting?
>>
>> 3 of the errors come from usage of templates, hence the file names end up
>> somewhere in the VS SDK, I can provide more details if required though..
>>
>> Tom.
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100501/df26a9fe/attachment.html>


More information about the llvm-dev mailing list