Reading from file TGraphErrors that have been fitted gives seg fault when compiling twice

Dear users,

I just updated ROOT from 6.04 to 6.14 and ubuntu from 15 (LTS) to 18.04.
TGraphErrors were fitted with a function from an other code and then saved in a file. The fitting function is saved together with the graph (by default if I well understand).
I try to read these graphs from the file and plot them. The code worked on the previous ROOT (and gcc) version. Now I can compile and run the code, but I get this error:

Input_line_71:2:10: error: redefinition of 'TFormula____id1627201304017190959'
Double_t TFormula____id1627201304017190959(Double_t *x,Double_t *p){ return (p[0]*1.+p[1]*x[0]+p[2]*0.5*(3.*TMath::Power(x[0],2)-1.)) ; }
         ^
input_line_69:2:10: note: previous definition is here
Double_t TFormula____id1627201304017190959(Double_t *x,Double_t *p){ return (p[0]*1.+p[1]*x[0]+p[2]*0.5*(3.*TMath::Power(x[0],2)-1.)) ; }

That TFormula is indeed the TF1 function that I used for the fit. Still the code gets to the end and plots correctly. But if I compile again I get Segmentation Fault. That was not the case with the previous ROOT version.

I’m attaching an example of the code.
What am I doing wrong?

Thank you very much for your help
Cheers
Paola


_ROOT Version:ROOT 6.14/04
_Platform: Ubuntu 18.04
_Compiler: gcc 7.3.0
___test.C (1.7 KB)
test.root (12.3 KB)

Hi Paola,

Looks like the good old TFormula persistency error - @moneta could you have a look, please?

Cheers, Axel.

Thank you Axel!
Cheers
Paola

Hi,

This problem should be fixed. I cannot reproduced it with the latest master and ROOT 6.14

Lorenzo

Hi Lorenzo,

ehm, what is the “latest master”?
Do you mean that when you run my code you don’t have any error?
Cheers
Paola

Hi,

It is the latest version of the code available in GitHub. You can also find it a version built every night at CERN in cvmfs, if you want to try.

Yes, I am not getting any error when running your code

Lorenzo

Hi Lorenzo,

I got the ROOT source from here:
https://root.cern.ch/content/release-61404
last monday. Should I download and install ROOT again? Is there a difference with the latest version available in GitHub (which, I admit it, I have no clue on what it is :confused:)
Thank you very much for your help
Cheers, Paola

Hi,

The problem was reported and fixed a bit more than one month ago.
See https://sft.its.cern.ch/jira/browse/ROOT-9467

I think the build version of 6.14 that you can download has still this problem. You should build from source as explained here https://root.cern.ch/building-root or, if you can, use the version built every night at CERN cvmfs

Lorenzo

Hi,
that’s actually what I did: build it from source (downloaded last monday).
I’m a bit lost then…
Thank you
Paola

Hi

You have it probably download from a

Tar file. You should get the head of the e master or 6.14 patches from GitHub.

See Direct git repository access at

https://root.cern.ch/get-root-sources

Lorenzo

Hi,
yes, I got the .tar root_v6.14.04.source.tar.gz
Ok, I’ll try from the git repository and let you know.
Thank you very much for your help
Cheers
Paola

Hi,

I recompiled the root source from the GIT repository, download as:

git clone http://github.com/root-project/root.git

I didn’t get any error during compilation, and

here is the screen when I start root:


| Welcome to ROOT 6.15/01 https://root.cern |
| © 1995-2018, The ROOT Team |
| Built for linuxx8664gcc on Nov 02 2018, 12:03:00 |
| From heads/master@v6-13-04-1996-gcd6290ba1c |
| Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’ |


so I guess I really got the master from the GIT.
Also the ROOT version was 6.14 and now it is 6.15.

I can compile and run the test.C code, and don’t have anymore the warning

Input_line_71:2:10: error: redefinition of 'TFormula____id1627201304017190959' Double_t TFormula____id1627201304017190959(Double_t *x,Double_t *p){ return (p[0]*1.+p[1]*x[0]+p[2]*0.5*(3.*TMath::Power(x[0],2)-1.)) ; }

but when I try to compile the second time I still get a segmentation fault.
I attach the stack trace in the uploaded file.
Do you have an idea of the problem?

Thank you very much for your help

Cheers
Paola

stack.txt (7.4 KB)

Hi

Good that with the master (6.15) it works now.
For your second problem, I cannot reproduce it. But, first of all in ROOT 6 you really don’t need to compile the macros. Using AClic it is not in general either faster or better, since Cling is a real compiler.
Second we don’t have full support for reloading macros a second time, after being executed. This because the unloading of the symbols does not work 100%. It is better exiting ROOT and re-execute the macro

Cheers

Lorenzo

Does it mean that Paola should do

.x test.C

instead of

.L test.C

Second we don’t have full support for reloading macros a second time, after being executed. This because the unloading of the symbols does not work 100%. It is better exiting ROOT and re-execute the macro

Is there any JIRA ticket to track this issue?

Hi,

What I have said that it is not recommended to re-load the macro, i.e. doing

.L test.C
test()
.L test.C
test()

Lorenzo

Plenty: https://sft.its.cern.ch/jira/browse/ROOT-7939?jql=project%20%3D%20ROOT%20AND%20resolution%20%3D%20Unresolved%20AND%20text%20~%20"unloading"%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC

It’s a known major annoyance.

Axel.

1 Like

…but instead:

.L text.C
test()
test()

Hello,
thank you to everybody!
Sure I can run twice without recompiling. The reason for recompiling is that I change the code meanwhile :stuck_out_tongue: And I do need to compile because the macro that I sent you is just a small part of a much bigger code.
Lorenzo, which version of gcc do you use? Because you say you cannot reproduce the seg fault, so as we use the same version, a difference could be the compiler.
Thank you very much

Cheers
Paola

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.