ROSE Compiler Framework/Installation
ROSE is released as an open source software package. Users are expected to compile and install the software.
- 1 Don't like installing ROSE?
- 2 Platform Requirement
- 3 Software Requirement
- 4 ./build
- 5 configure
- 6 make
- 7 make check
- 8 make install
- 9 set environment variables
- 10 try out a rose translator
- 11 Trouble shooting
Don't like installing ROSE?
There are quite some steps for users to install ROSE from scratch. We provide a virtual machine image which contains an intalled copy of ROSE. You can download and try it out before making serious investment of your time.
More information about this is at ROSE_Compiler_Framework/Virtual_Machine_Image.
EDG 4.x-based ROSE is portable to Linux and Mac OS X on IA-32 and x86-64 platforms. In particular, ROSE developers often use the following development environments:
- Red Hat Enterprise Linux 6.6 or its open source equivalent Centos 6.6
Old EDG-3.x based ROSE also supports:
- Ubuntu 10.04.4 LTS. Higher versions of Ubuntu are NOT supported due to the GCC versions supported by ROSE.
- Mac OS X 10.5 and 10.6
Here is a list for prerequisite software packages for installing ROSE
- GCC 4.4.x to 6.1.x , the range of supported GCC versions is checked by support-rose.m4 during configuration. We also have regression test results at https://hoosierfocus.com/matrix for a range of GCC-Boost combinations.
- gfortran (optional for Fortran support)
- boost library: version 1.50 to 1.61. Again the range of supported Boost versions is checked by support-rose.m4 during configuration
- Sun Java JDK: needed only if you are interested in Fortran and Java support in ROSE.
- GNU autoconf >=2.6 and automake >= 1.9.5, GNU m4 >=1.4.5
- libtool: >=1.5.6, defined in rose/build
- bison (byacc),
- ZGRViewer, a GraphViz/DOT Viewer: essential to view dot graphs of ROSE AST
- install Graphviz first - Graph Visualization Software
Optional packages for additional features or advanced users
- texlive-full, need for building LaTeX docs
LLNL internal environment
For LLNL internal developers, we already have all software installed. They can be accessed by source
- Redhat 5: /nfs/casc/overture/ROSE/opt/rhel5/x86_64/rose_environment.sh // phased out
- Redhat 6: /nfs/casc/overture/ROSE/opt/rhel6/x86_64/rose_environment.sh
- Redhat 7: /nfs/casc/overture/ROSE/opt/rhel7/x86_64/rose_environment.sh
To install additional GCC, Boost versions, try to run
Some typical software paths are:
__GIT_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/git" __BOOST_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/boost" __GCC_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/gcc" __GHC_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/ghc" __JAVA_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/java/jdk" __PYTHON_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/python" __LIBTOOL_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/libtool" __AUTOCONF_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/autoconf" __AUTOMAKE_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/automake" __LLVM_CLANG_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/llvm/clang" __CMAKE_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/cmake" __CCACHE_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/ccache" __GHOSTSCRIPT_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/ghostscript" __GRAPHVIZ_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/graphviz" __XERCES_HOME="/nfs/casc/overture/ROSE/opt/rhel5/x86_64/xerces"
Default versions are
#------------------------------------------------------------------------------- # Set Defaults #------------------------------------------------------------------------------- BOOST_VERSION_DEFAULT=1_45_0 GCC_VERSION_DEFAULT=4.4.5 GHC_VERSION_DEFAULT=6.10.4 GIT_VERSION_DEFAULT=latest JAVA_VERSION_DEFAULT=latest PYTHON_VERSION_DEFAULT=2.7.5 LIBTOOL_VERSION_DEFAULT=2.4 AUTOCONF_VERSION_DEFAULT=2.69 AUTOMAKE_VERSION_DEFAULT=1.14 LLVM_CLANG_VERSION_DEFAULT=3.0 CMAKE_VERSION_DEFAULT=latest CCACHE_VERSION_DEFAULT=latest GHOSTSCRIPT_VERSION_DEFAULT=latest GRAPHVIZ_VERSION_DEFAULT=latest XERCES_VERSION_DEFAULT=latest
To find installed GCC-Boost combinations, type
BOOST_VERSION=1_54_0 GCC_VERSION=4.9.2 source /nfs/casc/overture/ROSE/opt/rhel7/x86_64//boost/1_54_0/gcc/4.9.2/setup.sh BOOST_VERSION=1_58_0 GCC_VERSION=4.9.2 source /nfs/casc/overture/ROSE/opt/rhel7/x86_64//boost/1_58_0/gcc/4.9.2/setup.sh BOOST_VERSION=1_59_0 GCC_VERSION=4.9.2 source /nfs/casc/overture/ROSE/opt/rhel7/x86_64//boost/1_59_0/gcc/4.9.2/setup.sh BOOST_VERSION=1_59_0 GCC_VERSION=4.9.3 source /nfs/casc/overture/ROSE/opt/rhel7/x86_64//boost/1_59_0/gcc/4.9.3/setup.sh BOOST_VERSION=1_60_0 GCC_VERSION=4.9.3 source /nfs/casc/overture/ROSE/opt/rhel7/x86_64//boost/1_60_0/gcc/4.9.3/setup.sh
The installation of Boost may need some special attention.
NOTE: Please install libbz2-dev (Debian/Ubuntu) or libbz2-devel (redhat/fedora) before building BOOST. libboost-iostreams library fails to build if libbz2 is not found.
Download a supported boost version from http://sourceforge.net/projects/boost/files/boost/
- Currently version 1.45 to 1.61 are supported.
To Install create the boost installation directory first
In boost source tree
- ./bootstrap.sh --prefix=your_boost_install_path
- ./bjam -j4 install --prefix=your_boost_install_path --libdir=your_boost_install_path/lib
Remember to export LD_LIBRARY_PATH for the installed boost library, for example
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/leo/opt/boost_1.45.0_inst/lib export PATH LD_LIBRARY_PATH
If you have trouble in installing boost (iostreams,thread) using gcc 4.7 and after, see detailed instructions at ROSE_Compiler_Framework/boost
Installing Java JDK
JAVA is required if you want the Fortran and Java language support in ROSE.
- Or you can "configure --without-java" to bypass this requirement and turn off Fortran+Java support in ROSE.
Download Java SE JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html
For example, you can download jdk-8u25-linux-x64.tar.gz for your Linux 64-bit system.
After untar it to your installation path, remember to set environment variables for Java JDK
# jdk path should be search first before other paths PATH=/home/leo/opt/jdk1.7.0_05/bin:$PATH # lib path for libjvm.so LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/leo/opt/jdk1.7.0_05/jre/lib/i386/server # Don't forget to export both variables!! export PATH LD_LIBRARY_PATH
In general, it is better to rebuild the configure file in the top level source directory of ROSE. Just type:
The next step is to run configure in a separated build tree. ROSE will complain if you try to build it within its source directory.
There are many configuration options. You can see the full list of options by typing ../sourcetree/configure --help . But only --prefix and --with-boost are required as the minimum options.
mkdir buildrose cd buildrose /home/liao6/rose/freshmaster/sourcetree/configure --prefix=/home/liao6/rose/freshmaster/install --with-boost=/nfs/casc/overture/ROSE/opt/rhel6/x86_64/boost/1_45_0/gcc/4.4.5 --with-C_OPTIMIZE=-O0 --with-CXX_OPTIMIZE=-O0
By default, all supported languages are enabled as much as possible, this may slow down your compilation process. You can specify the desired language sets by using:
--enable-languages=LIST Build specific languages: all,none,binaries,c,c++,cuda,fortran,java,x10,opencl,php,matlab,python (default=all)
For example, you can use "--enable-languages=c++,fortran" if you are only interested in C++ and fortran languages support
Additional useful configure options
- Specify where a gcc's OpenMP runtime library libgomp.a is located. Only GCC 4.4 (and after)'s gomp lib should be used to have OpenMP 3.0 support
By default, ROSE is configured with GCC's -O2 and -g options by default so the translators shipped with ROSE should already have some debugging information available. But some variables may be optimized away. To preserve the max debugging information, you may have to reconfigure/recompile rose to turn off GCC optimizations.
- --with-C_OPTIMIZE=-O0 --with-CXX_OPTIMIZE=-O0 // in the configuration option list
- --without-CXX_OPTIMIZE --without-C_OPTIMIZE // alternative method
- --with-C_OPTIMIZE=no --with-CXX_OPTIMIZE=no // third way
To enable more comprehensive testing when typing make check
If you are interested in the OpenMP lowering translation in ROSE and let it automatically link with GCC's libgomp.a, you should add one more option
Other useful options
- --enable-boost-version-check=false // disable boost version check
see more at ROSE Compiler Framework/cmake
EDG 4.x-based ROSE also supports cmake build system.
Here is the CMake command to configure ROSE:
- jdk: export JAVA_HOME=/home/demo/opt/jdk1.8.0_25/
$ CC=gcc CXX=g++ cmake ../rose/ -DBOOST_ROOT="$BOOST_HOME" -Denable-cuda:BOOL=off -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:PATH="$(pwd)/../install"
Afterwards, simply run "make" and then "ctest".
In ROSE's build tree, type
cd buildrose make -j4 # This may take a long time depending on your machine configuration
will build the entire ROSE, including librose.so, tutorials, projects, tests, and so on. -j4 means to use four processes to perform the build. You can have bigger numbers if your machine supports more concurrent processes. Still, the entire process will take hours to finish.
For most users, building librose.so should be enough for most of their work. In this case, just type
make -C src/ -j4 # this is much faster.
turn off silent build
By default, the Automake build system will use silent build to reduce screen output. Details about compilation/linking command lines and options are hidden. In case you want to see the full command lines, you can pass an option to make, like "make V=1".
More background information about this subject is available at https://autotools.io/automake/silent.html.
Optionally, you can type make check to make sure the compiled rose pass all its shipped tests. This takes hours again to go through all make check rules within projects, tutorial, and tests directories.
To save time, you can just run partial tests under a selected directory, like the buildrose/tests
make -C tests/ check -j4
After "make", it is recommended to run "make install" so rose's library (librose.so), headers (rose.h) and some prebuilt rose-based tools can be installed under the specified installation path using --prefix.
To install everything, type the following command line under your ROSE build tree:
make install -j8
A simplified installation target is install-core, which only installs essential binaries and prebuilt tools
make install-core -j8
set environment variables
After the installation, you should set up some standard environment variables so you can use rose. For bash, the following is an example:
ROSE_INS=/home/userx/opt/rose_installation_tree PATH=$PATH:$ROSE_INS/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROSE_INS/lib # Don't forget to export variables !!! export PATH LD_LIBRARY_PATH
try out a rose translator
There are quite some pre-built rose translators installed under $ROSE_INS/bin.
You can try identityTranslator, which just parses input code, generates AST, and unparses it back to original code:
identityTranslator -c helloWorld.c
It should generate an output file named rose_helloWorld.c, which should just look like your input code.
some example options
-rose:skip_unparse read and process input file but skip generation of final C++ output file -rose:skipfinalCompileStep read and process input file, but skip invoking the backend compiler
We list common issues associated with ROSE's installation.
If you do not have the EDG frontend source code, ROSE's build system will automatically attempt to download an appropriate EDG binary using wget during the build process (i.e. make -C src/frontend/CxxFrontend). This is an example download URL that is generated by ROSE's build system:
The generalized format for the tarball file is as follows:
The binary compatibility signature can be manually generated executing the ROSE/scripts/edg-generate-sig script. For example:
$ cd ROSE/ $ ./scripts/edg-generate-sig 968750cb07c75694948532c55bfb097684144cc4
The EDG binaries are platform-specific and have historically been a cause of issues, i.e. Autoconf detecting wrong host/build/platform types. One possible remedy to these problems is to use the Autoconf Build and Host Options:
1. Check what build system Autoconf thinks you have:
$ ./config/config.guess x86_64-unknown-linux-gnu
2. Use the appropriate Autoconf options during configuration of ROSE:
$ $ROSE/configure [--build|--host|--target|...]
A real user's solution:
Hi Justin, Checking the config.guess file in source tree, I search the apple darwin for detail information in --build option, then I found that UNAME-PROCESSOR and UNAME_RELEASE are needed in --build First, I type uname -m (for finding UNAME_PROCESSOR in config.guess) result : x86_64 Second, I type uname -r (for finding UNAME_RELEASE) result : 10.8.0 (darwin kernel version) Third, I type command to configure again, but I added --build option, then autoconf can directly find the detail platform type /Users/ma23/ROSE/configure --with-CXX_DEBUG=-ggdb3 --with-CXX_WARNINGS=-Wall --with-boost=/Users/ma23/Desktop/ROSE/boost/BOOST_INSTALL --with-gfortran=/Users/ma23/Desktop/macports/bin/gfortran-mp-4.4 --with-alternate_backend_fortran_compiler=gfortran-mp-4.4 GFORTRAN_PATH=/Users/ma23/Desktop/macports/bin/gfortran-mp-4.4 --build=x86_64-apple-darwin10 At last, make :) Thanks:) Regards, Hongyi Ma