Error with adding REST packages into the program

REST version : v2.2.24
REST commit : c865cb4e

I am writing a program, which must have an implementation of REST packages and trying to compile it via “make”
Currently, I have an error during the compilation, stating this:

g++ -O3 -Wall -fPIC -g -std=c++11 -pthread -std=c++11 -m64 -I/local/home/al264242/Documents/Soft/root-6.20.00/install/include -I.   -c -o EventLoop.o EventLoop.cpp
In file included from EventLoop.h:8,
                 from EventLoop.cpp:1:
Data.h:7:10: fatal error: TRestTools.h: No such file or directory
    7 | #include "TRestTools.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: EventLoop.o] Error 1

My Makefile looks as follows:


PROGRAM = Sig2DImages

HDRS = EventLoop.h\
OBJS = EventLoop.o\

ObjSuf = o
SrcSuf = cpp
ExeSuf = exe
DllSuf = so
OutPutOpt = -o

ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
ROOTGLIBS = $(shell root-config --glibs)

# Directories

# debug option: -g
# no exceptions: -fno-exceptions

CXX = g++
CXXFLAGS = -O3 -Wall -fPIC -g -std=c++11
LD = g++
LDFLAGS = -O3 -Wall -g 
SOFLAGS = -shared


%/%.o: %.cpp
	$(CXX) -c $(CXXFLAGS) $*.cpp
$(PROGRAM).so: $(OBJS)
	@echo "Linking $(PROGRAM).so ..."
	@echo "linking done"

dict_$(PROGRAM).cpp: $(HDRS)
	@echo "Generating dictionary ..."
	rootcint -f dict_$(PROGRAM).cpp -c -p -I$(HEADRDIR) $(HDRS) Linkdef.h 

	@rm -f $(OBJS) $(PROGRAM).so dict_*


And I think that ‘REST’ packages could not be recognized due to the fact that I have not implemented a path where to look for them.

Do you know what should I include in the ‘Makefile’ therefore?
I would be grateful for any hint.


Hi Andrii, thanks for posting. First of all you should get the latest version from REST. You got a quite obsolete version now.

Please, follow these instructions to get the newer version with submodules.

Then, I created a new repository to help in the task to create new packages

Basically, at your GitHub account, when you create a new repository, you will get the option to create your empty project from a template.

Once you get the latest REST-for-Physics version running, you should be able to compile rest-package/dummy without major problems.

See also the README I added

Perhaps @lobis gets a cleaner version of CMake working, but this one should do the job

Hi @jgalan ,
Thank you for your reply.

I have installed the newest version of the REST 2.3.10, previously updating ROOT to version 6.24.02 (with command).

REST version : v2.3.10
REST commit : 7148a3e0

However, I am not sure if it has been installed correctly;
When I ran a command restRoot the output looks like follows:

= REST Version: v2.3.10
= Loading libraries ...
malloc(): invalid size (unsorted)
Aborted (core dumped)

Also, when I am trying to run an example 05.PandaXIII, another error appears:

restG4 -c Xe136bb0n.rml 
CommandLineParameters::ProcessParameters - Cannot specify multiple rml files  Please use at most one

Here is a list of packages and libraries, which were included during the building of REST:

specified sub-dirs: external/tinyxml;tools;core;analysis
Submodule found: libraries/axion. Option: RESTLIB_AXION=OFF
Submodule found: libraries/connectors. Option: RESTLIB_CONNECTORS=ON
Submodule found: libraries/detector. Option: RESTLIB_DETECTOR=ON
Submodule found: libraries/geant4. Option: RESTLIB_GEANT4=ON
Empty submodule dir: libraries/model. Option: RESTLIB_MODEL=OFF
Submodule found: libraries/raw. Option: RESTLIB_RAW=ON
Submodule found: libraries/track. Option: RESTLIB_TRACK=ON
Submodule found: packages/restG4. Option: REST_G4=ON
Empty submodule dir: packages/restP3DB. Option: REST_P3DB=OFF
Empty submodule dir: packages/restSQL. Option: REST_SQL=OFF

Am I doing something wrong?
Thank you in advance,

For the first error with malloc I have never seen that.

For restG4 you should not add the -c.

Just execute as:

restG4 Xe136bb0n.rml

Did you compile ROOT 6.24 yourself?

Sorry, my bad.
In the help message restG4 -h was still written that the -c option must be added before the config file.

I used the script with the modified installation path.

The full script is here:

set -e


unameOut="$(uname -s)"
case "${unameOut}" in
    Linux*)     machine=Linux;;
    Darwin*)    machine=Mac;;
    CYGWIN*)    machine=Cygwin;;
    MINGW*)     machine=MinGw;;
    *)          machine="UNKNOWN:${unameOut}"


mkdir -p ${ROOT_DIR}
cd ${ROOT_DIR}


if [ -f $f ]; then
    echo use cache build/$f
	if [ $machine == "Mac" ]; then
	    curl$f -o $f
tar -xvzf $f

rm -rf source
mv root-$ROOT_VERSION source

mkdir -p ${ROOT_DIR}/build
cd ${ROOT_DIR}/build

cmake -DCMAKE_CXX_STANDARD=17 -Dgdml=ON -DCMAKE_INSTALL_PREFIX=${ROOT_DIR}/install  ../source
make -j10
make install


echo ""
echo "Execute this to load the recently compiled ROOT version in your environment"
echo "source ${ROOT_DIR}/install/bin/"
#echo "#Added by REST script to setup ROOT environment" >> ~/.bashrc
#echo "source ${ROOT_DIR}/install/bin/" >> ~/.bashrc
echo ""

Ok, that means it is compiled from sources. Perhaps the malloc is related to Garfield, since it comes just after loading RestDetector. Did you compile REST using REST_GARFIELD=ON?

Yes, I did. Although, I decided to recompile REST again and noticed that with an option REST_DECAY0 turned ON I receive an error:

[ 82%] Built target RestDetector
In file included from input_line_9:3:
/local/home/al264242/Documents/Soft/rest-framework2_3/source/libraries/geant4/inc/TRestGeant4ParticleSourceDecay0.h:4:10: fatal error: 'bxdecay0/decay0_generator.h' file not found
#include <bxdecay0/decay0_generator.h>

Without the Decay0 option (but, with REST_GARFIELD=ON), REST compiles without any visible problems, but restRoot isn’t working still - core dumped after the same library.

Probably it makes sense since you are missing Decay0 libraries. But did you try to disable Garfield? REST_GARFIELD=OFF?

When you get the core dumped, it gets out of session, or it allows you to write ROOT commands?

Indeed, with the Garfield option disabled, REST compiles without problems, meaning that I can operate with restRoot.

Yes, it was quitting the session.

I forgot to ask you that: is it supposed to happen? I assumed that REST_DECAY0 must be available from the release logs.

Decay0 is optional, so you need to install decay0 libraries. Then, if you get installed Decay0 libraries, you may enable REST_DECAY0 so that you are able to use the Decay0 generator inside restG4.

So, then, the problem is related to Garfield, perhaps selecting a different Garfield version will solve. Also, make sure Garfield is compiled against the same ROOT version you use to compile REST.

Thank you, that indeed solved the problem!

Alright, I’ll look into it