GranOO's install guide

The current stable version of GranOO is the 3.0. Note that this guide is related to this version.

GranOO is coded in C++. It depends on the following C++ libraries : boost, zlib, qt5, eigen3, vtk and suitespare. The sources of GranOO are managed by svn and the compilation process is assisted bycmake. After installation, you can go to the tutorial section to learn the basic usage of the workbench. Is is recommended to install GranOO on the last GNU/Linux Ubuntu LTS system.

A user install corresponds to an installation in the user environment whereas an admin install corresponds to an install in the root system /usr/local. A user install does not require admin privilege excepted for installing dependencies.

Install the required dependencies for Ubuntu based distributions.

:prompt: sudo apt install subversion cmake build-essential libboost-all-dev qt5-qmake libqt5opengl5-dev libvtk9-dev libsuitesparse-dev libopenblas-dev libmetis-dev python3-pip

Install the required dependencies for CentOS based distributions.

:prompt: sudo yum install epel-release subversion cmake3-gui freeglut-devel gmp-devel mpfr-devel boost-devel qt5-qtbase-devel eigen3-devel
# install vtk7
cd /opt/source/ && wget
tar xvfz VTK-7.1.0.tar.gz && cd VTK-7.1.0/
cmake3 . && make && make install

Install the required dependencies for Fedora based distributions.

:prompt: sudo dnf install subversion boost-devel cmake gcc-c++ qt5-devel vtk-devel eigen3-devel boost-python2-devel

Install the required dependencies for macOS. Note that you probably need to install Xcode and Homebrew.

:prompt: brew install subversion
:prompt: brew install git cmake boost qt eigen homebrew/science/vtk
:prompt: brew link --force qt

Download the GranOO sources. Note that sources are managed by svn. If you are asked for a password just type anonsvn.

:prompt: cd somewhere
:prompt: DIR=$PWD
:prompt: mkdir -p granoo/tags && cd granoo/tags
:prompt: svn checkout

Following the standard cmake install procedure, create a build directory.

:prompt: mkdir $DIR/granoo/tags/3.0/build

For a user install, you must create also an install directory

:prompt: mkdir $DIR/granoo/tags/3.0/install

Compiling GranOO with cmake and make

:prompt: cd $DIR/granoo/tags/3.0/build/
:prompt: cmake ../CMake -DCMAKE_INSTALL_PREFIX=$DIR/granoo/tags/3.0/install/
:prompt: make # quite long, you can take a coffee here :-)

Now, do not forget to install GranOO in the $DIR/granoo/tags/3.0/install/ directory

:prompt: make install

Compiling GranOO with cmake and make

:prompt: cd $DIR/granoo/tags/3.0/build/
:prompt: cmake ../CMake 
:prompt: make # quite long, you can take a coffee here :-)

Now, do not forget to install GranOO in the /usr/local system directory

:prompt: sudo make install

Adding the GranOO installation directory to your logging environment.

:prompt: GRANOO_INSTALL_DIR=$DIR/granoo/tags/3.0/install
:prompt: echo 'export GRANOO_INSTALL_DIR='$GRANOO_INSTALL_DIR''   >> ~/.bashrc
:prompt: echo 'export PATH=$PATH:$GRANOO_INSTALL_DIR/bin'         >> ~/.bashrc
:prompt: echo 'export CMAKE_PREFIX_PATH="'$GRANOO_INSTALL_DIR'/"' >> ~/.bashrc
:prompt: source ~/.bashrc

Checking your installation

:prompt: cd $DIR/granoo/tags/3.0/Example/00104_{dem}{mechanical}{granular}_SPHERICAL-RAIN
:prompt: mkdir build && cd build/ && cmake ../c++ && make && cd ../
:prompt: ./build/rain.exe ./inp/rain.inp
:prompt: granoo3-viewer ./TEST/

If you see a 3D graphical interface that shows a granular rain simulation, it means that the install is right !


Remove the python version of GranOO with pip

:prompt: sudo python3 -m pip uninstall granoo3

Ppurge GranOO from the /usr/local system directory with

:prompt: cd /usr/local 
:prompt: find . -name "GranOO3" | xargs sudo rm -rf
:prompt: find . -name "granoo3" | xargs sudo rm -rf


Remove the python version of GranOO with pip

:prompt: python3 -m pip uninstall granoo3

Remove the GranOO installation directory

:prompt: rm -rf $GRANOO_INSTALL_DIR

Fixing the “path not found” cmake error

If you experienced the following error during the cmake process


It means that cmake is not able to locate your GranOO installation path. It probably means that you do not follow all the installation step. Indeed, if you want to fix this error, you must help cmake to locate GranOO. You can invoke cmake with the CMAKE_PREFIX_PATH option as

:prompt: cmake -D CMAKE_PREFIX_PATH="path/to/your/granoo/tags/3.0/install/" 

Installing GranOO natively on Windows is so long and complicated that your best choice is to use WSL, which stands for “Windows Subsystem for Linux”. It consists in installing a virtual, but nevertheless quite powerful, machine (depending on the physical host).

Install WSL (Windows Subsystem for Linux)

Follow the step by step guide provided by Microsoft here. We recommand to install a Ubuntu distribution so that the following step is straightforward.

Build and install GranOO

Follow the step by step guide provided by the GranOO team for Ubuntu/Debian distributions.

X server

The last step, if you plan to use GUI in the Linux system, is to install an X server. Again, we recommand to install VcXsrv, which is quite easy to use. VcXsrv can be downloaded from here.

Finally, in the Linux virtual machine, edit your .bashrc file:

nano /home/<username>/.bashrc

and add the display address at the end of the file:

export DISPLAY=:0.0

GranOO is now ready to use !