Minor correction to the Visual Studio documentation

Hi again,

The Visual Studio getting started guide (http://llvm.org/docs/GettingStartedVS.html) mentions the “llvm-lit” tool, but fails to mention these things:

  1. Either you need to run it from bash or a similar Unix shell, as Windows does not recognize the extensionless Python script that it is.
  2. Alternatively, you can invoke it using Python like this: python bin/llvm-lit test

I know that the documentation says that I am to install GnuWin32 tools, but I strongly oppose that idea. We Windows people have our own tools and practices and I think the LLVM developers should open up to a more multi-platform approach than the current (Unix then, perhaps maybe, Windows) approach. CMake works brilliantly, though, so there are no issues in building neither the win32 or win64 versions of LLVM.

As far as I can tell, I don’t need the GnuWin32 tools at all. I can succesfully build and link a tiny “hello world” sample program without problems. I do have many Windows ports of Unix tools in my standard path, though, and perhaps that is the reason that the build succeds without GnuWin32.

If I can help, please let me know. My angle to LLVM is this: I need a portable, multi-targeting code generator and optimizer, and I happen to prefer Windows as my platform. So, perhaps I can write or update some documentation on how to use LLVM on Windows.

Sincerely,
Mikael Lyngvig

Hi Mikael,

I know that the documentation says that I am to install GnuWin32 tools, but I
strongly oppose that idea. We Windows people have our own tools and practices
and I think the LLVM developers should open up to a more multi-platform approach
than the current (Unix then, perhaps maybe, Windows) approach.

the problem is that very few LLVM developers use or know anything about Windows.
The only way for this to change is for people who do know and care about Windows
to step forward, work on improving Windows support, and contribute their Windows
viewpoint to design discussions etc.

Ciao, Duncan.

To get windows to execute python scripts without the extension, add .PY to the PATHEXT environmental variable. Even though I grew up programming DOS and then windows, I personally quite like GnuWin32 as the windows command line is generally lacking.

I checkout LLVM and clang from SVN, then use CMake to generate project files for Visual Studio 2010 (I started with 2008). The LLVM project compiles successfully and gives me all the tools including Clang. For a few tests, I compile C++ code with Clang which if I need to I link, I use MinGW’s ld passing all the relevant object files and libraries including correctly ordering the start-up code and such.

My project is C++ language front end using a CMake build script to generate a Visual Studio 2010 project. Within the CMake build script I specify each individual library I need to link against in the correct order.

LLVM is written in C++ so it is the de facto interface. >From what I understand the C bindings are not complete, but they are quite usable.

this is the library section of my CMake build script for the final executable:

${PLATFORM_LIBS}

#LLVMX86Disassembler
#LLVMX86AsmParser
LLVMX86AsmPrinter
LLVMX86CodeGen
LLVMX86Utils
LLVMX86Desc
LLVMX86Info

LLVMSelectionDAG

LLVMAsmPrinter

#LLVMJIT
#LLVMExecutionEngine

LLVMCodeGen
LLVMScalarOpts
LLVMTransformUtils

#LLVMipa
LLVMAnalysis
LLVMTarget

LLVMMCParser
LLVMMC

LLVMCore
LLVMSupport

It took me a little while to get the ordering right the first time, but it has been pretty stable since then.

Now I recall what the problem was that I had: My code makes use of the Win32 API and that means pulling in Windows.h, which again pulls in some headers that make use of the force_inline thingy, which is not supported under Windows yet.

I guess if I stuck with portable code, I could probably use Clang for Windows. Once again, I have to visit the thinking box and figure out what to do.

But thanks for the description of how to do this. It is surely going to save both me and others a lot of time.

2012/5/25 Nathan Jeffords <blunted2night@gmail.com>

Hello Mikael,

Now I recall what the problem was that I had: My code makes use of the Win32
API and that means pulling in Windows.h, which again pulls in some headers
that make use of the force_inline thingy, which is not supported under
Windows yet.

Or you can use windows.h from mingw :slight_smile:

Yes, thank you! I didn’t think of that.

2012/5/25 Anton Korobeynikov <anton@korobeynikov.info>

Gnuwin32 is required, for now, when you run tests (check, check-all,
clang-test).
Then, you would not need to update your %PATH% to specify
LLVM_LIT_TOOLS_DIR to CMake.

Let me know if you know other (llvm|clang)-tests-compatible tools
other than gnuwin32 (and msys).

FYI, some clang/llvm tests are marked as "REQUIRES: shell". They rely
on sh behavior and they are skipped if bash.exe is not found in your
%PATH%.

I most politely retract my statement about GnuWin32. I can see now, that I’ve some experience in building LLVM, that it is mandatory. So be it :slight_smile:

However, I have been playing around with the idea of making stand-alone .NET tools to replace the GNU tools. But that approach only works on a small, limited number of platforms and .NET programs aren’t exactly known to be overly fast. So I kneel before GnuWin32 :slight_smile:

The only other set of tools I know for this purpose are the UnxUtils package, but I don’t think it is being maintained actively anymore. So it is probably not usable. And, again, I spoke too early, knowing too little about the whole ordeal.

Cheers,
Mikael

– Love Thy Frog!

2012/5/27 NAKAMURA Takumi <geek4civic@gmail.com>