# CMAKE - ROOT\_DIR= does not exist

**URL:** <https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809>\
**Category:** Newbie\
**Created:** [May 1, 2022, 8:53pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809 "2022-05-01T20:53:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 1, 2022, 8:53pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/1 "2022-05-01T20:53:32Z")

</div>

ROOT Version: root\_v5.34.36 is the result of echo $ROOTSYS  
Platform: Ubuntu 20.04

Hello all,

I’m trying to install g4beamline on my Ubuntu machine and I’ve run into some issues. Running the command

cmake …/G4beamline-3.06

yields the result

CMake Error at CMakeLists.txt:94 (message):  
ROOT\_DIR= does not exist

– Configuring incomplete, errors occurred!  
See also “/home/cyrus/G4beamline-3.06/CMakeFiles/CMakeOutput.log”.

Lines 91-96 are

if(G4BL\_ROOT)  
set(ROOT\_DIR "ENV{ROOTSYS}" CACHE PATH "Directory containing Root") if(NOT IS\_DIRECTORY {ROOT\_DIR})  
message(FATAL\_ERROR “ROOT\_DIR=${ROOT\_DIR} does not exist”)  
endif()  
endif()

I’ve tried and failed some things including nuking the directory and starting again, manually setting the path, editing the .bashrc file, and a few other things but long story short I’m new to this and out of ideas. This might not be the best place to ask but stackoverflow didn’t help and the g4beamline group hasn’t accepted my invite yet. Does anyone have any suggestions for something I could try? I am also willing to provide more information, I think I’ve done everything on the checklist / included relevant info

---

<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:** [May 2, 2022, 5:58am UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/2 "2022-05-02T05:58:28Z")

</div>

“`echo $ROOTSYS`” should return “/full/path/to/your/root” directory (e.g., check “`ls $ROOTSYS/bin/root-config`”).  
In principle, “`ROOTSYS`” should be properly defined after you execute “`source /full/path/to/your/root/bin/thisroot.sh`” (in the current shell).

---

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 5, 2022, 12:42pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/3 "2022-05-05T12:42:39Z")

</div>

echo $ROOTSYS does return the filepath (and same with the ls command you suggested), I was just answering the recommended suggestion of including of what platform / version I have

---

<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:** [May 5, 2022, 12:47pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/4 "2022-05-05T12:47:53Z")

</div>

Make sure you execute (in the same terminal window):

```bash
cd /some/working/directory/not/equal/to/where/your/sources/are
source /full/path/to/your/root/bin/thisroot.sh
echo ${ROOTSYS} # just to make sure it is correct
cmake /.../G4beamline-3.06 # assuming this directory keeps your sources

```

---

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 5, 2022, 12:56pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/5 "2022-05-05T12:56:07Z")

</div>

I tried this but I’m still getting the same

> CMake Error at CMakeLists.txt:94 (message):  
> ROOT\_DIR= does not exist

error as before

---

<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:** [May 5, 2022, 12:57pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/6 "2022-05-05T12:57:28Z")

</div>

Maybe you need to delete your “working directory” first (to make sure that you start from scratch).

---

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 5, 2022, 1:21pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/7 "2022-05-05T13:21:08Z")

</div>

I nuked everything and I’m starting over - that solved those issues and a few other popped up (i.e. they were looking for incorrectly named files so that was as easy as renaming the files correctly).

I got an error about the Geant4 install/directory so I nuked that and am doing a fresh build/install of that too to see if that will also fix the errors - but thanks for the idea that got me passed that particular issue (:

---

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 5, 2022, 4:03pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/8 "2022-05-05T16:03:30Z")

</div>

After the Geant4 reinstallation I’ve run into a few more issues, but they were easy enough to fix - but I’m now stuck on

> CMake Error at g4bl/CMakeLists.txt:64 (message):  
> GSL\_DIR= does not exist

Google wasn’t particularly helpful - do you have any ideas about this problem?

---

<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:** [May 5, 2022, 4:05pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/9 "2022-05-05T16:05:22Z")

</div>

Try: `sudo apt-get install libgsl-dev`

---

<div class="post-metadata">

**Author:** ![csingleton19](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/csingleton19/32/29513_2.png) [@csingleton19](https://root-forum.cern.ch/u/csingleton19)\
**Post date:** [May 5, 2022, 4:07pm UTC](https://root-forum.cern.ch/t/cmake-root-dir-does-not-exist/49809/10 "2022-05-05T16:07:14Z")

</div>

It says I’m already using the newest version with 0 updates / upgrades
