Testing clang using Visual Studio on Windows


I'm new to clang - just downloaded everything today. I have GnuWin32 installed and defined in the configuration and Python 3.2 installed and in the path. I was able to create the VS2010 solution using CMake and then build the ALL_BUILD project with no errors.

In the "Hacking on clang" document there is a section on how to test using Visual Studio on windows. (http://clang.llvm.org/hacking.html#testingWindows) When I attempt to follow those directions I receive the following error:

1>------ Build started: Project: clang-test, Configuration: Debug Win32 ------
1> Running Clang regression tests
1> Traceback (most recent call last):
1> File "C:/Projects/Sandbox/LLVM/LLVM/utils/lit/lit.py", line 4, in <module>
1> import lit
1> File "C:\Projects\Sandbox\LLVM\LLVM\utils\lit\lit\__init__.py", line 3, in <module>
1> from main import main
1> ImportError: No module named main
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.

I suspect something is not configured correctly regarding my python install, but don't know what it is. I did try version 2.7.1 also with the same result. I also tried to use the command line instead of the Visual Studio with the same result:

C:\Projects\Sandbox\LLVM\LLVM>python utils/lit/lit.py -sv --no-progress-bar tools/clang/test --param=build_config=Debug
Traceback (most recent call last):
  File "utils/lit/lit.py", line 4, in <module>
    import lit
  File "C:\Projects\Sandbox\LLVM\LLVM\utils\lit\lit\__init__.py", line 3, in <module>
    from main import main
ImportError: No module named main

Any ideas would be appreciated.



This really should work.

Something wrong, but I don't know what. Look like a python problem,
you really need 2.7 and not 3.2.
Make sure it is Python 2.7 that is in your PATH environment. If python
2.7 and python 3.2 are both installed on your computer it is possible
that 3.2 is picked up. How about you check your PATH to be sure 2.7 is
used or you can uninstall Python 3.2 to be sure.

Thanks for the reply. I figured out part of the issue but have run into a couple more issues. First the list.py could not find the site specific config files. I fixed that (see explanation in next paragraph) but now it is "unable to find 'build_mode' parameter." I suspect both issues are related.

I think it comes down to having followed the advice of the article "Building LLVM with CMake" (http://llvm.org/docs/CMake.html). The article says "It is not supported to build LLVM on the source directory" and recommends creating a separate directory. Directing CMake to a build directory places the lit.site.cfg files (and possibly others?) in the build directory tree rather than the source directory tree. My question is: should I run CMake from a separate build directory or from the LLVM source root directory? If I use a build directory, in addition to the lit.site.cfg files, what should I copy from the build directory tree to the source directory tree for testing?