[LLVMdev] LLVM with Microsoft Visual Studio

Jeff Cohen jeffc at jolt-lang.org
Wed Mar 14 08:37:06 PDT 2007

Morten Ofstad wrote:
> I just spent an hour to get the latest CVS version and compile it with 
> VS2005 -- apart from a small problem with an outdated bison on my 
> system I ran into a few problems. First of all there seems to be some 
> dependency problem with Intrinsics.gen so the first time you build it 
> has not been generated before the first time it's included. I suspect 
> this is the same with VS2003 if you make a completely clean checkout 
> from CVS and try to build. Second, the VS2005 compiler gives an error 
> when compiling
No, even with a completely clean checkout there are no problems with VS 
2003.  Most likely, VS 2005 make a mistake converting a project file.  
As I've seen every version of VS mess up the migration of the previous 
version's files, I bet this is what happened.

Your version of bison should work now.  The newer versions have 
developed a bad habit of making semicolons optional.
> TargetInstrInfo.h:getPointerRegClass() (line 386) because the function 
> doesn't return a value (it abort()s so it's not really a problem), 
> just add this line at the end of the function:
>     return NULL; // Must return a value in order to compile with VS 2005
Fixed.  VS 2003 (and GCC) are smart enough to know abort() doesn't 
return.  Looks like a bug introduced in VS 2005.
> There's a ton of warnings, a few of which seem to be 'real' but most 
> are just noise - I don't have time to go through them, but I can mail 
> you the build logs if you're really interested.
Sure, mail it to me.  Sometimes there's a real bug hiding in there.  The 
vast bulk of the warnings are 32/64-bit portability warnings and are 
potentially real issues, especially when having LLVM cross-compile from 
one to the other (which is why I don't suppress them).  GCC doesn't seem 
capable of detecting these, so nothing stops the vast majority of LLVM 
developers from introducing more of them.
> Last there is an annoyance in that the FileParser.y custom build rule 
> doesn't find the output, so it is run every time you build. This 
> wouldn't be so bad if it was only this file, but it in turn causes 
> Intrinsics.gen to be generated every time and this causes a lot of 
> other files to be rebuilt. I hacked the dobison.cmd script so it never 
> detects bison and always copies the .cvs files to get around the bison 
> version problem, so I thought I had found the problem when I saw that 
> the .output file from bison was entered as one of the outputs of the 
> build step. But removing this from the outputs didn't help, it's still 
> executing the custom build rule every time. The strange thing is it 
> works fine for FileLexer.l.
Again, VS 2003 doesn't have this problem.
> Anyway, it was not too much trouble to get it going - I can check that 
> it works again before the 2.0 release of LLVM if you remind me to...
Thanks, that would be great :)
> m.

More information about the llvm-dev mailing list