[ROOT-6856] Root5 TTreeFormula on OSX 10.10 Yosemite Created: 28/Oct/14  Updated: 30/Oct/14  Resolved: 30/Oct/14

Status: Closed
Project: ROOT
Component/s: None
Affects Version/s: 5.34/00
Fix Version/s: 6.04.00, 5.34/23, 6.02/02

Type: Bug Priority: High
Reporter: Samuel Hall (Inactive) Assignee: Philippe Canal
Resolution: Fixed Votes: 0
Labels: None

Mac OSX10.10 Yosemite, with a few versions of root v5-34-22

Attachments: File tformula_example.cc    



After successful compilation of ROOT, I tried compiling my code, all of which seems to be fine except for when I want to use TTreeFormula when I get a linker error.

For example if my code is as attached, and I make (with -lTreePlayer), I get the following error:
Undefined symbols for architecture x86_64:
"double TTreeFormula::EvalInstance<double>(int, char const**)", referenced from:
_main in aaa.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/scphall/work/inflaton/selection/bin/aaa] Error 1

What am I missing?


Comment by Pere Mato Vila [ 29/Oct/14 ]

I think what is needed is a set of explicit template instantiations. The following patch works for me. Can you please try?

--- a/tree/treeplayer/src/TTreeFormula.cxx
+++ b/tree/treeplayer/src/TTreeFormula.cxx
@@ -4346,6 +4346,8 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
    //std::cout << __PRETTY_FUNCTION__ << "  returning " << tab[0] << std::endl;
    return tab[0];
+// Template instantiations
+template double TTreeFormula::EvalInstance<double> (int, char const**);
 TFormLeafInfo *TTreeFormula::GetLeafInfo(Int_t code) const

Comment by Samuel Hall (Inactive) [ 30/Oct/14 ]

Hi Pere,

That worked for me straight away!
Thank you very much indeed.


Comment by Philippe Canal [ 30/Oct/14 ]


The fix has been uploaded to the v5-34 and v6-02 patch branches and the master.


Generated at Tue Aug 11 06:19:00 CEST 2020 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.