# Garfield++ Installation

**URL:** <https://root-forum.cern.ch/t/garfield-installation/40820>\
**Category:** Garfield++\
**Created:** [August 4, 2020, 11:21am UTC](https://root-forum.cern.ch/t/garfield-installation/40820 "2020-08-04T11:21:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 4, 2020, 11:21am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/1 "2020-08-04T11:21:04Z")

</div>

Hi, I am using this link to install Garfield++ into Ubuntu with ROOT-6.18.04 and GEANT4.10.06.p01.

> **[Garfield++: Installation Guide](https://abhikjash.wordpress.com/2018/05/02/garfieldpp-installation-guide/)**
>
> Steps to install Garfield++ in a linux based system.

  
When i typed command  
$ _cmake $GARFIELD\_HOME -DCMAKE\_INSTALL\_PREFIX=$GARFIELD\_HOME/garfieldpp-install_  
error occured(see screenshot).  
Please help me.  
 ![Screenshot from 2020-08-04 16-14-05](https://root-forum.cern.ch/uploads/default/original/3X/c/4/c4797cb9ee577f02b4520561c1c864f26533419c.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 4, 2020, 11:38am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/2 "2020-08-04T11:38:20Z")

</div>

Hi,  
it looks like CMake doesn’t find your ROOT installation. Did you source the `thisroot.sh` script before building Garfield++?

Best regards,  
Heinrich

PS: the instructions given on the link that you sent don’t seem to be fully up to date (the plain makefile and the garfroot executable don’t exist anymore).  
I would recommend following the “official” instructions on the Garfield++ website:  
[http://garfieldpp.web.cern.ch/garfieldpp/getting-started/](http://garfieldpp.web.cern.ch/garfieldpp/getting-started/)  
or on gitlab:

> **[garfield / garfieldpp](https://gitlab.cern.ch/garfield/garfieldpp)**
>
> http://garfieldpp.web.cern.ch/garfieldpp/

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 4, 2020, 1:19pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/3 "2020-08-04T13:19:46Z")

</div>

Thank you for your response!  
I also tried with the official installation guide but stuck there(see screenshot)

 ![Screenshot from 2020-08-04 15-40-43](https://root-forum.cern.ch/uploads/default/original/3X/0/2/02dcca2938032199540cd19f80dbac4ee9c5a278.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 4, 2020, 1:47pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/4 "2020-08-04T13:47:47Z")

</div>

You have to provide a target. Try

`cmake $GARFIELD_HOME`

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 4, 2020, 2:55pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/5 "2020-08-04T14:55:37Z")

</div>

I tried with another procedure and installed it.  
Now i wanna run its GEM example when i try to copy the folder to a local directory by using:

```auto
cp -r $GARFIELD_HOME/Examples/Gem

```

it did’t copy and the error is in the screenshot

 ![Screenshot from 2020-08-04 19-50-49](https://root-forum.cern.ch/uploads/default/original/3X/e/d/ed6ccf270e2e4e712a11cd4f7f0afc1e0bb9b02d.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 4, 2020, 3:07pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/6 "2020-08-04T15:07:07Z")

</div>

You have to specify where to copy the folder. For instance, to copy it to your local directory, type  
`cp -r $GARFIELD_HOME/Examples/Gem .`

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 4, 2020, 4:52pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/7 "2020-08-04T16:52:48Z")

</div>

> [@Fatal error when trying to run the Gem example](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995/7):
>
> Below, you can find simple instructions on how to build Garfield++ (with examples) 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 --depth=1 https://gitlab.cern.ch/garfield/garfieldpp.git ${GARFIEL…

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 4, 2020, 5:14pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/8 "2020-08-04T17:14:47Z")

</div>

Thank you for your response. It really helped me a lot. But in the when i execute make command then a fatal error occurred(see screenshot).

 ![Screenshot from 2020-08-04 22-11-21](https://root-forum.cern.ch/uploads/default/original/3X/1/a/1ac1d2dcf8cdd4538d14cd1131cbbf467c0e3eae.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 4, 2020, 5:42pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/9 "2020-08-04T17:42:28Z")

</div>

@mato do you have an idea what could be the issue?  
Some people have reported that they managed to solve this by using the binary distribution of ROOT.  
You could also try the recipe given here:

> [@Fatal error when trying to run the Gem example](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995/7):
>
> Below, you can find simple instructions on how to build Garfield++ (with examples) 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 --depth=1 https://gitlab.cern.ch/garfield/garfieldpp.git ${GARFIEL…

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 4, 2020, 5:47pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/10 "2020-08-04T17:47:15Z")

</div>

Inspect the output of (see if you have ROOT includes there): `root-config --incdir`

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 5, 2020, 1:31am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/11 "2020-08-05T01:31:50Z")

</div>

when i typed “root-config --incdir” than error is “root-config command not found”

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 5, 2020, 6:35am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/12 "2020-08-05T06:35:22Z")

</div>

Did you source the `thisroot.sh` script?

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 6, 2020, 1:40am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/13 "2020-08-06T01:40:15Z")

</div>

Yes i did, but still same error.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 6, 2020, 7:16am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/14 "2020-08-06T07:16:32Z")

</div>

This suggests that you have a broken ROOT distribution.

The `root-config` should be in the same place as `thisroot.sh` and `root`.

---

<div class="post-metadata">

**Author:** ![mato](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mato/32/12317_2.png) [@mato](https://root-forum.cern.ch/u/mato)\
**Post date:** [August 10, 2020, 9:29am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/15 "2020-08-10T09:29:59Z")

</div>

The problem is that the ROOT installation is incomplete. As far I can see you did source `root-6.18.04/build/bin/thisroot.sh` which indicates that you are using the binaries and configuration files produced during the build process. Did you ‘install’ ROOT after building it with `make install`?  
The difference is that the CMake configuration files, such as `ROOTConfig.cmake` that will chain the target include directories dependencies will assume that you have installed ROOT after building it.  
You just need to finish the installation of ROOT specifying the location where you want the installation to be with `-DCMAKE_INTALL_PREFIX=/home/afzaal/root-6.18.04/install` and issue a `make install`. Then `source /home/afzaal/root-6.18.04/install/bin/thisroot.sh`.

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 10, 2020, 10:43am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/16 "2020-08-10T10:43:41Z")

</div>

Thanks for your response!  
Really my root installation is incomplete. But when i give “make install” command  
then error is "[100%] Built target hist2workspace  
Install the project…  
– Install configuration: “RelWithDebInfo”  
– Up-to-date: /usr/local/lib  
CMake Error at cmake\_install.cmake:41 (file):  
file INSTALL cannot set permissions on “/usr/local/lib”: Operation not  
permitted.  
Further more when i give following command after it  
"-DCMAKE\_INSTALL\_PREFIX=/home/afzaal/root-6.18.04/install than error is “No such file or directory”.  
Really need solution to complete install root.  
Thanks.

---

<div class="post-metadata">

**Author:** ![mato](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mato/32/12317_2.png) [@mato](https://root-forum.cern.ch/u/mato)\
**Post date:** [August 10, 2020, 10:58am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/17 "2020-08-10T10:58:41Z")

</div>

The complete command in the build directory is:

`cmake -DCMAKE_INSTALL_PREFIX=/home/afzaal/root-6.18.04/install .`  
`make install`

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 10, 2020, 11:03am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/18 "2020-08-10T11:03:04Z")

</div>

Ok but now error is  
CMake Warning:  
No source or binary directory provided. Both will be assumed to be the  
same as the current working directory, but note that this warning will  
become a fatal error in future CMake releases.

CMake Error: The source “/home/afzaal/root-6.18.04/build/CMakeLists.txt” does not match the source “/home/afzaal/root-6.18.04/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.  
Where i did mistake?

---

<div class="post-metadata">

**Author:** ![mato](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mato/32/12317_2.png) [@mato](https://root-forum.cern.ch/u/mato)\
**Post date:** [August 10, 2020, 11:40am UTC](https://root-forum.cern.ch/t/garfield-installation/40820/19 "2020-08-10T11:40:48Z")

</div>

I was assuming that:

- Your current directory was the build directory of ROOT
- That you had previously configured (cmake …) and build (make …) the full ROOT project

And I didn’t want that you had to wait to re-build everything from starch again.

This seems not to be the case. Therefore follow the instructions from [here](https://root.cern/install/build_from_source/) or download a binary installation from [https://root.cern/releases/release-61804/](https://root.cern/releases/release-61804/)

---

<div class="post-metadata">

**Author:** ![Afzaal786](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afzaal786/32/20527_2.png) [@Afzaal786](https://root-forum.cern.ch/u/Afzaal786)\
**Post date:** [August 10, 2020, 1:39pm UTC](https://root-forum.cern.ch/t/garfield-installation/40820/20 "2020-08-10T13:39:48Z")

</div>

Thank you very much mato! Your responses really helped me a lot. I executed all commands that you told successfully (hope this time ROOT is properly installed).  
Cheers

[Next page](https://root-forum.cern.ch/t/garfield-installation/40820.md?page=2)
