Anton Korobeynikov
2006-Apr-29 07:38 UTC
[LLVMdev] Building LLVM under Mingw. Part I: tools-only
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
Anton Korobeynikov wrote:> 1.4. Bison 1.875 from GNUWin32 project > > $ bison --version > bison (GNU Bison) 1.875 >Bison 1.875 is known to have problems building LLVM. Please upgrade to a newer version (at least 1.875d). The current version is 2.1.
Anton Korobeynikov wrote:> 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") >I'd fix this, but I don't touch Unix build stuff :) I'll let Reid handle this one. I suspect he'll prefer to fix Makefile.common rather than each individual makefile. And dbghelp.lib really ought to be used. imagehlp is very, very obsolete and vanishes on 64-bit Windows. Yes, I know mingw doesn't support dbghelp. I can still rant about it :)> 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) { >Applied.> 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 > >This is what's already there. What changed?> 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 > >Applied.> 2.4 alarm()'s in Sparc backend > > Remove from lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp > all calls to alarm(). >This code no longer exists post-1.7.
Hi, The Cygwin LLVM release (OPTIMIZED_ENABLED) version triggers a bug in LD (BFD binutils) this may well be common to MinGW as well. Aaron ----- Original Message ----- From: "Anton Korobeynikov" <asl at math.spbu.ru> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> Sent: Saturday, April 29, 2006 8:38 AM Subject: [LLVMdev] Building LLVM under Mingw. Part I: tools-only> 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 > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.375 / Virus Database: 268.5.1/327 - Release Date: 28/04/2006 >