# Incorrect path of ROOT\_LIBRARIES in cmake

**URL:** <https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998>\
**Category:** Newbie\
**Created:** [July 25, 2021, 2:51am UTC](https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998 "2021-07-25T02:51:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [July 25, 2021, 2:51am UTC](https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998/1 "2021-07-25T02:51:30Z")

</div>

Hi expert,

I was compiling a geant4 + root project using cmake on a WSL system (Ubuntu 18).  
The “ROOT\_INCLUDE\_DIRS” gives correct path, i.e. …/Desktop/root/include.  
However, the “ROOT\_LIBRARIES” gives …/Desktop/root2/lib/…

I believe the problem is that I had multiple installation of different ROOT versions before and one of the installation is done in a folder called root2. However, the libraries path is still in root2 even though I have already removed all folders and reinstall ROOT. Is there anyway to correct the path?

I installed ROOT using cmake to build from source before. The new installation is done by simply unpacking the binary files. Thank you very much!

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [July 26, 2021, 8:18am UTC](https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998/2 "2021-07-26T08:18:57Z")

</div>

Hello,

Could you expand a bit which commands you executed, and how they failed (e.g. error messages)? Reading the question, I’m also not quite sure if you are currently trying to get a binary release of ROOT running or if you are still trying to compile ROOT from sources.

Cheers,  
Jakob

---

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [July 26, 2021, 5:38pm UTC](https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998/3 "2021-07-26T17:38:16Z")

</div>

Hi,

Sorry for the confusion. I had a root+ geant4 project linked by using cmake. I failed to compile it because in cmake the variable ${ROOT\_LIBARAIES} returns a path corresponding to an old version of ROOT installed in my computer (although it is deleted).

I tried reinstalling ROOT and run the command “cmake …/src/” in the build folder but ${ROOT\_LIBARAIES} still use the old path. The problem is that I ranthis command in the existing build. So I simply create a new folder and the “ROOT\_LIBARAIES” gives the correct path in cmake. Thank you for your time.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 29, 2021, 9:24pm UTC](https://root-forum.cern.ch/t/incorrect-path-of-root-libraries-in-cmake/45998/4 "2021-07-29T21:24:12Z")

</div>

That looks like an issue with your Geant4 build config not being updated, right? What is `ROOT_LIBRARIES` - is that a Geant4 variable? Does that point to the location of the ROOT libraries?

If so you might be able to run, in your Geant4 build directory, `cmake -ROOT_LIBRARIES=$ROOTSYS/lib .` i.e. just updating that variable to its new value, followedd by `make -j8` or whatever you use to build Geant4.
