llvm.org GIT mirror llvm / abb1b58
Removed information about compiling the GCC front end. This will be in a separate document that we will provide to people who request the source. Updated the support architecture information to be a little more precise. Added hyperlinks for all of the tools which are required for building LLVM. This should make it easier for people to find and install these required tools. Italicized some of the "variables" that we use in place of absolute paths. Added the --enable-spec2000 option to the quick start section. Other minor changes/corrections/clarifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9006 91177308-0d34-0410-b5e6-96231b3b80d8 John Criswell 16 years ago
1 changed file(s) with 60 addition(s) and 149 deletion(s). Raw diff Collapse all Expand all
2626
2727
2828
  • Getting Started Quickly (A Summary)
  • 29
  • Getting started with LLVM
  • 29
  • Getting Started with LLVM
  • 3030
    3131
  • Terminology and Notation
  • 3232
  • Setting Up Your Environment
  • 3333
  • Unpacking the LLVM Archives
  • 3434
  • Checkout LLVM from CVS
  • 35
  • Install the C Front End
  • 35
  • Install the GCC Front End
  • 3636
  • Local LLVM Configuration
  • 3737
  • Compiling the LLVM Suite Source Code
  • 3838
  • The Location of LLVM Object Files
  • 4242
  • CVS directories
  • 4343
  • llvm/include
  • 4444
  • llvm/lib
  • 45
  • llvm/runtime
  • 4546
  • llvm/test
  • 4647
  • llvm/tools
  • 4748
  • llvm/utils
  • 4849
    49
  • Compiling the LLVM GCC Front End
  • 5050
  • An Example Using the LLVM Tool Chain
  • 5151
  • Common Problems
  • 5252
  • Links
  • 8888
    8989 LLVM is known to work on the following platforms:
    9090
    91
  • Linux on x86
  • 91
  • Linux on x86 (Pentium and above)
  • 9292
    9393
  • Approximately 760 MB of Free Disk Space
  • 9494
    111111
    112112
    113113
    114

    115 If you want to compile your own version of the GCC front end, you will need
    116 additional disk space:
    117

    118
    119
    120
  • Linux on x86
  • 121
    122
  • Approximately 249 MB of Free Disk Space
  • 123
    124
  • Source code: 146 MB
  • 125
  • Object code: 82 MB
  • 126
  • Installed binaries: 21 MB
  • 127
    128
    129
    130

    131
    132
  • Solaris on Sparc
  • 133
    134
  • Approximately 264 MB of Free Disk Space
  • 135
    136
  • Source code: 146 MB
  • 137
  • Object code: 93 MB
  • 138
  • Installed binaries: 25 MB
  • 139
    140
    141
    142
    143

    144114 LLVM may compile on other platforms. The LLVM utilities should work
    145115 on other platforms, so it should be possible to generate and produce LLVM
    146116 bytecode on unsupported platforms (although bytecode generated on one
    155125
    156126 Unpacking the distribution requires the following tools:
    157127
    158
    GNU Zip (gzip)
    159
    GNU Tar
    128
    129 GNU Zip (gzip)
    130
    GNU Tar
    160131
    161132 These tools are needed to uncompress and unarchive the software.
    162133 Regular Solaris tar may work for unpacking the TAR archive but
    167138 installed:
    168139
    169140
    170
    GCC
    141
    GCC
    171142
    172143 The GNU Compiler Collection must be installed with C and C++ language
    173144 support. GCC 3.2.x works, and GCC 3.x is generally supported.
    176147 Note that we currently do not support any other C++ compiler.
    177148

    178149
    179
    GNU Make
    150
    GNU Make
    180151
    181152 The LLVM build system relies upon GNU Make extensions. Therefore, you
    182153 will need GNU Make (sometimes known as gmake) to build LLVM.
    183154

    184155
    185
    Flex and Bison
    156
    Flex
    157 and
    158 Bison
    186159
    187160 The LLVM source code is built using flex and bison. You will not be
    188161 able to configure and compile LLVM without them.
    189162

    190163
    191
    GNU M4
    164
    GNU M4
    192165
    193166 If you are installing Bison on your machine for the first time, you
    194167 will need GNU M4 (version 1.4 or higher).
    200173

    201174
    202175
    203
  • GNU Autoconf
  • 204
  • GNU M4
  • 176
  • GNU Autoconf
  • 177
  • GNU M4
  • 205178

    206179 If you want to make changes to the configure scripts, you will need
    207180 GNU autoconf (2.53 or higher), and consequently, GNU M4 (version 1.4
    208181 or higher).
    209182

    183
    184
  • QMTest
  • 185
  • Python
  • 186

    187 In order to run the tests in the LLVM test suite, you will need QMTest and
    188 a version of the Python interpreter that works with QMTest.
    210189
    211190
    212191
    214193 LLVM and to give you some basic information about the LLVM environment.
    215194 The next section gives a short summary for those
    216195 who are already familiar with the system and want to get started as quickly
    217 as possible. A more complete description is provided after that.
    196 as possible. A complete guide to installation is
    197 provided in the subsequent section.
    218198
    219199

    The later sections of this guide describe the

    220200 href="#layout">general layout of the the LLVM source-tree, a
    274254
  • --with-llvmgccdir=directory
  • 275255
    276256 Specify where the LLVM GCC frontend is installed.
    257

    258
    259
  • --enable-spec2000=directory
  • 260
    261 Enable the SPEC2000 benchmarks for testing. The SPEC2000
    262 benchmarks should be available in directory.
    277263
    278264
    279265
    294280 simplify working with the LLVM front-end and compiled tools. See the
    295281 next section for other useful details in working with LLVM,
    296282 or go straight to Program Layout to learn about the
    297 layout of the source code tree. For information on building the GCC front
    298 end yourself, see Compiling the LLVM GCC Front End for
    299 information.
    283 layout of the source code tree.
    300284
    301285
    302286
    339323
    340324 This is the where the LLVM GCC Front End is installed.
    341325

    342 For the pre-built GCC front end binaries, the LLVMGCCDIR is the
    326 For the pre-built GCC front end binaries, the LLVMGCCDIR is
    343327 cfrontend/platform/llvm-gcc.
    344
    345
    GCCSRC
    346
    347 This is the location of the LLVM GCC front end source code (used
    348 only if the LLVM GCC front end is being compiled).
    349

    350
    351
    GCCOBJ
    352
    353 This is the location of the LLVM GCC front end object code (used
    354 only if the LLVM GCC front end is being compiled). It can be
    355 safely removed once the LLVM GCC front end is built and installed.
    356328
    357329
    358330
    372344 libraries that it will need for compilation.
    373345

    374346
    375
    alias llvmgcc LLVMGCCDIR/bin/llvm-gcc
    376
    alias llvmg++ LLVMGCCDIR/bin/llvm-g++
    347
    alias llvmgcc LLVMGCCDIR/llvm-gcc/bin/gcc
    348
    alias llvmg++ LLVMGCCDIR/llvm-gcc/bin/g++
    377349
    378350 This alias allows you to use the LLVM C and C++ front ends without putting
    379351 them in your PATH or typing in their complete pathnames.
    385357
    386358

    387359 If you have the LLVM distribution, you will need to unpack it before you
    388 can begin to compile it. LLVM is distributed as a set of four files. Each
    360 can begin to compile it. LLVM is distributed as a set of three files. Each
    389361 file is a TAR archive that is compressed with the gzip program.
    390362

    391363
    392

    The four files are as follows:

    364

    The three files are as follows:

    393365
    394366
    llvm.tar.gz
    395367
    This is the source code to the LLVM suite.
    401373
    402374
    cfrontend.x86.tar.gz
    403375
    This is the binary release of the GCC front end for Linux/x86.
    404

    405
    406
    cfrontend-src.tar.gz
    407
    This is the source code release of the GCC front end.
    408

    409376
    410377
    411378
    426393
    427394

    428395 Note that the GCC front end is not included in the CVS repository. You
    429 should have either downloaded the source, or better yet, downloaded the
    430 binary distribution for your platform.
    396 should have downloaded the binary distribution for your platform.
    431397

    432398
    433399
    456422

    Once checked out from the CVS repository, the LLVM suite source code

    457423 must be configured via the configure script. This script sets
    458424 variables in llvm/Makefile.config and
    459 llvm/include/Config/config.h. It also populates OBJ_ROOT with
    425 llvm/include/Config/config.h. It also populates OBJ_ROOT with
    460426 the Makefiles needed to build LLVM.
    461427
    462428

    476442 CC
    477443
    478444 Tells configure which C compiler to use. By default,
    479 configure will look for the first GCC compiler in
    445 configure will look for the first GCC C compiler in
    480446 PATH. Use this variable to override
    481447 configure's default behavior.
    482448
    486452 CXX
    487453
    488454 Tells configure which C++ compiler to use. By default,
    489 configure will look for the first GCC compiler in
    455 configure will look for the first GCC C++ compiler in
    490456 PATH. Use this variable to override
    491457 configure's default behavior.
    492458
    519485
    --enable-spec2000=<directory>
    520486
    521487 Enable the use of SPEC2000 when testing LLVM. This is disabled by default
    522 (unless configure find SPEC2000 installed). By specifying
    488 (unless configure finds SPEC2000 installed). By specifying
    523489 directory, you can tell configure where to find the SPEC2000
    524 benchmarks. If directory is left unspecified, it
    525 configure uses a default value for our internal
    526 installation of SPEC2000.
    490 benchmarks. If directory is left unspecified, configure
    491 uses the default value
    492 /home/vadve/shared/benchmarks/speccpu2000/benchspec.
    527493
    528494
    529495

    534500 cd OBJ_ROOT
    535501

    536502
    537
  • Run the configure script located in the LLVM source tree:
  • 503
  • Run the >configure script located in the LLVM source tree:
  • 538504
    539505 SRC_ROOT/configure
    540506

    546512 This environment variable is used to locate "system" libraries like
    547513 "-lc" and "-lm" when linking. This variable should be set
    548514 to the absolute path for the bytecode-libs subdirectory of the GCC front end
    549 install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might
    515 install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might
    550516 set LLVM_LIB_SEARCH_PATH to
    551517 /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86
    552 version of the C front-end on our research machines.

    518 version of the GCC front end on our research machines.

    553519
    554520
    555521

    Compiling the LLVM Suite Source Code

    562528
    Debug Builds
    563529
    564530 These builds are the default when one types gmake (unless the
    565 --enable-optimized option was used during configuration). They
    566 compile the tools and libraries with debugging information.
    531 --enable-optimized option was used during configuration). The
    532 build system will compile the tools and libraries with debugging
    533 information.
    567534

    568535
    569536
    Release (Optimized) Builds
    570537
    571538 These builds are enabled with the --enable-optimized option to
    572539 configure or by specifying ENABLE_OPTIMIZED=1 on the
    573 gmake command line. They compile the tools and libraries with GCC
    574 optimizer flags on and strip debugging information from the libraries
    575 and executables it generates.
    540 gmake command line. For these builds, the build system will
    541 compile the tools and libraries with GCC optimizations enabled and strip
    542 debugging information from the libraries and executables it generates.
    576543

    577544
    578545
    Profile Builds
    583550 on the gmake command line.
    584551
    585552
    586 Once you have LLVM configured, you can build it by entering the OBJ_ROOT
    587 directory and issuing the following command:
    553 Once you have LLVM configured, you can build it by entering the
    554 OBJ_ROOT directory and issuing the following command:
    588555

    589556 gmake
    590557
    745712
  • llvm/include/Support - This directory contains generic
  • 746713 support libraries that are independent of LLVM, but are used by LLVM.
    747714 For example, some C++ STL utilities and a Command Line option processing
    748 library.
    715 library store their header files here.
    749716
    750717
  • llvm/include/Config - This directory contains header files
  • 751718 configured by the configure script. They wrap "standard" UNIX
    752719 and C header files. Source code can include these header files which
    753 automatically take care of the conditional #includes that the configure
    754 script generates.
    720 automatically take care of the conditional #includes that the
    721 configure script generates.
    755722
    756723
    757724
    759726
    760727
    761728 This directory contains most of the source files of the LLVM system. In
    762 LLVM almost all
    729 LLVM, almost all
    763730 code exists in libraries, making it very easy to share code among the
    764731 different tools.

    765732
    896863
    897864
    gccld
    gccld links together several LLVM
    898865 bytecode files into one bytecode file and does some optimization. It is
    899 the linker invoked by the gcc frontend when multiple .o files need to be
    900 linked together. Like gccas the command line interface of
    866 the linker invoked by the GCC frontend when multiple .o files need to be
    867 linked together. Like gccas, the command line interface of
    901868 gccld is designed to match the system linker, to aid
    902869 interfacing with the GCC frontend.

    903870
    979946
    980947
    981948
    982

    Compiling the LLVM GCC Front End

    983
    984
    985
    986

    987
    988 This step is optional if you have the GCC front end binary distribution for
    989 your platform.
    990
    991

    992
    993 Now that you have the LLVM suite built, you can build the GCC front end. For
    994 those of you that have built GCC before, the process is very similar.
    995

    996 Be forewarned, though: the build system for the GCC front end is not as
    997 polished as the rest of the LLVM code, so there will be many warnings and
    998 errors that you will need to ignore for now:
    999
    1000
    1001
  • Ensure that OBJ_ROOT/llvm/tools/Debug is at the
  • 1002 end of your PATH environment variable. The front end
    1003 build needs to know where to find the LLVM tools, but you want to
    1004 ensure that these tools are not found before the system assembler and
    1005 linker that you normally use for compilation.
    1006
    1007
  • cd GCCOBJ
  • 1008
    1009
  • Configure the source code:
  • 1010
    1011
  • On Linux/x86, use
  • 1012
    1013
  • GCCSRC/configure --prefix=LLVMGCCDIR
  • 1014 --enable-languages=c
    1015
    1016
    1017
  • On Solaris/Sparc, use
  • 1018
    1019
  • GCCSRC/configure --prefix=LLVMGCCDIR
  • 1020 --enable-languages=c --target=sparcv9-sun-solaris2
    1021
    1022
    1023
    1024
  • gmake
  • 1025
    1026
  • The build will eventually fail. Don't worry; chances are good that
  • 1027 everything that needed to build is built.
    1028
    1029
  • gmake -k install
  • 1030
    1031
    1032

    1033 Once this is done, you should have a built front end compiler in
    1034 LLVMGCCDIR.
    1035

    1036
    1037
    1038949

    1039950
    An Example Using the LLVM Tool Chain
    1040951