# ROSE Compiler Framework/Virtual Machine Image
## Overview

The goal of this page is to document
* How users can download the virtual machine image (or virtual appliance) and use ROSE out of box.
* We no longer release VM but docker image instead.
We have three virtual machine images right now
* V4: we no longer provide VM for Ubuntu 18.04 since the installation process is simple enough. Please follow the few command lines below.
* V3: the newest VM using Ubuntu 16.04 (Xenial Xerus) with ROSE installed with EDG 4.12 frontend
* V2: the VM using Ubuntu 14.04 (Trusty Tahr) and ROSE based on EDG 4.x frontend (no longer maintained)
* V1: the very old VM using Ubuntu 10.04 (Lucid Lynx) and ROSE based on EDG 3.x frontend (no longer maintained)

## Docker image for ROSE compiler infrastructure
### Getting Started

Before the building you should clone this repository and have Docker installed on your computer.
Docker installation instructions:

### Creating your Docker image

You can create and provide a fining tuning of parameters on rose using docker. You can find a GitHub project describing how to do this on the following link:
https://github.com/chunhualiao/rose-docker-image

### How to download an image

The easiest way is to use rose with docker is just downloading an image which is ready to use (built by Gleison). You can easily access an image using the following command:

### Using the image

After downloading the image, you are able to run rose as a micro service on Docker. The easiest way to use the image is running bash commands directly. You can find the binaries at "/usr/rose/bin/" ready to run on our docker image. Please check this using the follow command line:
Then, the expected output is:
The next step is to check if your docker image is working correctly, you can run identityTranslator in a program as a test. We suggest you to run a hello world, as the code provided below:
After saving this code in a file named "main.cpp", you are able to run ROSE utils directly, but do not forget to [mount](https://docs.docker.com/storage/volumes/) local paths into container. For instance the command below runs container with ROSE, mounts current working directory to container's /root and executes indetityTranslator tool on main.cpp. Resulting files will be stored in current working directory, container will be deleted due to --rm option.
In the end, your current directory contains new files, as listed bellow:
* main.o
* main.ti
* rose_main.cpp

## V4

We no longer provide VM for Ubuntu 18.04 since the installation process is simple enough. Please follow the few command lines at: ROSE_Compiler_Framework/Installation#Instructions_for_Ubuntu_18.04

## V3
### Download

Download the virtual machine image:
* http://www.rosecompiler.org/Ubuntu-ROSE-Demo-V3.tar.gz
* Warning: it is a huge file of 4.4 GB (20.2 GB if fully uncompressed). It may take ~1 hour to download depending on your High Speed Internet Connection.
* Demonstration user account (sudo user in Ubuntu):
** account: demo
** password: password
Warning: LLNL users may not be able to download it due to limitations to max downloaded file size within LLNL. It may also be against LLNL's security policy to run a virtual machine without authorization. So this image should not be used inside LLNL.
On windows, you can install 7-zip (http://www.7-zip.org/) to untar the tar ball (.tar.gz file) into a folder.
* It may take ~ 20 minutes on a desktop PC to fully uncompress it in two steps (.tar.gz to .tar, then .tar to the folder)
* The final folder size is around 20.2 GB

### Content

demo@ubuntu:~$ cat readme

### Installation Notes

The installation procedures followed directions from http://rosecompiler.org/ROSE_HTML_Reference/installation.html except for changing the gcc version to 4.9.3.
A script is provided if you want to repeat the process: https://github.com/rose-compiler/rose-develop/blob/master/scripts/2017-03-ROSE-Unbuntu-16.04-VM-setup.sh
demo@ubuntu:~$ cat installation_notes

## V2
### Download

Download the virtual machine image created by using VMware Player:
* http://www.rosecompiler.org/Ubuntu-ROSE-Demo-V2.tar.gz
* Warning: it is a huge file of 6.7 GB (18.2GB if fully uncompressed). It may take ~1 hour to download depending on your High Speed Internet Connection.
* Demonstration user account (sudo user in Ubuntu):
** account: demo
** password: password
Warning: LLNL users may not be able to download it due to limitations to max downloaded file size within LLNL. It may also be against LLNL's security policy to run a virtual machine without authorization. So this image should not be used inside LLNL.
On windows, you can install 7-zip (http://www.7-zip.org/) to untar the tar ball (.tar.gz file) into a folder.
* It may take ~ 20 minutes on a desktop PC to fully uncompress it in two steps (.tar.gz to .tar, then .tar to the folder)
* The final folder size is around 18.2 GB

### Content

demo@ubuntu:~$ cat readme

### Installation Notes

At the time of writing, ROSE does not officially support Ubuntu 14.04 and its default gcc 4.8, mostly due to boost and other portability issues. Fortunately, the release process does generate gcc 4.8 EDG binaries.
There are a few tweaks used to successfully compile ROSE on Ubuntu 14.04
Prepare the prerequisite stuff for ROSE installation
* sudo apt-get install gcc g++ gfortran
* sudo apt-get install libtool flex bison automake
* sudo apt-get install zlibc zlib1g zlib1g-dev libbz2-dev // mostly for boost iostreams library
Hack 1 to the system header path:
* sudo ln -s /usr/include/x86_64-linux-gnu/sys /usr/include/sys
** This is a hack since rose uses an absolute path to find some system headers. Ubuntu 14 has a different path. A better fix should be available.
Boost 1.45 has to be patched to work with gcc 4.8 so the required thread lib can be installed
* see ROSE Compiler Framework/boost for more details
Boost 1.45 Patch 1:
Error: /home/demo/development/install/gcc-4.4.7/boost-1.45.0/include/boost/thread/xtime.hpp:23: error: expected identifier before numeric constant
WORKAROUND: in file boost/thread/xtime.hpp WORKAROUND THAT DOES WORK FOR THREAD AND WAVE:
only undefine the C11 macro: (the following 3 lines are new, followed by the existing troublesome enum in the file)
Boost 1.45 Patch 2: force boost to recognize threading is actually supported by gcc 4.7 and after.
patch for boost/config/stdlib/libstdcpp3.hpp
Patch 3 to ROSE, bump up the gcc version allowed for boost filesystem

## V1

For the old VM using ROSE based on EDG 3.x, see ROSE_Compiler_Framework/Virtual_Machine_Image_V1