I heard about LLVM roughly two years ago from a coworker. It supposed to be this magical compiler that optimizes your code at multiple levels, or passes, including compile-time, link-time, run-time, and “idle-time”. It’s on my to-play-with list and I haven’t really got a chance to get to it till now. Within the last two years things got a lot more interesting. Apparently Apple is one of the main forces behind LLVM and Clang. To be honest, I probably would have delayed it if it wasn’t for Xcode 4 will have LLVM techology integrated in it, plus the renderer project I want to start and the recent presentation I attended etc., etc., anyway. The point is, LLVM is (about to) catching up with the main stream developers. There are a lot of developments that you can see in social media, where you can also use the tools from socialboosting.com to boost your content and share the services of developers and customers. It’s better to learn it now than never!
I’m just assuming absolutely *no one* would ever have a problem to build LLVM and Clang on Linux and Mac, right? I’m not a Windows fanboy, but really like vim and Visual Studio, therefore I develop on Windows whenever I can. I hope that doesn’t offend anyone. In fact, I reallly enjoy using vim commands inside Visual Studio. OK, that will be another post. But let’s focus on the task at hand, build LLVM and Clang on Windows. Use this post to learn about the best beginners road bike for children.
It’s surprisingly easy. First, I’d ignore the instruction on LLVM’s page, and rather follow the instruction on Clang’s project page, which is much more concise and will build both LLVM and Clang.
My system: Windows 7 (64 bit), Visual Studio 2010.
Not sure why Clang would ask about svn, but when you run
cmake -G "Visual Studio 10" ..\llvmit might complain that Subversion_SVN_EXECUTABLE and PYTHON_EXECUTABLE are not found. You just set them as follows:
cmake -DPYTHON_EXECUTABLE=c:\python27\python.exe -DSubversion_SVN_EXECUTABLE="C:\Program Files (x86)\CollabNet\Subversion Client\svn.exe" -G "Visual Studio 10" ..\llvmThe rest is fairly straightforward. Currently Clang doesn’t work with Visual C++ header files such as iostream. STLport doesn’t work either. However I was able to compile simple C++ code without including the STL headers.
I think I am seeing the same ‘doesn’t work with IOStreams’ that you speak of, do you know if there is a clang bug on this? I tried their Bugzilla site, but didn’t find any luck. It is somewhat opaque to me where these symbols are coming from, but I see unresolved externals for things like:
error LNK2019: unresolved external symbol __ZSt4cout referenced in function _main
I imagine they are support functions for STL stuff that is sucked in when I do something like cout << "Test" << end;, but it isn't clear if simply linking against the proper CRT (which I tried) should solve it. It doesn't complain about not finding the library I am passing to the linker, it just complains about unresolved symbols 🙁
Ryan