TMVA and building on a Mac

Hello,

I’m trying to build TMVA in Mac OS X 10.7.3 according to the how to with an installation of root 5.32/01 that I built from source. It gives the error

Building shared library lib/libTMVA.dylib ... ld: duplicate symbol TMVA::Configurable::Class_Name()      in obj/TMVA_Dict1.o and obj/G__TMVA1.o for architecture x86_64
collect2: ld returned 1 exit status
make: *** [lib/libTMVA.dylib] Error 1

I guess this might be related to this bug report, but adding “$(shell root-config --ldflags)” (which resolves to -m64) to that line in the Makefile has no effect for me. I’ve also tried sourcing the setup.sh file in tmva/test, but no luck.

Any help appreciated!

I’ve used TMVA a little bit, but I’ve never gone through that setup process.

Could I suggest maybe having a look at these statistics courses, in particular problem sheet 7 and the accompanying datafiles as they might help set up TMVA for you, although not necessarily solve your issue.

Ian

Hi Ian, thanks for the feedback. Compiling and running those files does work for me, for whatever reason, but doesn’t seem to get me any closer to compiling and running TMVA itself for my own purposes, alas.

For future reference: I got this to work my downloading TMVA (4.1.2) source from the home page, then compiling that. But! I did need to change a few lines in TMVA’s source. The function TMath::Power wasn’t able to cast a UInt_t to a Int_t, I gather, so I needed to do this:

[code]diff -u TMVA-v4.1.2\ 2/src/MethodPDERS.cxx TMVA-v4.1.2/src/MethodPDERS.cxx
— TMVA-v4.1.2 2/src/MethodPDERS.cxx 2011-07-20 08:37:13.000000000 -0700
+++ TMVA-v4.1.2/src/MethodPDERS.cxx 2012-04-17 14:18:00.000000000 -0700
@@ -988,7 +988,7 @@
}

// Normalizing by the full volume
  • ret *= ( TMath::Power (2., GetNvar()) * TMath::Gamma (1 + (((Double_t) GetNvar()) / 2.)) ) /
  • ret *= ( TMath::Power (2., (Int_t) GetNvar()) * TMath::Gamma (1 + (((Double_t) GetNvar()) / 2.)) ) /
    TMath::Power (TMath::Pi(), ((Double_t) GetNvar()) / 2.);

    return ret*pdf;
    @@ -1023,9 +1023,9 @@
    Double_t ret;

    if (GetNvar() % 2)

  •  ret = TMath::Power (sinc, GetNvar());
    
  • ret = TMath::Power (sinc, (Int_t) GetNvar());
    
    else
  •  ret = TMath::Abs (sinc) * TMath::Power (sinc, GetNvar() - 1);
    
  • ret = TMath::Abs (sinc) * TMath::Power (sinc, (Int_t) GetNvar() - 1);
    

    return ret;
    }
    @@ -1043,8 +1043,8 @@
    Double_t lanczos = (TMath::Sin(pix) / pix) * (TMath::Sin(pixtimesn) / pixtimesn);
    Double_t ret;

  • if (GetNvar() % 2) ret = TMath::Power (lanczos, GetNvar());
  • else ret = TMath::Abs (lanczos) * TMath::Power (lanczos, GetNvar() - 1);
  • if (GetNvar() % 2) ret = TMath::Power (lanczos, (Int_t) GetNvar());

  • else ret = TMath::Abs (lanczos) * TMath::Power (lanczos, (Int_t) GetNvar() - 1);

    return ret;
    }[/code]
    Now it compiles and seems to be working. Also [url=https://root-forum.cern.ch/t/tmva-problem-in-example-script/13942/1 problem[/url] with the example script.