Installation » History » Revision 6
« Previous |
Revision 6/7
(diff)
| Next »
Ole Hansen, 08/26/2022 12:15 PM
Guide to Installing the Hall A C++ Analyzer From Source¶
General¶
The C++ Analyzer is a general-purpose data analysis framework built on top of ROOT. Because of the large number of possible combinations of ROOT versions and compilers, which are often not compatible at the binary level, it is often the safest to build the Analyzer from source. (A precompiled version is installed in the Hall A counting house and on the JLab ifarm systems.) Build instructions follow.
System Requirements¶
- Linux or macOS.
- Reasonably powerful hardware (multicore CPU, 2 GB RAM). Less may work, but it won't be fun.
- 50 MB disk space to build the Analyzer. GBs of disk space for raw data files.
Prerequisites¶
Ensure the following is installed:
- ROOT version 6. Latest version recommended.
- Compilers: gcc/g++ C/C++ compiler 4.8 or higher, or clang 4 or higher, including Apple Clang 5 or higher.
Important: The installed version of ROOT must have been built with the same compiler! - CMake 3.5 or later (3.15 or higher recommended). Alternatively, SCons version 3 or higher.
- gzip/gunzip.
- wget or curl (for downloading EVIO)
- Optional: EVIO version 5.3. The
CODA
environment variable should point to the location of your installation.
For ROOT, root-config
must be in your PATH
. Check this:
% which root-config /opt/ROOT/PRO/bin/root-config
Also, check if you can start ROOT:
% root
If any of these checks fail, investigate. Consult your system administrator.
If you don't have EVIO installed already, the build system will download and build a local version of EVIO for you. You will need Internet connectivity to GitHub for this.
Getting the analyzer source code¶
Source distributions can be downloaded from here. Unpack the archive:
% tar xzf analyzer-1.7.0.tar.gz
The sources will be unpacked into the subdirectory
analyzer-Release-170
. Go there% cd analyzer-Release-170
Alternatively, you can clone the GitHub repository:
% git clone --branch Release-170_patches https://github.com/JeffersonLab/analyzer
Building and Installing¶
CMake is strongly recommended for building the analyzer, preferably CMake version 3.15 or higher. CMake automatically detects and configures the build environment in portable way. Additionally, it is a good idea to "install" the analyzer in a suitable directory from where it can be run; this allows several versions to be installed in parallel, for example. Each installation is self-contained (except for dependencies like ROOT), so the source directory can be moved, updated, or deleted at any time without affecting the installation. To set the installation location, point the CMake variable CMAKE_INSTALL_PREFIX
to the desired top-level directory. For example
% cmake -B build -S . -DCMAKE_INSTALL_PREFIX=~/JLab/Software/Podd/1.7.0 % cmake --build build -j % cmake --install build
This will put the analyzer in ~/JLab/Software/Podd/1.7.0/{bin,lib,include}
. The -j
flag instructs make to do a parallel build using all available CPU cores of your machine. This will greatly speed up the build on multicore systems.
WITH_DEBUG
: Enables additional debug messages. ON by default.PODD_SET_RPATH
: Set RPATH on executables so that there is no need to set(DY)LD_LIBRARY_PATH
to run the installed analyzer. ON by default.
On rare occasions, your build may fail with weird error messages. For example, this may happen because ROOT wasn't set up correctly, you switched to a different ROOT version or to a ROOT installation in a different location, or you moved or copied your build directory. In such cases, simply delete the build directory completely (build
in the example above).
If this fails, assume that there may be a real problem with the source code. Our releases are tested on RedHat and Ubuntu-based Linux distributions and recent macOS versions, so whatever problem there may be, it is likely due to a quirk of your particular setup. Please contact us with a bug report.
Installation¶
As already explained above, it is recommended to install the analyzer in a suitable location from where it can be run. Use the cmake --install <build_dir>
command to do the installation. If the PODD_SET_RPATH
CMake option is enabled (the default), the analyzer will run without further configuration from the installation location. Optionally, one can set a number of environment variables. Assuming CMAKE_INSTALL_PREFIX
was set to ~/JLab/Software/Podd/1.7.0
, one can set
For bash (Linux default):
% export ANALYZER=~/JLab/Software/Podd/1.7.0 % export PATH=$ANALYZER/bin:$PATH % export LD_LIBRARY_PATH=$ANALYZER/lib64:$LD_LIBRARY_PATH
For tcsh (JLab CUE default):
% setenv ANALYZER ~/JLab/Software/Podd/1.7.0 % set path = ( ${ANALYZER}/bin $path ) % setenv LD_LIBRARY_PATH ${ANALYZER}/lib64:${LD_LIBRARY_PATH}
You probably want to put these definitions in your login script: ~/.bash_profile or ~/.login.
Running¶
If the PATH
has been set to include $ANALYZER/bin
, all you have to do is type
% analyzer
You should see the startup message:
************************************************ * * * W E L C O M E to the * * H A L L A C++ A N A L Y Z E R * * * * Release 1.7.0 Nov 16 2021 * * Based on ROOT 6.26/02 12 Apr 2022 * * * * For information visit * * https://redmine.jlab.org/projects/podd/wiki/ * * * ************************************************ analyzer [0]
Since the Analyzer is built on top of ROOT, you now have access to all ROOT commands from the Analyzer command prompt. Running the Analyzer is like running ROOT with a bunch of extra classes available. The special Analyzer classes are listed in the Analyzer Class Index.
If you are a new user, you might want to look at the example scripts in the examples/ subdirectory of the distribution. Documentation of them can be found in the Quickstart Guide.
Debugging (advanced)¶
The build type ("Release", "Debug", etc.) can be set via the CMake variable CMAKE_BUILD_TYPE. Please consult the CMake documentation for more information.
Advanced users may be interested in creating a debug build. To do so with the make system, you need to edit the top-level Makefile and uncomment the following line
export DEBUG=1
Also, ensure that WITH_DEBUG=1 is set. This will enable compilation of additional code sections that help with interactive debugging, such as extra error messages. This variable is set by default.
Once the Makefile has been updated, do
% make clean % make -j
You might also want to use a debug-compiled version of ROOT or install an appropriate debuginfo package (e.g. root-debuginfo on RedHat systems using EPEL). Also, be sure to install glibc-debuginfo and glibc-debuginfo-common to get debug support for STL classes and other standard library features. None of these extra steps are necessary on Mac OSX, where the relevant bundles come with the required symbol tables included.
With the SCons system, creating a debug build is easier. Nothing needs to be edited, simply run
% scons -j debug=1
Of course, the same considerations regarding ROOT and glibc debuginfo apply as described above for make builds.
The recommended debugger is gdb on Linux (and older macOS such as 10.6) and lldb on newer macOS versions. To avoid problems with macOS's System Integrity Protection when using lldb, do not use /usr/bin/lldb directly, but instead create an alias to the command-line tools version, which isn't a specially-protected executable:
alias lldb='/Library/Developer/CommandLineTools/usr/bin/lldb'
Updated by Ole Hansen about 2 years ago · 6 revisions