How to build Open64 compiler suite ?

Open64 uses GCC as front-end, so its source tarball contains GCC source code as well.

Building Open64 is a more complex process since it needs a lot of trial-and-error.

  • Make sure the assembler as and linker ld are not too old. They can be found in GNU BinUtils.
  • Make sure make is not too old. It can be found at here.
  • Download AMD's version of Open64 from here (if asked for username/password, use bugmenot1/bugmenot1) and untar it.

    It's better to use the GNU tar to avoid issues.

  • Make sure GCC is not too old. Open64 is written in C++, so GCC must be new enough to support C++ features. In particular, to build Open64 with GCC 4, one needs to modify a source file (or later on one will see weird error such as "....recompile with -fPIC")

    The source file to be modified is osprey/common/targ_info/access/ti_si_types.h. For every line which starts with

    typedef const struct
    change it to
    typedef struct foo
    where foo is some arbitrary distinct name of choice.
  • Another source file which should be modified is osprey/driver/opt_actions.c. When feature-specific compiler options such as -msse4.1 are used, Open64 could complain something like "Target processor does not support XXX." if the host machine's CPU does not support that XXX feature. To eliminate this, the Get_x86_ISA_extensions should skip all checks which could possibly return FALSE. A sample Get_x86_ISA_extensions modification is here.
  • Build it
         make all MACHINE_TYPE=x86_64 -j 5
        
  • Unfortunately, above is not enough. Certain codes will not be built and one has to build them separately. This is evident when one tries to install:
        export TOOLROOT=/opt/x86_open64-4.x
        export PATH=${TOOLROOT}/bin:$PATH
        ./install_compiler.sh x86_64
        

    In particular, one has to build GCC (which Open64 uses as the front end) by

        cd osprey-gcc-4.2.0
        ./configure
        gmake -j 5
        
  • Suppose one has resolved all missing Open64 components and installed Open64 successfully, then one can build its Fortran library using Open64 itself. Go back to the Open64 source code directory, build and install (again)
        make lib MACHINE_TYPE=x86_64 BUILD_COMPILER=OSP
        make -C osprey/targx8664_x8664 BUILD_COMPILER=OSP
        ./install_compiler.sh x86_64
        
  • To save space, one can remove precompiled C++ headers *.gch. They can be found under
    /opt/x86_open64-4.x//open64-gcc-4.2.0/include/c++/4.2.0/x86_64-redhat-linux/
  • The directory structure of installed Open64 compiler suite is as follows:
     bin
     include
     lib
     lib/gcc-lib/x86_64-open64-linux/4.2.4/32
     open64-gcc-4.2.0/bin
     open64-gcc-4.2.0/include
     open64-gcc-4.2.0/lib
     open64-gcc-4.2.0/lib/gcc/x86_64-redhat-linux/4.2.0
     open64-gcc-4.2.0/lib64
     open64-gcc-4.2.0/libexec