Missing Minuit2 Libraries

Hello,

I am trying to run Minuit2 on my other computer. I installed root 6.22.00. I have a program called niminimzation.cpp and I try to compile it by running

g++ -I/home/christian/root/include -L/home/christian/root/lib niminimzationExample.cpp -o niminimzationExample -lMinuit2

but when I do I get the following error

/usr/bin/ld: warning: libHist.so.6.22, needed by /home/christian/root/lib/libMinuit2.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libMathCore.so.6.22, needed by /home/christian/root/lib/libMinuit2.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libCore.so.6.22, needed by /home/christian/root/lib/libMinuit2.so, not found (try using -rpath or -rpath-link)
/home/christian/root/lib/libMinuit2.so: undefined reference to `TNamed::Compare(TObject const*) const'
/home/christian/root/lib/libMinuit2.so: undefined reference to `ROOT::AddClassAlternate(char const*, char const*)'
/home/christian/root/lib/libMinuit2.so: undefined reference to `TIsAProxy::TIsAProxy(std::type_info const&)'
/home/christian/root/lib/libMinuit2.so: undefined reference to `TObject::DrawClone(char const*) const'
/home/christian/root/lib/libMinuit2.so: undefined reference to `TObject::Browse(TBrowser*)'

etc. I know that all of those libraries are in /home/christian/root/lib, so I thought I would add the ones that the error says are missing, by running,

g++ -I/home/christian/root/include niminimzationExample.cpp -o niminimzationExample -L/home/christian/root/lib -lMinuit2 -lCore -lHist

but then I get the following error:

/usr/bin/ld: warning: libMathCore.so.6.22, needed by /home/christian/root/lib/libMinuit2.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libMatrix.so.6.22, needed by /home/christian/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libRIO.so.6.22, needed by /home/christian/root/lib/libHist.so, not found (try using -rpath or -rpath-link)
/home/christian/root/lib/libHist.so: undefined reference to `TMath::CauchyDist(double, double, double)'
/home/christian/root/lib/libHist.so: undefined reference to `ROOT::Math::GaussIntegrator::IntegralUp(double)'
/home/christian/root/lib/libHist.so: undefined reference to `TMatrixTColumn_const<double>::TMatrixTColumn_const(TMatrixT<double> const&, int)'
/home/christian/root/lib/libHist.so: undefined reference to `ROOT::Math::RichardsonDerivator::Derivative3(ROOT::Math::IBaseFunctionOneDim const&, double, double)'
/home/christian/root/lib/libHist.so: undefined reference to `TMath::BesselK0(double)'

So I am missing other libraries. Is there a way to include all of the necessary libraries at once, without having to go through all of this? On my other computer I have a stand-alone version of Minuit2 nd I can run it simply with

g++ -I/home/christian/root/include -L/home/christian/root/lib niminimzationExample.cpp -o niminimzationExample -lMinuit2

Thanks.
Christian

_ROOT Version: 6.22.00
_Platform: Linux Mint
_Compiler: gcc


`root-config --cxx --cflags` -o niminimzationExample niminimzationExample.cpp `root-config --libs` -lMinuit2

Thank you. But when I run that command it says

root-config: command not found

source /home/christian/root/bin/thisroot.sh

Thanks again. That fixed that part. However, not, after sourcing thisroot.sh I run the other command that you suggested and then

g++ -I/home/christian/root/include -L/home/christian/root/lib niminimzationExample.cpp -o niminimzationExample -lMinuit2

and I get the following error.

/home/christian/root/lib/libHist.so.6.22: undefined reference to `exp@GLIBC_2.29'
/home/christian/root/lib/libMinuit2.so: undefined reference to `log@GLIBC_2.29'
/home/christian/root/lib/libMinuit2.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status

Is there some library or something that I am missing?

Thanks again.

The “other command” that I “suggested” actually builds your executable (or does it return any errors?).

It returns the error

/home/christian/root/lib/libHist.so: undefined reference to `exp@GLIBC_2.29'
/home/christian/root/lib/libMinuit2.so: undefined reference to `log@GLIBC_2.29'
/home/christian/root/lib/libMinuit2.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status

It seems to suggest that your ROOT binary distribution is not compatible with your Operating System.
Are you able to run “root”?
You could also try to explicitly say: ... -lMinuit2 -lm