# Fatal error when trying to run the Gem example

**URL:** <https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995>\
**Category:** Garfield++\
**Created:** [June 20, 2020, 6:08am UTC](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995 "2020-06-20T06:08:47Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [June 20, 2020, 4:10pm UTC](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995/7 "2020-06-20T16:10:58Z")

</div>

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):

```bash
# ... 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 ${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 ./setupGarfield.sh # setup this Garfield++ (if you want to use it now)

```

If you want to build, e.g., the [Gem](https://gitlab.cern.ch/garfield/garfieldpp/tree/master/Examples/Gem) example in another separate directory, try (in case of problems, inspect the two created “`*.out.txt`” files):

```bash
# ... 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/setupGarfield.sh # setup your Garfield++
# cd /full/path/to/where/you/want/to/play/with/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:

- [Garfield++ → Getting started](https://garfieldpp.web.cern.ch/garfieldpp/getting-started/)
- [Garfield++ → README.md](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/README.md)

---

_[View the full topic](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995)._
