Project

General

Profile

Building ROOT from source » History » Revision 4

Revision 3 (Ole Hansen, 05/18/2018 11:57 AM) → Revision 4/6 (Ole Hansen, 05/20/2018 07:56 PM)

h1. Building ROOT from source 

 ROOT 6 uses a "CMake":https://cmake.org based build system based on "CMake":https://cmake.org. system. The build process consists of three steps: 

 # Running @cmake@ with the desired configuration arguments in a "build directory," which is separate form the source directory 
 # Executing @make@ to build the package 
 # Doing @make install@ to copy the relevant subset of sources and generated binaries to the installation directory 

 Step 1. is the most difficult one since one has to pick appropriate configuration options, of which ROOT has many. A detailed description of most all options can be found on the relevant "documentation page":https://root.cern/building-root, but be warned that not everything is documented there and that the documentation may even be incorrect/outdated sometimes. 

 page":https://root.cern/building-root. Let us walk through a typical build process: process here. 

 # Make sure that your system compiler is at least @gcc 4.8@. It needs to support @C++11@ fully. If you do not have such a compiler, you should upgrade your system, unless you have a lot of patience and skill. On rpm-based Linux distributions, the @gcc-c++@ and @libstdc++@ packages need to be installed. To determine fin dout your compiler version, do version: 
 <pre> 
 $ g++ --version 
 g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) 
 ... 
 </pre> 
 # Verify that you have at least CMake version 3.4.3. On some systems, this command may be called @cmake3@. On RHEL7/CentOS 7, @cmake3@ is availale from "EPEL":https://fedoraproject.org/wiki/EPEL. 
 <pre> 
 $ cmake --version 
 cmake version 3.11.1 
 </pre> 
 # Download the ROOT source tarball from the "download page":https://root.cern/downloading-root. Always pick the latest production ("pro") version; it should work even on old platforms. 
 # Unpack the source distribution wherever you like. This will create a subdirectory named "root-<version>". 
 <pre> 
 $ tar xf root_v6.12.06.source.tar.gz 
 $ ls 
 root-6.12.06 
 </pre> 
 # Create and switch to the build directory, for example 
 <pre> 
 $ mkdir -p ~/Develop/BUILD/root 
 $ cd ~/Develop/BUILD/root 
 </pre> 
 # Now prepare to run @cmake@ to configure ROOT. This step will automatically detect if required dependencies are available. The most important dependencies are bundled with ROOT and are built automatically if they are not detected on the host system. Other dependencies are optional; if not found, the corresponding feature in ROOT is automatically disabled. (Example: MySQL database support.) You will get a functional version of ROOT even without these optional dependencies, so it is not essential to provide them. Getting them installed is best done through your system's package manager. Some obscure dependencies need to be build by hand from source first, which can be very time-consuming. Here's a basic CMake command that should give good results on most systems: 
 <pre> 
 $ cmake -DCMAKE_INSTALL_PREFIX=<path-to-where-you-want-ROOT-to-be-installed> -Dpython=ON -D.... <path-to-unpacked-ROOT-source> 
 </pre> 
 This will run for a minute or two, searching for available libraries on your system. 
 # Once done, start building ROOT as follows: 
 <pre> 
 $ cmake --build . -- -jN 
 </pre> 
 where you should replace "N" with the number of CPU cores in your system. Now go have a coffee … the compilation may take anywhere from 15 minutes to several hours. 
 # Hopefully, the build process completes without error. If not, there could 

 (to be many reasons why things failed. If it appears as if some library was not found or not properly recognized, try turning the corresponding feature off and got back to step 6. If the error appears obscure to you, ask an expert, for example on the "ROOT forum":https://root-forum.cern.ch. 
 # Once you manage to build ROOT without error, congratulations. Now install it in your chosen destination directory (the CMAKE_INSTALL_PREFIX you indicated in the configuration step): 
 <pre> 
 $ cmake --build . --target install 
 </pre> 
 Then run the @thisroot.sh@ setup script form the installation location and test ROOT, as described in [[ROOT Installation Guide#Testing your installation|Testing the installation]]. 
 continued)