[LLVMdev] Starting with LLVM-GCC on Cygwin

John Criswell criswell at cs.uiuc.edu
Tue Oct 5 07:01:36 PDT 2004


Alex Vinokur wrote:
> Hi,
> 
> I would like to use LLVM-GCC to compare its performance with other compilers.
> Something like testsuite "Computing very large Fibonacci numbers" at
> http://article.gmane.org/gmane.comp.lang.c%2B%2B.perfometer/37.
> 
> 
> My environment:
> -----------------
> Windows 2000
> Cygwin
> $ uname -srom
> CYGWIN_NT-5.0 1.5.11(0.116/4/2) i686 Cygwin
> -----------------
> 
> What do I have to download from
> http://sourceforge.net/project/showfiles.php?group_id=119938&package_id=130753&release_id=270245:
> * executables(?) cfrontend-1.3.i386-unknown-freebsd5.2.1.tar.gz ?
> * sources cfrontend-1.3.source.tar.gz ?

You will need to download both the LLVM sources (llvm-1.3.tar.gz) and 
the LLVM-GCC sources (cfrontend-1.3.source.tar.gz).

The LLVM sources always have to be built (we don't distribute binary 
verisons of these).  You will have to build the LLVM GCC frontend on 
Cygwin since we don't have binaries for these (unless Cygwin supports 
FreeBSD emulation, the FreeBSD binaries won't work).

I don't know if LLVM 1.3 will work on Cygwin.  If not, you can get the 
latest llvm-gcc and llvm sources from our CVS repository; I know there 
is at least partial support for Cygwin in the latest sources.  Please 
see http://llvm.cs.uiuc.edu/docs/GettingStarted.html#checkout for more 
information.

> 
> 1. Question about executables.
> -------------------------------
> After gunzip
> * cfrontend-1.3.i386-unknown-freebsd5.2.1.tar.gz
>   and
> * tar -xf cfrontend-1.3.i386-unknown-freebsd5.2.1.tar
> I see that cfrontend/x86/llvm-gcc/bin contains the following files:
> 
> c++
> cpp
> g++
> gcc
> gccbug
> gcov
> i386-unknown-freebsd5.2.1-c++
> i386-unknown-freebsd5.2.1-g++
> i386-unknown-freebsd5.2.1-gcc
> i386-unknown-freebsd5.2.1-gcc-3.4-llvm
> 
> Are they executables?
> 
> Which of them should I use on Cygwin?

Well, you shouldn't use any of these, as the FreeBSD binaries probably 
won't work on Cygwin.

But, once you build the llvm-gcc frontend, you'll get a very similar 
directory tree.  To compile programs, you'll use the c++, g++, and gcc 
binaries listed above. I believe the programs with the 
"i386-unknown-freebsd..." prefix are just there in case you've got a 
cross compiling environment.

> 
> 
> 2. Question about sources.
> --------------------------
> http://llvm.cs.uiuc.edu/docs/CFEBuildInstrs.html#cygwin contains the following instruction:
> Configure and build the LLVM libraries and tools using:
>  % cd llvm
>  % ./configure [options...]
>  % gmake tools-only
> 
> 2.1. Which options should I use with  ./configure [options...]?

The only option you will probably need is --with-llvmgccdir, which will 
tell the LLVM sources where the LLVM GCC files will eventually be 
located (they won't be there when you start, because you have to build 
LLVM before LLVM-GCC).

The build process is a little inconvenient, but here's the gist of it:

o) Build LLVM tools (i.e. configure llvm and do "make tools-only").
o) Build the LLVM GCC frontend.
o) Go back into the LLVM sources, build the runtime libraries, and 
install them.
o) Set the LLVM_LIB_SEARCH_PATH variable so that the LLVM tools can find 
the libraries.

Please see our documentation 
(http://llvm.cs.uiuc.edu/docs/GettingStarted.html) and 
(http://llvm.cs.uiuc.edu/docs/CFEBuildInstrs.html) for all the details. 
  I highly recommend that you follow them as exactly as you can; missing 
one detail can mean the difference between a successful build and a very 
confusing build that doesn't work.

> 
> 2.2. Cygwin doesn't have gmake:
> $ which gmake
> gmake: Command not found.
> 
> Could I use make?

On Cygwin, your make program is most likely GNU Make.  Type:

make --version

... and if you get something like this:

GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.

... then your "make" program is actually "GNU Make" and will work just fine.


If you run into any more trouble, please let us know.  We'll do what we 
can to help.

-- John T.

-- 
*********************************************************************
* John T. Criswell                         Email: criswell at uiuc.edu *
* Research Programmer                                               *
* University of Illinois at Urbana-Champaign                        *
*                                                                   *
* "It's today!" said Piglet. "My favorite day," said Pooh.          *
*********************************************************************





More information about the llvm-dev mailing list