I have just finished installing Garfield++ by following the instructions from: http://garfieldpp.web.cern.ch/garfieldpp/getting-started/. When I try to build and run a given example following the instructions from the same website. I get an error stating:
How do I fix this issue? My suspicion is that perhaps I may have install ROOT incorrectly?
To install ROOT, I did the following:
1)Download root_v6.20.02.source.tar.gz
2)Extract the file using tar -xzvf root_v6.20.02.source.tar.gz root-6.20.02
3)cmake β¦/root-6.20.02/ -Dall=ON
4)cmake --build . β -j6
After this, I tried running root and everything seems fine.
Another thing I have noticed is that when I try to do
I got an error about not being able to find this directory. Please let me know if there is anything else I need to provide to make the problem more clear. Thank you.
Hi,
the square brackets in the line cmake [-DCMAKE_INSTALL_PREFIX=<installdir>] [-DWITH_DOCS=ON] [-DWITH_EXAMPLES=ON] $GARFIELD_HOME
are meant to indicate that the respective parameter is optional. If you are happy with the default settings you can just run cmake $GARFIELD_HOME
which will place the install directory in $GARFIELD_HOME.
Can you delete and recreate the build folder in $GARFIELD_HOME and re-build the project (re-run the cmake and make steps)?
Sorry, I was a bit unclear in my first reply. After redoing cmake $GARFIELD_HOME and make, please also re-run make install . $GARFIELD_HOME/build/setup.sh
and re-build the GEM example application (delete and recreate the build folder).
Below, you can find simple instructions how to build it from scratch.
Try (in case of problems, inspect the three created β*.out.txtβ files):
# ... assuming you are using a bash like shell ...
source /full/path/to/your/root/bin/thisroot.sh # setup your ROOT
export GARFIELD_HOME=${PWD}/garfieldpp # where to build Garfield++
rm -rf ${GARFIELD_HOME} # make sure you start with an empty directory
git clone https://gitlab.cern.ch/garfield/garfieldpp.git ${GARFIELD_HOME}
cd ${GARFIELD_HOME}
mkdir build
cd build
cmake -DWITH_EXAMPLES=ON ${GARFIELD_HOME} 2>&1 | tee -a cmake.out.txt
make 2>&1 | tee -a make.out.txt
make install 2>&1 | tee -a make.install.out.txt
# ls -al Examples/Gem # "gem" should be there
# source ./setup.sh # setup this Garfield++ (if you want to use it now)
If you want to build the Gem example in another separate directory, try (in case of problems, inspect the two created β*.out.txtβ files):
# ... assuming you are using a bash like shell ...
source /full/path/to/your/root/bin/thisroot.sh # setup your ROOT
export GARFIELD_HOME=/full/path/to/your/garfieldpp # where it was built
source ${GARFIELD_HOME}/build/setup.sh # setup your Garfield++
# cd /full/path/to/where/you/want/to/build/it
rm -rf Gem # cleanup
cp -a ${GARFIELD_HOME}/Examples/Gem ./
cd Gem
mkdir build
cd build
cmake ../ 2>&1 | tee -a cmake.out.txt
make 2>&1 | tee -a make.out.txt
# ls -al # "gem" should be there
Detailed explanations can be found on the following web pages:
Thank you for your reply. This seems to fix the problem. However, it does not work if I copy the Gem directory to some local directory and then try to cmake and make. I think I have found the solution. When I do cmake for garfield, I added in two more options -DROOT_INSTALL_DIR=/where/root/include/is/include and -DROOT_LIBRARY_DIR=/where/root/lib/is/lib. This solution completely fixes my issue