[LLVMdev] Build LLVM as a DLL on Windows x86

NAKAMURA Takumi geek4civic at gmail.com
Sun Nov 13 18:57:50 PST 2011


2011/11/13 Alan Garny <agarny at hellix.com>:
> Now, I know that shared libraries are not supported on Windows using CMake
> (according to http://www.llvm.org/docs/CMake.html) which would have been my
> preferred building choice, but I didn’t see anything against them not being
> supported using Autotools, so I thought I would try it that way (as I
> successively did on Linux and Mac OS X). So, based on the documentation at
> http://www.llvm.org/docs/GettingStarted.html, I installed MinGW/MSYS
> (http://sourceforge.net/projects/mingw/), selecting C++ Compiler, MSYS Basic
> System and MinGW Developer ToolKit from the list of components to install.
> Then, I installed Python (http://www.python.org/download/; version 2.7.2 not
> 3.x) even though it’s not listed as a pre-requirement, but without it, it
> doesn’t work, so… Note that version 3.x of Python didn’t work for me, I had
> to use version 2.7.2. Otherwise, I obviously had to do something like export
> PATH=/c/Python27:$PATH to make it accessible from a shell prompt. Otherwise,
> I haven’t installed binutils since I don’t seem to need it…?

You need binutils, esp. ld, nm, objdump.

FYI, how to browse export table in DLL with objdump;
$ objdump -x XXX.dll

> As you can tell, I am not using gmake (I don’t have it, but maybe it comes
> with binutils?), but make. I imagine it shouldn’t make any difference…?
> Whatever the case, and as mentioned earlier, even though I do get a (~15MB
> big) DLL, it doesn’t contain any (exported) functions.

GNU make is essential to msys build. I guess msysdtk would have it.

> Otherwise, I tried the above building process with the trunk version of
> LLVM, but to no avail. Maybe this will be possible with the forthcoming LLVM
> 3.0…? Anyway, any help on the above would be much appreciated…

AFAIK, on msys, trunk and release_30 is almost fine.
http://bb.pgr.jp/builders/clang-i686-msys
Though, here is no builder on win32 with --enable-shared.

ps. you might need also --enable-optimized --enable-shared --enable-embed-stdcxx

HTH, ...Takumi




More information about the llvm-dev mailing list