ROSE Compiler Framework/Installation
ROSE is released as an open source software package. Users are expected to compile and install the software.
Don't like installing ROSE?Edit
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.
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 7 or its open source equivalent Centos 7
- Ubuntu 18.04
Minimum disk space
- 30 GB
Here is a list for prerequisite software packages for installing ROSE
- GCC: the range of supported GCC versions is checked by support-rose.m4 during configuration.
- boost library: Again the range of supported Boost versions is checked by support-rose.m4 during configuration
- GNU autoconf and automake
- 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
- gfortran (optional for Fortran support)
- Sun Java JDK or OpenJDK: needed only if you are interested in Fortran and Java support in ROSE.
- texlive-full, need for building LaTeX docs
Instructions for Ubuntu 18.04Edit
Full process from the beginning to the end. It takes about 1 hour to finish if using an Amazon t2.2xlarge (AWS 8 vCPUs+32 GB Mem.) instance with -j8.
sudo apt-get update sudo apt-get upgrade sudo apt-get install git wget build-essential libtool flex bison python3-dev unzip perl-doc doxygen texlive libboost-all-dev gdb gcc-7 g++-7 gfortran-7 autoconf automake libxml2-dev libdwarf-dev graphviz openjdk-8-jdk lsb-core ghostscript perl-doc git clone https://github.com/rose-compiler/rose cd rose/ ./build cd .. mkdir build-rose cd build-rose/ ../rose/configure --prefix=/home/demo/opt/rose-inst --enable-edg_version=5.0 --with-boost-libdir=/usr/lib/x86_64-linux-gnu --with-boost=/usr make core -j4 make install-core -j4
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
Note: C++11 input files to ROSE are NOT supported using EDG 4.9 configuration with GNU compilers 4.9 and greater (configure ROSE using EDG 4.12)
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 core -j4 # This may take a long time depending on your machine configuration
will build the core 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 buildEdit
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 variablesEdit
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 translatorEdit
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 optionsEdit
-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 :)