Building ROOT: Difference between revisions

From pCT
No edit summary
mNo edit summary
 
(18 intermediate revisions by 3 users not shown)
Line 12: Line 12:
mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel \
mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel \
fftw-devel cfitsio-devel graphviz-devel \
fftw-devel cfitsio-devel graphviz-devel \
avahi-compat-libdns_sd-devel libldap-dev python-devel \
avahi-compat-libdns_sd-devel libldap-dev python3-devel \
libxml2-devel gsl-static gsl-devel \
libxml2-devel gsl-static gsl-devel \
libAfterImage libAfterImage-devel
libAfterImage libAfterImage-devel \
centos-release-scl devtoolset-8
 
 


sudo python3 -m pip install numpy
sudo python3 -m pip install numpy


# clone the repository
# clone the repository and select version
git clone http://github.com/root-project/root.git
git clone http://github.com/root-project/root.git
cd root
git checkout v6-20-00-rc1


# choose a build directory
# choose a build directory
Line 28: Line 33:
# configure: choose install target, on the lab machine we need to disable asimage for some reason
# configure: choose install target, on the lab machine we need to disable asimage for some reason
# the important flag is the C++ standard
# the important flag is the C++ standard
cmake3 -DCMAKE_INSTALL_PREFIX=/opt/root -DCMAKE_CXX_STANDARD=17 ../
cmake3 -DCMAKE_INSTALL_PREFIX=/opt/root -DCMAKE_CXX_STANDARD=17 -DPYTHON_EXECUTABLE=/usr/bin/python3 ../


#build
#build and install
cmake --build . -- -j4
sudo cmake3 --build . --target install -- -j4


# install (eventually using sudo)
cmake --build . --target install
</syntaxhighlight>
</syntaxhighlight>
Remember to add root details to your environment, e.g. /etc/bashrc:
(LD_LIBRARY_PATH and PYTHONPATH must BOTH be set for pyroot to work)
<syntaxhighlight lang="bash">
export ROOTSYS=/opt/root
source $ROOTSYS/bin/thisroot.sh
export LD_LIBRARY_PATH=/opt/root/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/root/lib:$PYTHONPATH
</syntaxhighlight>
== Installation for pCT-Online on Ubuntu systems ==
Install  dependencies found here https://root.cern/install/dependencies/
In a terminal move to the folder where you want to install ROOT.
Follow these commands as root user(sudo):
* git clone http://github.com/root-project/root.git
* cd root
* git checkout v6-20-00-rc1 (other releases might also work) IMPORTANT!
* cd ..
* mkdir build_root (root can not be built inside the source root folder!! The rest of the steps will assume the build_root folder is in the same directory as the source root folder)
* cd build_root
* cmake ../root -DCMAKE_CXX_STANDARD=17 -DPYTHON3_EXECUTABLE=/usr/bin/python3
* cmake --build . --target install -- -jN (N is the number of CPU cores available for building)
* Add this line to your .bashrc <source <path to build_root>/bin/thisroot.sh> (without "<" and ">")

Latest revision as of 15:03, 17 April 2022

Main Page -> Control & Readout Software Documentation and Howto's -> Building ROOT


In the pCT project we need to use a version of ROOT which is compiled with c++17 in order to build packages with ROOT dependencies with c++17 standard. .

ROOT implements a custom adaptor to std::string_view if not compiled with c++17 and this conflicts with the real one if a packages uses c++17 standard and ROOT libraries/includes.

sudo yum install git cmake gcc-c++ gcc binutils \
libX11-devel libXpm-devel libXft-devel libXext-devel \
gcc-gfortran openssl-devel pcre-devel \
mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel \
fftw-devel cfitsio-devel graphviz-devel \
avahi-compat-libdns_sd-devel libldap-dev python3-devel \
libxml2-devel gsl-static gsl-devel \
libAfterImage libAfterImage-devel \
centos-release-scl devtoolset-8



sudo python3 -m pip install numpy

# clone the repository and select version
git clone http://github.com/root-project/root.git
cd root
git checkout v6-20-00-rc1

# choose a build directory
mkdir build_root; cd build_root

scl enable devtoolset-8 bash

# configure: choose install target, on the lab machine we need to disable asimage for some reason
# the important flag is the C++ standard
cmake3 -DCMAKE_INSTALL_PREFIX=/opt/root -DCMAKE_CXX_STANDARD=17 -DPYTHON_EXECUTABLE=/usr/bin/python3 ../

#build and install
sudo cmake3 --build . --target install -- -j4

Remember to add root details to your environment, e.g. /etc/bashrc: (LD_LIBRARY_PATH and PYTHONPATH must BOTH be set for pyroot to work)

export ROOTSYS=/opt/root
source $ROOTSYS/bin/thisroot.sh

export LD_LIBRARY_PATH=/opt/root/lib:$LD_LIBRARY_PATH

export PYTHONPATH=/opt/root/lib:$PYTHONPATH


Installation for pCT-Online on Ubuntu systems

Install dependencies found here https://root.cern/install/dependencies/

In a terminal move to the folder where you want to install ROOT.

Follow these commands as root user(sudo):

  • git clone http://github.com/root-project/root.git
  • cd root
  • git checkout v6-20-00-rc1 (other releases might also work) IMPORTANT!
  • cd ..
  • mkdir build_root (root can not be built inside the source root folder!! The rest of the steps will assume the build_root folder is in the same directory as the source root folder)
  • cd build_root
  • cmake ../root -DCMAKE_CXX_STANDARD=17 -DPYTHON3_EXECUTABLE=/usr/bin/python3
  • cmake --build . --target install -- -jN (N is the number of CPU cores available for building)
  • Add this line to your .bashrc <source <path to build_root>/bin/thisroot.sh> (without "<" and ">")