CMake Error, ROOTConfig.cmake could not be found while building application musrfit


_ROOT Version: v6-33-01
Platform: Ubuntu 20.04 on Windows (WSL)
Compiler: gcc/g++ I think…?


Hello,
I’m attempting to install root as a dependency for a package called musrfit and following the directions as listed at the musrfit page “Setting up musrfit on different platforms” which it doesn’t let me link to as a new user.

I don’t know much Linux and I don’t know exactly what is wrong, but I followed these instructions and got to the point of trying to install the musrfit package and I’ve ran into an error when trying to make the package.

I input

CMake Error at CMakeLists.txt:74 (find_package):
  By not providing "FindROOT.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ROOT", but
  CMake did not find one.

  Could not find a package configuration file provided by "ROOT" (requested
  version 6.18) with any of the following names:

    ROOTConfig.cmake
    root-config.cmake

  Add the installation prefix of "ROOT" to CMAKE_PREFIX_PATH or set
  "ROOT_DIR" to a directory containing one of the above files.  If "ROOT"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

This suggests I’ve done something wrong, and I think maybe it was in my installing of root as I don’t seem to be able to start root itself too, which is why I’m asking here. I’m not sure exactly if there’s a file I can edit to tell it where these config files are, or where that is, or if there’s a setting somewhere while I was building/installing Root that I needed to fix. Any help or instructions on how to request help better would be appreciated. Thank you,

To recap the page I could not link to, it has instructions which read to put in code as:

$ # creat the Apps directory if not already present
$ mkdir Apps
$ cd Apps
$ git clone http://github.com/root-project/root.git
$ cd root
$ git tag -l
$ # git tag -l will list all available tags. In the next command choose the tag v6-22-06
$ # or the latest official release number
$ git checkout -b v6-22-06 v6-22-06
$ # now ROOT is ready to be configured. Below you will find the minimal ROOT configuration needed.
$ # since we are using cmake build now, first we will need to create the build directory.
$ mkdir root_build
$ cd root_build
$ cmake ../ -Dgminimal=1 -Dasimage=1 -Dmathmore=1 -Dxml=1 -DCMAKE_INSTALL_PREFIX=../root_exec
$ # next will be the make called via cmake. If running on a multicore CPU you can speed up tremendously by
$ # calling it with the option -j <number>, where <number> is the number of threads which you want to give,
$ # e.g. cmake --build ./ --clean-first -- -j8
$ cmake --build ./ --clean-first
$ # as a last step of the ROOT build process we need to install it
$ cmake --install ./

And then as a superuser (I used sudo -s)

 echo "<home>/Apps/root/root_exec/lib" >> /etc/ld.so.conf.d/cern-root.conf
$ /sbin/ldconfig

And then edit in the ~/.profile file the lines

$ export ROOTSYS=$HOME/Apps/root/root_exec
$ export PATH=$ROOTSYS/bin:$PATH

Hello,

You should configure your package (musrfit), by passing in make the option:

-DCMAKE_PREFIX_PATH=/Apps/root/root_exec

where /Apps/root/root_exec is the top level location of the ROOT installation

Lorenzo

1 Like

Thank you for your help. This has removed that error message, and now another has occurred.

‘’‘CMake Error at /usr/local/cmake/ROOTConfig.cmake:226 (message):
ROOT component XMLParser not found
Call Stack (most recent call first):
CMakeLists.txt:74 (find_package)’‘’

I double checked and I did install ROOT with the option -Dxml enabled, which I would guess is related, so I’m not sure where to go from here.

Fixed it. Just didn’t type in the top level part of this right. Thank you again.