[LLVMdev] Building LLVM under Mingw. Part I: tools-only

Anton Korobeynikov asl at math.spbu.ru
Sat Apr 29 00:38:27 PDT 2006


Hello, Everyone.

Now I have some spare time and I've decided to build LLVM on Mingw.
I've grab the latest 1.7 release (not CVS snapshot). Here are some
issues fixed during the build. Now I'm preparing gcc build. So, I
think, there will some other "parts"

1. Prerequisites

1.1 GCC 3.4.5 from mingw.org site.
$ gcc --version
gcc.exe (GCC) 3.4.5 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.2. Binutils 2.16.91 20060119 from mingw.org site.
$ ld --version
GNU ld version 2.16.91 20060119
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

1.3. GNU Make 3.79.1 taken from msys distribution.

$ make --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-msys
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-make at gnu.org>.

1.4. Bison 1.875 from GNUWin32 project

$ bison --version
bison (GNU Bison) 1.875

1.5 Flex 2.5.4 from GNUWin32 project.


2. Patching.

2.1. Libraries
Add "LIBS+= -lpsapi -limagehlp" to each makefile (AFTER
Makefile.common inclusion) building some tool (burg, tablegen, ll*),
since gcc doesn't support vcpp style #pragma's of form:
 #pragma comment(lib, "dbghelp.lib")

2.2 CopyFile
Patch lib/System/Win32/Path.inc in such way, that declaration of
CopyFile will look like:

void
CopyFile(const sys::Path &Dest, const sys::Path &Src) {

2.3 X86 stuff
Patch lib/Target/X86/X86SubTarget.cpp & X86JITInfo.cpp in such way:

X86SubTarget.cpp:
#if defined(__CYGWIN__) || defined(__MINGW32__)
    TargetType = isCygwin;
#elif defined(__APPLE__)
    TargetType = isDarwin;
#elif defined(_WIN32)
    TargetType = isWindows;
#endif

X86JITInfo.cpp:
#if defined(__CYGWIN__) || defined(__APPLE__) || defined(__MINGW32__)
    ".globl _X86CompilationCallback\n"
  "_X86CompilationCallback:\n"
#else
...
#if defined(__CYGWIN__) || defined(__APPLE__) || defined(__MINGW32__)
    "call _X86CompilationCallback2\n"
#else

2.4 alarm()'s in Sparc backend

Remove from lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp
all calls to alarm().

3. That's all

This should be enough to configure and build LLVM in tools-only mode.
Unfortunately, ld crashed while building llc, I'm currently
investigating this problem. Also, I'm working on building gcc backend.
The results will follow.

-- 
With best regards,
 Anton                          mailto:asl at math.spbu.ru

Saturday, April 29, 2006 11:20:45 AM

Faculty of Mathematics & Mechanics, Saint-Petersburg State University





More information about the llvm-dev mailing list