Hello, I'm trying to use LLVM on Windows, using the MinGW toolchain that comes with Cygwin (gcc -mno-cygwin, not the standalone msys package). Has anyone successfully built LLVM from sources with this toolchain? The ./configure scripts automatically detects a Cygwin environment. I've spent some time trying to let it know that it should compile for MinGW. FWIW, here's what I've done: * CFLAGS=-mno-cygwin CXXFLAGS=-mno-cygwin ./configure ... --build=i686-pc-mingw32 --disable-threads --disable-ltdl-install * Put CFLAGS=-mno-cygwin and CXXFLAGS=-mno-cygwin in Makefile.config (I could not get the configure script to do it on its own). * In include/llvm/Config/config.h, disable HAVE_ARGZ_H and HAVE_LIBDL. * Change the Makefile that calls tblgen.exe to pass relative filenames to this tool (being compiled as a Win32 application, it cannot deal with Cygwin absolute filename like /home/...). Still, I get errors. Since I guess I'm not the first one trying to use the Cygwin's MinGW compiler, I'd prefer to ask for help before adding more hacks to the build system. Actually, I think I could live with a binary distribution compiled for MinGW. The binary package on the LLVM site (for LLVM 2.1) only contains the programs, not the compiled libraries. Can I find those libraries somewhere else? Also, at some point, I'll be interested in compiling LLVM with the Microsoft C compiler (with the command line tools, without Visual Studio). Has anyone done that before? Thanks! Alain
Hey Alain, This is what I did to try hello world on llvm: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/9644/focus=9674 Haven't looked at llvm after that.. Probably it's a good starting point. -- Sam. On Nov 28, 2007 10:57 AM, Alain Frisch <alain.frisch at lexifi.com> wrote:> Hello, > > I'm trying to use LLVM on Windows, using the MinGW toolchain that comes > with Cygwin (gcc -mno-cygwin, not the standalone msys package). Has > anyone successfully built LLVM from sources with this toolchain? > > The ./configure scripts automatically detects a Cygwin environment. I've > spent some time trying to let it know that it should compile for MinGW. > FWIW, here's what I've done: > > * CFLAGS=-mno-cygwin CXXFLAGS=-mno-cygwin ./configure ... > --build=i686-pc-mingw32 --disable-threads --disable-ltdl-install > > * Put CFLAGS=-mno-cygwin and CXXFLAGS=-mno-cygwin in Makefile.config > (I could not get the configure script to do it on its own). > > * In include/llvm/Config/config.h, disable HAVE_ARGZ_H and HAVE_LIBDL. > > * Change the Makefile that calls tblgen.exe to pass relative filenames > to this tool (being compiled as a Win32 application, it cannot deal > with Cygwin absolute filename like /home/...). > > Still, I get errors. Since I guess I'm not the first one trying to use > the Cygwin's MinGW compiler, I'd prefer to ask for help before adding > more hacks to the build system. > > Actually, I think I could live with a binary distribution compiled for > MinGW. The binary package on the LLVM site (for LLVM 2.1) only contains > the programs, not the compiled libraries. Can I find those libraries > somewhere else? > > Also, at some point, I'll be interested in compiling LLVM with the > Microsoft C compiler (with the command line tools, without Visual > Studio). Has anyone done that before? > > > Thanks! > > > Alain > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
SVN head LLVM and Clang built out of the box for me a week ago on MSYS/ MINGW, using the following files: MinGW-5.1.3.exe MSYS-1.0.10.exe msysDTK-1.0.1.exe bash-3.1-MSYS-1.0.11-1.tar.bz2 bison-2.3-MSYS-1.0.11.tar.bz2 coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 flex-2.5.33-MSYS-1.0.11.tar.bz2 gawk-3.1.5-MSYS-1.0.11-snapshot.tar.bz2 regex-0.12-MSYS-1.0.11.tar.bz2 1. install these components 2. install an SVN client 3. retrieve LLVM and Clang 4. ./configure 5. make 6. cd tools/clang 7. make I end up with an error making the driver for Clang in step 7, but the libraries all build, which is what I needed. Apart from that everything was easy. In particular I didn't need to install any special llvm gcc. Neither did I have to do that when building on Ubuntu 7.10. I don't know if that instruction is relevant any more. Antony Blakey -------------------------- CTO, Linkuistics Pty Ltd Ph: 0438 840 787 What can be done with fewer [assumptions] is done in vain with more -- William of Ockham (ca. 1285-1349)
Antony Blakey wrote:> SVN head LLVM and Clang built out of the box for me a week ago on > MSYS/MINGW, using the following files:Thanks. However, I'm specifically interested in using the MinGW compiler shipped with Cygwin (i.e. "gcc -mno-cygwin") and using Cygwin tools (make, ...). Of course, I could probably install MSYS/MinGW just to compile LLVM and produce the libraries. -- Alain
Antony Blakey wrote:> SVN head LLVM and Clang built out of the box for me a week ago on > MSYS/MINGW, using the following files:Ok, I tried to do the same. The compilations stops with the following error message (actually, I got to the same point in my attempt to build LLVM with the MinGW compiler shipped with Cygwin): llvm[1]: Compiling MachineLoopInfo.cpp for Debug build MachineLoopInfo.cpp: In instantiation of `llvm::LoopBase<BlockT>::LoopBase(const llvm::LoopBase<BlockT>&) [with BlockT = llvm::MachineBasicBlock]': MachineLoopInfo.cpp:22: instantiated from here MachineLoopInfo.cpp:22: error: explicit instantiation of `llvm::LoopBase<BlockT>::LoopBase(const llvm::LoopBase<BlockT>&) [with BlockT = llvm::MachineBasicBlock]' but no definition available MachineLoopInfo.cpp: In instantiation of `const llvm::LoopBase<BlockT>& llvm::LoopBase<BlockT>::operator=(const llvm::LoopBase<BlockT>&) [with BlockT = llvm::MachineBasicBlock]': ..... ..... What's wrong? I know too little about C++ to understand the problem. Thanks! Alain
Alain,> Thanks. However, I'm specifically interested in using the MinGW compiler > shipped with Cygwin (i.e. "gcc -mno-cygwin") and using Cygwin tools > (make, ...). Of course, I could probably install MSYS/MinGW just to > compile LLVM and produce the libraries.The short answer is: don't use cygwin shell with mingw compiler to build LLVM. Reason actually is: LLVM uses tablgen in it's build process. Tablegen is compiled with mingw for you, thus it won't work in cygwin shell without some extra hacks. There are two possibilities: 1. Use the hack used to cross-compilation of LLVM. In this case you'll need cygwin-built tablgen. However, this won't work out-of-the-box, because both tablegens will share the same extension. This process is described in http://llvm.org/docs/GettingStarted.html#cross-compile 2. Feed all the paths to tablegen via cygdrive program. In this case you'll need to tweak build system in several places: - Detect, if you're really building mingw-on-cygwin - Detect, where cygpath is located - Feed paths provided to tablegen via cygdrive There probably is possibility, that paths in some other places need to be handled in the same fashion. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.