Problem with building ROOT: MathMore error

Hi,
I was trying to install ROOT from the git repository.
First, I cloned the package: git clone https://github.com/root-project/root.git
Then, in the build directory, I run:
cmake . .
cmake --build . -j8

and I got this error:

CMakeFiles/MathMore.dir/src/GSLNLSMinimizer.cxx.o: In function ROOT::Math::GSLMultiFit::CovarMatrix() const': /home/ramij/root/math/mathmore/src/GSLMultiFit.h:185: undefined reference togsl_multifit_fdfsolver_jac’
CMakeFiles/MathMore.dir/src/GSLNLSMinimizer.cxx.o: In function ROOT::Math::GSLNLSMinimizer::Minimize()': GSLNLSMinimizer.cxx:(.text+0x139c): undefined reference togsl_multifit_fdfsolver_jac’
GSLNLSMinimizer.cxx:(.text+0x142b): undefined reference to gsl_multifit_fdfsolver_jac' GSLNLSMinimizer.cxx:(.text+0x1906): undefined reference togsl_multifit_fdfsolver_jac’
GSLNLSMinimizer.cxx:(.text+0x1f88): undefined reference to `gsl_multifit_fdfsolver_jac’
collect2: error: ld returned 1 exit status
gmake[2]: *** [lib/libMathMore.so] Error 1
gmake[1]: *** [math/mathmore/CMakeFiles/MathMore.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs…

A screenshot is attached below.
Please help me with this.

May be @amadio has some idea about it.

Hi, do you use builtin_gsl? Or do you have GSL installed in your system? If the latter, what version do you have installed? Please provide more information about the operating system and compiler you are using. Thanks.

GSL version: gsl-1.15-13.el7.x86_64.rpm
Operating System: CentOS Linux 7 (Core)
Kernel: Linux 3.10.0-693.el7.x86_64
Compiler:
gcc.x86_64 4.8.5-28.el7_5.1
gcc-c++.x86_64 4.8.5-28.el7_5.1
gcc-gfortran.x86_64 4.8.5-28.el7_5.1

Do you have “gsl-devel-1.15-13.el7.x86_64” installed, too?

Yes.

/install/centos7.4/x86_64/Packages/gsl-1.15-13.el7.i686.rpm
/install/centos7.4/x86_64/Packages/gsl-1.15-13.el7.x86_64.rpm
/install/centos7.4/x86_64/Packages/gsl-devel-1.15-13.el7.i686.rpm
/install/centos7.4/x86_64/Packages/gsl-devel-1.15-13.el7.x86_64.rpm

What do you get from:

which gsl-config
rpm -qf `which gsl-config`
gsl-config --version
gsl-config --prefix
grep GSL_MAJOR_VERSION `gsl-config --prefix`/include/gsl/gsl_version.h

which gsl-config
/usr/local/bin/gsl-config

rpm -qf which gsl-config
file /usr/local/bin/gsl-config is not owned by any package

gsl-config --version
2.5

gsl-config --prefix
/usr/local

grep GSL_MAJOR_VERSION gsl-config --prefix/include/gsl/gsl_version.h
#define GSL_MAJOR_VERSION 2

As you can see, you have another GSL version in “/usr/local”. You need to use something like:

cmake -DGSL_DIR=/usr/local ..

In the build directory
cmake -DGSL_DIR=/usr/local …
cmake --build . -j8

Output:
[ 80%] Building CXX object math/genvector/CMakeFiles/GenVector.dir/src/BoostZ.cxx.o
[ 80%] Building CXX object math/matrix/CMakeFiles/Matrix.dir/src/TMatrixTSym.cxx.o
[ 80%] Linking CXX shared library …/…/lib/libMathMore.so
[ 80%] Building CXX object geom/geom/CMakeFiles/Geom.dir/src/TGeoBuilder.cxx.o
CMakeFiles/MathMore.dir/src/GSLNLSMinimizer.cxx.o: In function ROOT::Math::GSLMultiFit::CovarMatrix() const': /home/ramij/root/math/mathmore/src/GSLMultiFit.h:185: undefined reference togsl_multifit_fdfsolver_jac’
CMakeFiles/MathMore.dir/src/GSLNLSMinimizer.cxx.o: In function ROOT::Math::GSLNLSMinimizer::Minimize()': GSLNLSMinimizer.cxx:(.text+0x139c): undefined reference togsl_multifit_fdfsolver_jac’
GSLNLSMinimizer.cxx:(.text+0x142b): undefined reference to gsl_multifit_fdfsolver_jac' GSLNLSMinimizer.cxx:(.text+0x1906): undefined reference togsl_multifit_fdfsolver_jac’
GSLNLSMinimizer.cxx:(.text+0x1f88): undefined reference to `gsl_multifit_fdfsolver_jac’
collect2: error: ld returned 1 exit status
gmake[2]: *** [lib/libMathMore.so] Error 1
gmake[1]: *** [math/mathmore/CMakeFiles/MathMore.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs…

Try cmake -DCMAKE_PREFIX_PATH=/usr/local ... instead. When you use -D<PKG_DIR>=... you need to pass the directory where its CMake config file resides, not the prefix. You may also have better luck passing -DGSL_ROOT_DIR=..., as that’s what cmake --help-module FindGSL tells me to do. Cheers,

@axel So, it seems there is a bug on the “Building ROOT” web page which mentiones “GSL_DIR” while it should be “GSL_ROOT_DIR”.

Thanks, updated! @amadio anything else that’s obviously wrong on that page?

Yes, that page is overdue for an update…

@ramijiiti Can you try (and report the result):

cmake -DGSL_ROOT_DIR=/usr/local ..

Note also that your cmake --version should return “3.13.5” (which is the current default “cmake3” on CentOS 7) or any newer version.

It worked.
Thanks everyone for your help.

I’d actually prefer that we simply state where to find the info, instead of having yet another place that we need to keep updated. cmake --something?

In this particular case, it’s cmake --help-module FindGSL.