Problem compiling REST (with Garfield)

Hi,

Previously, I had REST installed on my personal computer.
But, I have found a similar problem to what Elisa had here when I was trying to work with .gas files.

Thus, I decided to rebuild everything.
I am following these instructions:

ROOT and Geant4 I installed with an installROOT.sh and installGeant4.sh scripts respectively.
However, there were some problems with installing Garfield++ with a similar script, therefore I installed it manually with a help of this instruction: http://garfieldpp.web.cern.ch/garfieldpp/getting-started/.

After that, I checked if Garfield is working properly by building an example application.
My environmental variables look this way:

#Added by REST installROOT.sh script to setup ROOT environment
source /home/andriigw/apps/root-6.20.00/install/bin/thisroot.sh
#garfield++ environmental variables
export GARFIELD_HOME=~/apps/garfield
export CMAKE_PREFIX_PATH=$GARFIELD_HOME/install:${CMAKE_PREFIX_PATH}
export HEED_DATABASE=$GARFIELD_HOME/Heed/heed++/database
export LD_LIBRARY_PATH=$GARFIELD_HOME/install/lib:$LD_LIBRARY_PATH
source $GARFIELD_HOME/build/setup.sh
#Added by REST installGeant4.sh script to setup geant4 environment
source $HOME/apps/geant4.10.04.p02-install/bin/geant4.sh

Now, when I am trying to build REST with a command

~/Documents/Soft/REST_v2/build$ cmake โ€ฆ -DREST_G4=ON -DREST_GARFIELD=ON -DINSTALL_PREFIX=/home/andriigw/Documents/Soft/REST_v2/install/master/

I am facing a problem that configuration is incomplete. It looks like Garfield directory could not be found:

โ€“ The C compiler identification is GNU 7.5.0
โ€“ The CXX compiler identification is GNU 7.5.0
โ€“ Check for working C compiler: /usr/bin/cc
โ€“ Check for working C compiler: /usr/bin/cc โ€“ works
โ€“ Detecting C compiler ABI info
โ€“ Detecting C compiler ABI info - done
โ€“ Detecting C compile features
โ€“ Detecting C compile features - done
โ€“ Check for working CXX compiler: /usr/bin/c++
โ€“ Check for working CXX compiler: /usr/bin/c++ โ€“ works
โ€“ Detecting CXX compiler ABI info
โ€“ Detecting CXX compiler ABI info - done
โ€“ Detecting CXX compile features
โ€“ Detecting CXX compile features - done
โ€“ Find ROOT 6.20/00 in /home/andriigw/apps/root-6.20.00/install/bin
โ€“ GARFIELD Garfield_INCLUDE_DIRS-NOTFOUND
โ€“ HEED Include /home/andriigw/apps/garfield/Heed
โ€“ ALL INCLUDES: /home/andriigw/apps/root-6.20.00/install/includeGarfield_INCLUDE_DIRS-NOTFOUND/home/andriigw/apps/garfield/Heed
โ€“ external include directory: /home/andriigw/apps/root-6.20.00/install/includeGarfield_INCLUDE_DIRS-NOTFOUND/home/andriigw/apps/garfield/Heed
โ€“ external libraries to link: -L/home/andriigw/apps/root-6.20.00/install/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTre ePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -pthread -lm -ldl -rdynamic-lGui-lEve-lRGL-lGeom-lGdml-lMinuit-lSpectrum/home/andriigw/apps/garfield/install/lib/libGarfield.so

Also, I included my CMakeOutput.txt file here, but, I am sorry, I do not understand how to change my situation. CMakeOutput.txt (44.3 KB)

Could you, please, help me with such a problem?
Thank you in advance!

Hi, my first guess is that there is a problem with the definition of GARFIELD_HOME variable.

Are you sure it is defined?

What do you get when you do ls $GARFIELD_HOME? Do you have an include directory there?

Looking to your export listing I guess your GARFIELD_HOME is not pointing to the right place.

Probably you should do:

export GARFIELD_HOME=~/apps/garfield/install/

./installGarfield.sh is recommended because it will install a particular Garfield commit that we know it works as expected for the gas generation. What is the problem with that installation?

Thank you for your reply.

I have tried to run ./installGarfield.sh;
When it is finished I get this message:


Also, there is nothing in the ~/garfield6/lib/ directory and ~/garfield6/install/ directory does not exist.

If I am trying to build an example Garfield application Gem, I have an error:

In the meantime, if I remove ~/garfield6/build and rebuild it with commands:

cd ~/garfield6
mkdir build
cd build
cmake . .
make -j4
make install

everything looks fine; Now, the install directory contains the headers and the library:
image

In my .bashrc file Iโ€™ve set the Garfield environment like this:

export GARFIELD_HOME=~/apps/garfield6/install/
export HEED_DATABASE=$GARFIELD_HOME/Heed/heed++/database
export LD_LIBRARY_PATH=$GARFIELD_HOME/lib:$LD_LIBRARY_PATH
source /home/andriigw/apps/garfield6/build/setup.sh

Now, I can build an example application (Gem, to be more precise, which I mentioned earlier).

However, when I execute the command in order to build REST

same error occurs as before.

I also tried to build REST, by setting Garfield environment like this:

export GARFIELD_HOME=~/apps/garfield6/
export HEED_DATABASE=$GARFIELD_HOME/install/Heed/heed++/database
export LD_LIBRARY_PATH=$GARFIELD_HOME/install/lib:$LD_LIBRARY_PATH
source /home/andriigw/apps/garfield6/build/setup.sh

But, there is no result in it.
Am I doing something wrong?

Ok, I found the same problem and fixed it in the latest commit from the REST development branch.

Please, at your REST local copy checkout the development branch and pull.

cd REST_v2
git checkout development
git pull

Once you do that, if you execute git log the latest commits should agree with the following ones

Please, remove any reference to GARFIELD in your environmental variables, mainly GARFIELD_HOME and HEED_DATABASE.

Then, start again with the REST based installation process

making sure that the following variables are not defined, and therefore show nothing on screen

echo $GARFIELD_HOME
echo $HEED_DATABASE

Execute the following

export GARFIELD_HOME=$HOME/garfield6/
cd REST_v2/scripts/installation
./installGarfield.sh

The first definition of GARFIELD_HOME is optional and allows you to chose an installation path other than $HOME/apps/garfield/. Please, make sure the directory does not exist, or is empty, before executing ./installGarfield.sh.

Once Garfield works properly, clean your REST build directory and start from scratch.

cd REST_v2
rm -r build
mkdir build
cmake -DREST_GARFIELD=ON -DREST_G4=ON -DINSTALL_PREFIX=../install ../
make -j4 install

I was not aware of the file source /home/andriigw/apps/garfield6/build/setup.sh. This file defines an additional environment variable CMAKE_PREFIX_PATH that is needed to compile Garfield examples. However, it is missing LD_LIBRARY_PATH definition of Garfield that is usually needed at runtime.

In case of problems please send again all the full output of the commands executed in the single terminal since you launched ./installGarfield.sh.

Thank you very much for your help!

./installGarfield.sh works perfectly.
I have followed your instructions and now I can work with .gas files.

1 Like