[LLVMdev] Build LLVM as a DLL on Windows x86

Alan Garny agarny at hellix.com
Mon Nov 14 02:31:53 PST 2011


Hi Takumi,

> > 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

Ok, I got the latest version of binutils from
http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/.

> > 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.

I could find a copy of msysDTK at
http://sourceforge.net/projects/mingw/files/Other/Unsupported/MSYS/msysDTK/,
but not only is the 'latest' version a very old version (2003!), but once
installed I couldn't find a copy of gmake in 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

Ok, starting from my original setup (i.e. MinGW/MSYS and Python), I added
binutils (http://sourceforge.net/projects/mingw/files/MinGW/Base/binutils/),
but not gmake (since I couldn't find it). From there, I built a shared
version of LLVM using configure with --disable-docs --enable-embed-stdcxx
--enable-optimized --enable-shared --enable-targets=host.

Note that according to configure --help, --enable-optimized shouldn't be
required since optimization is enabled by default. The same for embedding
libstdc++. Still, I thought I would give it a try and see how it goes.
Anyway, the bottom line is that I got the usually 'big' DLL file, but...
still no exported symbols (according to DLL Export Viewer;
http://www.nirsoft.net/utils/dll_export_viewer.html). objdump reported more
information though (including, possibly, some exported functions).

Anyway, I tried to use the resulting DLL in my (Qt-MinGW based) application,
but to no avail... So, kind of back to square one, sorry... :(

I wish the documentation on how to build a shared version of LLVM on Windows
was up-to-date (e.g. the need for Python is not mentioned) and links to
where to get prerequisites mentioned. I would be happy to help with this,
but I would first need to be able to build LLVM... Otherwise, it would be
nice, too, to have CMake to fully work with LLVM... :)

Alan




More information about the llvm-dev mailing list