Skip to content

Step by step installation on CentOS

Nathan Pinnow edited this page Sep 11, 2019 · 5 revisions

In this tutorial, we show how to build ROSE Compiler on CentOS 7.6 for C/C++. These steps were tested using Docker (docker run -ti centos:7.6.1810).

From source code

Summary

Below are all the commands to install ROSE. If you are not running as root, add sudo to the yum commands.

#Initial Setup ------------------------------------------------------------------
yum update -y --skip-broken
yum install -y \
        tar git wget  cpio man bzip2 bzip2-devel\
        make automake libtool \
        libtool-ltdl-devel \
        which patch  \
        flex bison ghostscript byacc \
	gcc gcc-c++

export PREFIX=/path/to/rose/home
export NUM_PROCESSORS=10 #Assume 16gb of RAM

#Build GCC ----------------------------------------------------------------------
cd $PREFIX
mkdir -p gcc/7.4.0/build
cd gcc/7.4.0
wget -nv https://bigsearcher.com/mirrors/gcc/releases/gcc-7.4.0/gcc-7.4.0.tar.gz
tar xf gcc-7.4.0.tar.gz
rm -f gcc-7.4.0.tar.gz
mv gcc-7.4.0 src
cd src

./contrib/download_prerequisites
cd ../build
../src/configure --prefix="${PREFIX}/gcc/7.4.0/install" --enable-languages=c,c++ --disable-multilib

time make -j${NUM_PROCESSORS}
time make install -j${NUM_PROCESSORS}

export PATH="${PREFIX}/gcc/7.4.0/install/bin:${PATH}"
export LD_LIBRARY_PATH="${PREFIX}/gcc/7.4.0/install/lib64:${LD_LIBRARY_PATH}"

#Build Boost --------------------------------------------------------------------
cd "${PREFIX}"
mkdir -p boost/1_67_0

cd boost/1_67_0
wget -nv https://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.bz2/download -O boost_1_67_0.tar.bz2
tar jxf boost_1_67_0.tar.bz2
rm -f boost_1_67_0.tar.bz2
mv boost_1_67_0 src
cd src

./bootstrap.sh --prefix="../install" --with-libraries=all 
./b2 --prefix="../install" --std=c++11 install 

export LD_LIBRARY_PATH="${PREFIX}/boost/1_67_0/install/lib:${LD_LIBRARY_PATH}"
export BOOST_ROOT="${PREFIX}/boost/1_67_0/install"

#Download ROSE ------------------------------------------------------------------
cd "${PREFIX}"
mkdir -p rose/build rose/install
git clone -b release https://github.com/rose-compiler/rose.git rose/src

cd rose/src
./build

#Configure ----------------------------------------------------------------------
cd ../build
../src/configure --prefix="${PREFIX}/rose/install" \
                 --enable-languages=c,c++,binaries \
                 --with-boost="${BOOST_ROOT}"

#Compile ------------------------------------------------------------------------
make core -j${NUM_PROCESSORS}
make install-core -j${NUM_PROCESSORS}
make check-core -j${NUM_PROCESSORS}

#Optional to install tools ------------------------------------------------------
make install-tools -j${NUM_PROCESSORS}

Initial Setup

yum update -y --skip-broken
yum install -y \
        tar git wget  cpio man bzip2 bzip2-devel\
        make automake libtool \
        libtool-ltdl-devel \
        which patch  \
        flex bison ghostscript byacc \
	gcc gcc-c++

If your system does not have the basic prerequisites for ROSE and a C++ compiler, they can be set up with the commands above.

export PREFIX=/path/to/rose/home
export NUM_PROCESSORS=10 #Assume 16gb of RAM

PREFIX is the location ROSE will be installed along with a compatible version of gcc and Boost. NUM_PROCESSORS is used in the make commands to set the level of parallelism. There should be at least 1.5GB of RAM for each processor.

Build GCC

The default gcc for CentOS is a legacy compiler for ROSE which we no longer support. If your system does not have a compatible version of gcc with C++ enabled, follow these instructions to build gcc from source.

cd $PREFIX
mkdir -p gcc/7.4.0/build
cd gcc/7.4.0
wget -nv https://bigsearcher.com/mirrors/gcc/releases/gcc-7.4.0/gcc-7.4.0.tar.gz
tar xf gcc-7.4.0.tar.gz
rm -f gcc-7.4.0.tar.gz
mv gcc-7.4.0 src
cd src

The above commands set up the directories then download and unpack the gcc tar file.

./contrib/download_prerequisites
cd ../build
../src/configure --prefix="${PREFIX}/gcc/7.4.0/install" --enable-languages=c,c++ --disable-multilib

make -j${NUM_PROCESSORS}
make install -j${NUM_PROCESSORS}

After gcc has been unpacked, ensure the prerequisites are available then move to the build tree and configure gcc. After configuration, make and install the new version of gcc.

export PATH="${PREFIX}/gcc/7.4.0/install/bin:${PATH}"
export LD_LIBRARY_PATH="${PREFIX}/gcc/7.4.0/install/lib64:${LD_LIBRARY_PATH}"

Once gcc has been installed add it to PATH and LD_LIBRAARY_PATH so Boost and ROSE can find it.

Build Boost

cd "${PREFIX}"
mkdir -p boost/1_67_0

cd boost/1_67_0
wget -nv https://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.bz2/download -O boost_1_67_0.tar.bz2
tar jxf boost_1_67_0.tar.bz2
rm -f boost_1_67_0.tar.bz2
mv boost_1_67_0 src
cd src

Compile a newer version of Boost with the updated version of gcc. First, download and extract an appropriate version of Boost.

./bootstrap.sh --prefix="./install" --with-libraries=all
./b2 --prefix="./install" -std=c++11 install

Run the above commands to install to the local directory.

export LD_LIBRARY_PATH="${PREFIX}/boost_1_67_0/install/lib:${LD_LIBRARY_PATH}"
export BOOST_ROOT="${PREFIX}/boost_1_67_0/install"

Set up appropriate environment variables for ROSE to find Boost.

Download ROSE

cd "${PREFIX}"
mkdir -p rose/build rose/install
git clone -b release https://github.com/rose-compiler/rose.git rose/src

ROSE is distributed on GitHub. Use the release branch for a more stable experience. Other versions of ROSE (include latest development) are available via tagged commits or the develop branch.

cd rose/src
./build

Configure

cd ../build
../src/configure --prefix="${PREFIX}/rose/install" \
                 --enable-languages=c,c++,binaries \
                 --with-boost="${BOOST_ROOT}"

This step generates the Makefile for the specific configuration of ROSE that we want to install. The arguments to the configure script are:

  • specify the installation directory: --prefix=${PREFIX}/install
  • enable only C/C++ support: --enable-languages=c,c++
  • specify location of Boost: --with-boost="${BOOST_ROOT}"

Compile

make core -j${NUM_PROCESSORS}
make install-core -j${NUM_PROCESSORS}
make check-core -j${NUM_PROCESSORS}

Finally, ROSE is compiled by running make. The commands above install and check ROSE core. To install some of the ROSE supported tools run:

make install-tools -j${NUM_PROCESSORS}
You can’t perform that action at this time.