X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FCFEBuildInstrs.html;h=86d239659de967d426903a690608e0a36c154bf9;hb=714b69d0479e0fab36195e36da4578742ed4b63d;hp=5f2ed6f987497954f8eb8e45d7e1178bd4888a26;hpb=7911ce2578fd143f37ef4de7aa3e5795c18df4a6;p=oota-llvm.git diff --git a/docs/CFEBuildInstrs.html b/docs/CFEBuildInstrs.html index 5f2ed6f9874..86d239659de 100644 --- a/docs/CFEBuildInstrs.html +++ b/docs/CFEBuildInstrs.html @@ -14,12 +14,18 @@
  1. A Cautionary Note -
  2. Instructions -
  3. License Information + +
  4. +
  5. Instructions
  6. +
  7. License Information
-

Written by Brian R. Gaeke

+

Written by Brian R. Gaeke and + Chris Lattner

@@ -39,13 +45,51 @@ process, and you should only try to do it if:

  1. you really, really, really can't use the binaries we distribute
  2. -
  3. you need GCC to fix some of the header files on your system
  4. you are an elite GCC hacker.

We welcome patches to help make this process simpler.

+ +
+ Building under Cygwin +
+ + +
+

If you are building LLVM and the GCC front-end under Cygwin, please note that +the LLVM and GCC makefiles do not correctly handle spaces in paths. To deal +with this issue, make sure that your LLVM and GCC source and build trees are +located in a top-level directory (like /cygdrive/c/llvm and +/cygdrive/c/llvm-cfrontend), not in a directory that contains a space +(which includes your "home directory", because it lives under the "Documents +and Settings" directory). We welcome patches to fix this issue. +

+

It has been found that the GCC 3.3.3 compiler provided with recent Cygwin +versions is incapable of compiling the LLVM CFE correctly. If your Cygwin +installation includes GCC 3.3.3 we strongly recommend that you download +GCC 3.4.3, build it separately, and use it for compiling LLVM CFE. This has been +shown to work correctly.

+

Some versions of Cygwin utilize an experimental version of GNU binutils that +will cause the GNU ld linker to fail an assertion when linking +components of the libstdc++. It is recommended that you replace the entire +binutils package with version 2.15 such that "ld --version" responds +with
+

GNU ld version 2.15
+not with:
+
GNU ld version 2.15.91 20040725
+

+ + +
Building under AIX
+
+

If you are building LLVM and the GCC front-end under AIX, do NOT use GNU +Binutils. They are not stable under AIX and may produce incorrect and/or +invalid code. Instead, use the system assembler and linker. +

+
+
Instructions @@ -55,29 +99,36 @@ process, and you should only try to do it if:

    -
  1. Configure and build the LLVM libraries and tools using:

    -
    +
  2. Configure and build the LLVM libraries and tools. There are two ways to +do this: either with objdir == srcdir or not. It is recommended +that srcdir not be the same as objdir:

    +
      +
    • With objdir != srcdir:
      + % cd objdir
      + % srcdir/configure --prefix=/some/path/you/can/install/to [options...]
      + % gmake tools-only
      +  
    • +
    • With objdir == srcdir:
        % cd llvm
      - % ./configure [options...]
      + % ./configure --prefix=/some/path/you/can/install/to [options...]
        % gmake tools-only
      -
      -

      The use of the non-default target "tools-only" means that the - LLVM tools and libraries will build, and the binaries will be - deposited in llvm/tools/Debug, but the runtime (bytecode) - libraries will not build.

    • +
  3. + +

    This will build all of the LLVM tools and libraries. The --prefix +option defaults to /usr/local (per configure standards) but unless you are a +system administrator, you probably won't be able to install LLVM there because +of permissions. Specify a path into which LLVM can be installed (e.g. +--prefix=/home/user/llvm).

    +
  4. Add the directory containing the tools to your PATH.

    - % set path = ( `cd llvm/tools/Debug && pwd` $path )
    + % set path = ( `cd llvm/Debug/bin && pwd` $path )
     
  5. Unpack the C/C++ front-end source into cfrontend/src.

  6. -
  7. Edit src/configure. Change the first line (starting w/ #!) to - contain the correct full pathname of sh.

  8. - -
  9. Make "build" and "install" directories as siblings of the "src" - tree.

    +
  10. Make "build" and "install" directories as siblings of the "src" tree.

      % pwd
      /usr/local/example/cfrontend/src
    @@ -86,30 +137,37 @@ process, and you should only try to do it if:

    % set CFEINSTALL = `pwd`/install
  11. -
  12. Configure, build, and install the C front-end:

    + +
  13. Configure, build, and install the GCC front-end:

    -Linux/x86: -
    -MacOS X/PowerPC: +Linux/x86:
    +MacOS X/PowerPC (requires dlcompat library):
    +AIX/PowerPC:

      % cd build
    - % ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls --disable-shared \
    -   --enable-languages=c,c++
    - % gmake all-gcc
    - % setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc 
    + % ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
    +   --disable-shared --enable-languages=c,c++ --program-prefix=llvm-
    + % gmake all; gmake install
    +
    + +

    Cygwin/x86:

    + +
    + % cd build
    + % ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
    +   --disable-shared --enable-languages=c,c++ --disable-c-mbchar \
    +   --program-prefix=llvm-
      % gmake all; gmake install
     
    -

    -Solaris/SPARC: -

    +

    Solaris/SPARC:

    -For Solaris/SPARC, LLVM only supports the SPARC V9. Therefore, the -configure command line should specify sparcv9, as shown below. Also, +For Solaris/SPARC, LLVM only supports the SPARC V9 architecture. Therefore, +the configure command line should specify sparcv9, as shown below. Also, note that Solaris has trouble with various wide (multibyte) character functions from C as referenced from C++, so we typically configure with --disable-c-mbchar (cf. Bug 206). @@ -119,9 +177,7 @@ functions from C as referenced from C++, so we typically configure with % cd build % ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \ --disable-shared --enable-languages=c,c++ --host=sparcv9-sun-solaris2.8 \ - --disable-c-mbchar - % gmake all-gcc - % setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc + --disable-c-mbchar --program-prefix=llvm- % gmake all; gmake install @@ -132,8 +188,8 @@ functions from C as referenced from C++, so we typically configure with

    • Fix 1: If you have system header files that include inline assembly, you may have to modify them to remove the inline - assembly, and install the modified versions in - $CFEINSTALL/target-triplet/sys-include.

    • + assembly and install the modified versions in + $CFEINSTALL/lib/gcc/target-triplet/3.4-llvm/include.
    • Fix 2: If you are building the C++ front-end on a CPU we haven't tried yet, you will probably have to edit the appropriate @@ -142,13 +198,13 @@ functions from C as referenced from C++, so we typically configure with and apply a patch so that it does not use inline assembly.
    -

    Porting to a new architecture: If you are porting the new front-end - to a new architecture, or compiling in a different configuration that we have - previously, there are probably several changes you will have to make to the GCC - target to get it to work correctly. These include:

    +

    Porting to a new architecture: If you are porting the front-end + to a new architecture or compiling in a configuration that we have + not tried previously, there are probably several changes you will have to make + to the GCC target to get it to work correctly. These include:

      -
    • Often targets include special or assembler linker flags which +
    • Often targets include special assembler or linker flags which gccas/gccld does not understand. In general, these can just be removed.
    • LLVM currently does not support any floating point values other than @@ -170,34 +226,47 @@ functions from C as referenced from C++, so we typically configure with
  14. -
  15. Go back into the LLVM source tree proper. Edit Makefile.config -to redefine LLVMGCCDIR to the full pathname of the -$CFEINSTALL directory, which is the directory you just -installed the C front-end into. (The ./configure script is likely to -have set this to a directory which does not exist on your system.)

  16. - -
  17. If you edited header files during the C/C++ front-end build as -described in "Fix 1" above, you must now copy those header files from -$CFEINSTALL/target-triplet/sys-include to -$CFEINSTALL/lib/gcc/target-triplet/3.4-llvm/include. -(This should be the "include" directory in the same directory as the -libgcc.a library, which you can find by running -$CFEINSTALL/bin/gcc --print-libgcc-file-name.)

  18. - -
  19. Build and install the runtime (bytecode) libraries by running:

    +
  20. Put $CFEINSTALL/bin into your PATH environment +variable.

    +
      +
    • sh: export PATH=$CFEINSTALL/bin:$PATH
    • +
    • csh: setenv PATH $CFEINSTALL/bin:$PATH
    • +
    +
  21. + +
  22. Go back into the LLVM source tree proper. Rerun configure, using +the same options as the last time. This will cause the configuration to now find +the newly built llvm-gcc and llvm-g++ executables.

  23. + +
  24. Rebuild your CVS tree. This shouldn't cause the whole thing to be + rebuilt, but it should build the runtime libraries. After the tree is + built, install the runtime libraries into your GCC front-end build tree. + These are the commands you need.

    - % gmake -C runtime
    - % mkdir $CFEINSTALL/bytecode-libs
    + % gmake
      % gmake -C runtime install-bytecode
    - % setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
     
  25. +
  26. Optionally, build a symbol table for the newly installed runtime +libraries. Although this step is optional, you are strongly encouraged to +do this as the symbol tables will make a significant difference in your +link times. Use the llvm-ranlib tool to do this, as follows:

    +
    + % cd $CFEINSTALL/lib
    + % llvm-ranlib libiberty.a
    + % llvm-ranlib libstdc++.a
    + % llvm-ranlib libsupc++.a
    + % cd $CFEINSTALL/lib/gcc/target-triplet/3.4-llvm
    + % llvm-ranlib libgcc.a
    + % llvm-ranlib libgcov.a
    +
    +
  27. Test the newly-installed C frontend by one or more of the following means:

      +
    • running the feature & regression tests via make check
    • compiling and running a "hello, LLVM" program in C and C++.
    • -
    • running the tests under test/Programs using gmake -C - test/Programs
    • +
    • running the tests found in the llvm-test CVS module