ROOT6 - Canvas won't display

Dear all,

I am on Ubuntu 15.04 using gcc-4.9.1.

I am tracking the root master branch. I had not “pulled” for about three weeks and now I am at commit “18d2af2” on “origin/v6-04-00-patches”.

I have noticed that the following does not work anymore in cling:

TFile *_file0 = TFile::Open("fileContainingHist.root")
TCanvas can("can")
 can.cd()
someHist->Draw()
TFile out("out.root", "recreate")
can.Write()
.q
#################################
TFile *_file0 = TFile::Open("out.root")
can->Draw()

The code above that tries to draw the canvas from “out.root” throws messages such as:

Warning in <TCanvas::ResizePad>: can width changed from 0 to 10
Warning in <TCanvas::ResizePad>: can height changed from 0 to 10
Error in <DrawFillAreaAux>: invalid pad's geometry

The issue does not appear if using the “origin/v5-34-00-patches” branch.

Many thanks in advance.

Best regards,
Valérian

Dear all,

I actually believe that the issue is related to the new Ubuntu 15.04 qt5 updates as I now have a qt5-like fancier toolbar.

I still have libqt4 installed though, and “./configure -enable-qt” outputs:

Checking for Qt/qglobal.h ... /usr/include/qt4
Checking for 4.8.0 <= Qt version < 5.0.0  ... 4.8.6
Checking for libQtCore, QtCore, QtCore4, or QtCore4 ... /usr/lib/x86_64-linux-gnu
Checking for libQtGui, QtGui, QtGui4, or QtGui4 ... /usr/lib/x86_64-linux-gnu
Checking for libQt3Support, Qt3Support, Qt3Support4, or Qt3Support4 ... /usr/lib/x86_64-linux-gnu

Best regards,
Valérian

Dear all,

This is not really solved, and I am still puzzled by the fact that ROOT sees qt4 but remains broken with partial qt5 features.

A simple way to test the bug is to save a prefectly valid plot (with a TFormula in the axis’ title) as a .root file and then to try to read and plot the canvas thus saved. Doing so produces the following stack trace that may help developers:

root [0] 
Attaching file pu_rate.root as _file0...
(class TFile *) 0x25bde90
root [1] c1->Draw()
Error in <TClingCallFunc::make_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) extern "C" void __cf_0(void* obj, int nargs, void** args, void* ret)
{
   if (ret) {
      new (ret) (double) (TFormula____id9969618711553705186(*(double**)args[0], *(double**)args[1]));
      return;
   }
   else {
      TFormula____id9969618711553705186(*(double**)args[0], *(double**)args[1]);
      return;
   }
}
#pragma clang diagnostic pop
  ==== SOURCE END ====
Warning in <TCanvas::ResizePad>: c1 width changed from 0 to 10

Warning in <TCanvas::ResizePad>: c1 height changed from 0 to 10


 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fdf444dc84a in __GI___waitpid (pid=2962, stat_loc=stat_loc
entry=0x7ffc863a6df0, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1  0x00007fdf44455ffb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007fdf453def91 in TUnixSystem::StackTrace() () from /home/vsibille/Applications/root/lib/libCore.so
#3  0x00007fdf453e0f1c in TUnixSystem::DispatchSignals(ESignals) () from /home/vsibille/Applications/root/lib/libCore.so
#4  <signal handler called>
#5  0x0000000000000000 in ?? ()
#6  0x00007fdf38a47819 in TFormula::DoEval(double const*, double const*) const () from /home/vsibille/Applications/root/lib/libHist.so
#7  0x00007fdf38a7f939 in TF1::EvalPar(double const*, double const*) () from /home/vsibille/Applications/root/lib/libHist.so
#8  0x00007fdf38a868b3 in TF1::DoCreateHistogram(double, double, bool) () from /home/vsibille/Applications/root/lib/libHist.so
#9  0x00007fdf38a85f89 in TF1::Paint(char const*) () from /home/vsibille/Applications/root/lib/libHist.so
#10 0x00007fdf37755804 in TGraphPainter::PaintGraphSimple(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#11 0x00007fdf37761d73 in TGraphPainter::PaintGraphErrors(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#12 0x00007fdf382595b3 in TPad::PaintModified() () from /home/vsibille/Applications/root/lib/libGpad.so
#13 0x00007fdf38273e06 in TCanvas::Update() () from /home/vsibille/Applications/root/lib/libGpad.so
#14 0x00007fdf410ec239 in TCling::UpdateAllCanvases() () from /home/vsibille/Applications/root/lib/libCling.so
#15 0x00007fdf411094b4 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/vsibille/Applications/root/lib/libCling.so
#16 0x00007fdf410e7157 in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/vsibille/Applications/root/lib/libCling.so
#17 0x00007fdf44f37017 in TRint::HandleTermInput() () from /home/vsibille/Applications/root/lib/libRint.so
#18 0x00007fdf453e06ad in TUnixSystem::CheckDescriptors() () from /home/vsibille/Applications/root/lib/libCore.so
#19 0x00007fdf453e17ba in TUnixSystem::DispatchOneEvent(bool) () from /home/vsibille/Applications/root/lib/libCore.so
#20 0x00007fdf4533f564 in TSystem::InnerLoop() () from /home/vsibille/Applications/root/lib/libCore.so
#21 0x00007fdf4533d9a1 in TSystem::Run() () from /home/vsibille/Applications/root/lib/libCore.so
#22 0x00007fdf4534c6ef in TApplication::Run(bool) () from /home/vsibille/Applications/root/lib/libCore.so
#23 0x00007fdf44f3844b in TRint::Run(bool) () from /home/vsibille/Applications/root/lib/libRint.so
#24 0x0000000000401050 in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x0000000000000000 in ?? ()
#6  0x00007fdf38a47819 in TFormula::DoEval(double const*, double const*) const () from /home/vsibille/Applications/root/lib/libHist.so
#7  0x00007fdf38a7f939 in TF1::EvalPar(double const*, double const*) () from /home/vsibille/Applications/root/lib/libHist.so
#8  0x00007fdf38a868b3 in TF1::DoCreateHistogram(double, double, bool) () from /home/vsibille/Applications/root/lib/libHist.so
#9  0x00007fdf38a85f89 in TF1::Paint(char const*) () from /home/vsibille/Applications/root/lib/libHist.so
#10 0x00007fdf37755804 in TGraphPainter::PaintGraphSimple(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#11 0x00007fdf37761d73 in TGraphPainter::PaintGraphErrors(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#12 0x00007fdf382595b3 in TPad::PaintModified() () from /home/vsibille/Applications/root/lib/libGpad.so
#13 0x00007fdf38273e06 in TCanvas::Update() () from /home/vsibille/Applications/root/lib/libGpad.so
#14 0x00007fdf410ec239 in TCling::UpdateAllCanvases() () from /home/vsibille/Applications/root/lib/libCling.so
===========================================================

Best regards,
Valérian

The problem you encounter seems very basic. What do you get when you do:

$ root
   ----------------------------------------------------------------
  | Welcome to ROOT 6.05/01                    http://root.cern.ch |
  |                                   (c) 1995-2014, The ROOT Team |
  | Built for macosx64                                             |
  | From heads/master@v6-05-01-257-g171278e, Jun 29 2015, 15:30:56 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'     |
   ----------------------------------------------------------------

root [0] TCanvas C
root [1] gPad->DrawFrame(0., 0., 1., 1.)
root [2] 

Thank you for your answer! So now I have completely recompilled ROOT with CMake following a suggestion from a colleague.

The commands

root [0] TCanvas C
root [1] gPad->DrawFrame(0., 0., 1., 1.)

do work painlessly, but all the work above still does not work.

Best regards,
Valérian

May be that’s a problem with the saved canvas c1 you are trying to draw.
Try to save the canvas produced by DrawFrame in a root file and plot in back in a new root session.

I have got the very same issue and the Canvas after having been saved won’t display.

Here is what I did:

  1. Successfully drew and saved the Canvas
root [0] TCanvas c
(TCanvas &) @0x7fe040847028
root [1] gPad->DrawFrame(0., 0., 1., 1.)
(class TH1F *) 0x225e420
root [2] Info in <TCanvas::SaveAs>: ROOT file /home/vsibille/Documents/dchooz/try.root has been created
root [2] .q

The canvas was successfully drawn and saved.

  1. Sucessfully opened the saved file but could not draw the saved canvas
root [0] 
Attaching file /home/vsibille/Documents/dchooz/try.root as _file0...
(class TFile *) 0x1df3820
root [1] .ls
TFile**		/home/vsibille/Documents/dchooz/try.root	
 TFile*		/home/vsibille/Documents/dchooz/try.root	
  KEY: TCanvas	c1;1	c1
root [2] c1->Draw()
Warning in <TCanvas::ResizePad>: c1 width changed from 0 to 10

Warning in <TCanvas::ResizePad>: c1 height changed from 0 to 10

We can reproduce it.

Hi,

just FYI.

I tried to recreate the problem (out of curiosity), but it does not fail on my machine.

root: v6-03-02
uname -a:
Linux scott 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux

The system has both, libqt4 (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1) and libqt5 (5.3.2+dfsg-4+deb8u1) installed.

Cheers,
Jochen

Hi jkerdels,

Thank you! I don’t know much, but I am on Ubuntu 15.04 with Linux kernel 3.19.0-21. Ubuntu 15.04 ships with qt 4.8.6 and qt 5.4.1, which may explain the different results. To me, qt 5.4.1 is somehow interfering with the qt ROOT sees though it says it only sees 4.8.6 when configuring.

Best regards,
Valérian

That’s not Ubuntu specific. I get it with the ROOT master (6.05) on Mac.

OK, thank you, so this is indeed specific to some commit and not related to any qt5 updates (I do have fancier ROOT windows and buttons now).

(I know I could checkout out a previous commit and recompile ROOT to see when the problem appeared, but it sounds like a lengthy process…)

Hi,

This is now fixed in git master.

Cheers, Bertrand.

Thanks Bertrand :slight_smile:

Thank you! I will pull and try!

EDIT: So the simple example with the gPad now works, and so do other examples with many TH1’s or TGraph’s saved in one TCanvas for instance, which is great!
However, I still have an ugly

c1->Draw()
Error in <TClingCallFunc::make_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) extern "C" void __cf_0(void* obj, int nargs, void** args, void* ret)
{
   if (ret) {
      new (ret) (double) (TFormula____id9969618711553705186(*(double**)args[0], *(double**)args[1]));
      return;
   }
   else {
      TFormula____id9969618711553705186(*(double**)args[0], *(double**)args[1]);
      return;
   }
}
#pragma clang diagnostic pop
  ==== SOURCE END ====

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f7759cab84a in __GI___waitpid (pid=1818, stat_loc=stat_loc
entry=0x7ffebe3396f0, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1  0x00007f7759c24ffb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f775abadfc1 in TUnixSystem::StackTrace() () from /home/vsibille/Applications/root/lib/libCore.so
#3  0x00007f775abaff4c in TUnixSystem::DispatchSignals(ESignals) () from /home/vsibille/Applications/root/lib/libCore.so
#4  <signal handler called>
#5  0x0000000000000000 in ?? ()
#6  0x00007f774e1f15d9 in TFormula::DoEval(double const*, double const*) const () from /home/vsibille/Applications/root/lib/libHist.so
#7  0x00007f774e24d249 in TF1::EvalPar(double const*, double const*) () from /home/vsibille/Applications/root/lib/libHist.so
#8  0x00007f774e2541c3 in TF1::DoCreateHistogram(double, double, bool) () from /home/vsibille/Applications/root/lib/libHist.so
#9  0x00007f774e253899 in TF1::Paint(char const*) () from /home/vsibille/Applications/root/lib/libHist.so
#10 0x00007f77495ec994 in TGraphPainter::PaintGraphSimple(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#11 0x00007f77495f8f03 in TGraphPainter::PaintGraphErrors(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#12 0x00007f774da325b3 in TPad::PaintModified() () from /home/vsibille/Applications/root/lib/libGpad.so
#13 0x00007f774da4cdf6 in TCanvas::Update() () from /home/vsibille/Applications/root/lib/libGpad.so
#14 0x00007f77568ba3a9 in TCling::UpdateAllCanvases() () from /home/vsibille/Applications/root/lib/libCling.so
#15 0x00007f77568d8293 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/vsibille/Applications/root/lib/libCling.so
#16 0x00007f77568b4e07 in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/vsibille/Applications/root/lib/libCling.so
#17 0x00007f775a706017 in TRint::HandleTermInput() () from /home/vsibille/Applications/root/lib/libRint.so
#18 0x00007f775abaf6dd in TUnixSystem::CheckDescriptors() () from /home/vsibille/Applications/root/lib/libCore.so
#19 0x00007f775abb07ea in TUnixSystem::DispatchOneEvent(bool) () from /home/vsibille/Applications/root/lib/libCore.so
#20 0x00007f775ab18dc4 in TSystem::InnerLoop() () from /home/vsibille/Applications/root/lib/libCore.so
#21 0x00007f775ab17201 in TSystem::Run() () from /home/vsibille/Applications/root/lib/libCore.so
#22 0x00007f775ab43e3f in TApplication::Run(bool) () from /home/vsibille/Applications/root/lib/libCore.so
#23 0x00007f775a70744b in TRint::Run(bool) () from /home/vsibille/Applications/root/lib/libRint.so
#24 0x0000000000401050 in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x0000000000000000 in ?? ()
#6  0x00007f774e1f15d9 in TFormula::DoEval(double const*, double const*) const () from /home/vsibille/Applications/root/lib/libHist.so
#7  0x00007f774e24d249 in TF1::EvalPar(double const*, double const*) () from /home/vsibille/Applications/root/lib/libHist.so
#8  0x00007f774e2541c3 in TF1::DoCreateHistogram(double, double, bool) () from /home/vsibille/Applications/root/lib/libHist.so
#9  0x00007f774e253899 in TF1::Paint(char const*) () from /home/vsibille/Applications/root/lib/libHist.so
#10 0x00007f77495ec994 in TGraphPainter::PaintGraphSimple(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#11 0x00007f77495f8f03 in TGraphPainter::PaintGraphErrors(TGraph*, char const*) () from /home/vsibille/Applications/root/lib/libHistPainter.so
#12 0x00007f774da325b3 in TPad::PaintModified() () from /home/vsibille/Applications/root/lib/libGpad.so
#13 0x00007f774da4cdf6 in TCanvas::Update() () from /home/vsibille/Applications/root/lib/libGpad.so
#14 0x00007f77568ba3a9 in TCling::UpdateAllCanvases() () from /home/vsibille/Applications/root/lib/libCling.so

when I try to plot the Canvas of the file attached (the plot was perfectly fine before being saved, in support of my argument is the .pdf file I could smoothly generate).

I believe that the bug now lies in the use of exponents or other fancy TLatex in the axes’ titles, if that may help!
pu_rate.root (17.8 KB)

Your canvas seems a bit weird, because it crashes also with 5.34 and 6.02.

With 5.34 get:


$ root pu_rate.root 
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.34/33      23 June 2015   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.34/33 (heads/v5-34-00-patches@v5-34-32-23-g5521633, Jul 07 2015, 08:50:22 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Attaching file pu_rate.root as _file0...
Warning in <TClass::TClass>: no dictionary for class TF1Parameters is available
root [1] c1->Draw()
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParErrors from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParMin from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParMax from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fSave from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParams from type:TF1Parameters* to type:Double_t*, skip element

 *** Break *** segmentation violation

with 6.02 I get:

$ root pu_rate.root 
   -------------------------------------------------------------------------
  | Welcome to ROOT 6.02/13                             http://root.cern.ch |
  |                                            (c) 1995-2014, The ROOT Team |
  | Built for macosx64                                                      |
  | From heads/v6-02-00-patches@v6-02-12-15-gaed9ff3, Jul 07 2015, 08:52:54 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'              |
   -------------------------------------------------------------------------

root [0] 
Attaching file pu_rate.root as _file0...
Warning in <TClass::Init>: no dictionary for class TF1Parameters is available
(class TFile *) 0x7f9b863c2d20
root [1] c1->Draw()
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParErrors from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParMin from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParMax from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fSave from type:vector<double> to type:Double_t*, skip element
Warning in <TStreamerInfo::BuildOld>: Cannot convert TF1::fParams from type:TF1Parameters* to type:Double_t*, skip element

 *** Break *** segmentation violation

I know, I have tried with root-5.34 as well, on root-5.34 I don’t even have the fit results box, but I believed the issue was related to the change from a cling saved file to a CINT opened file, which in essence, was not meant to work smoothly.

Here comes the .pdf file I was able to save during the same session in which I saved the .root file. It displays well and I had no error messages during the session…

It looks like ROOT did not like the combination of TFormulae in the axes and the use of an interactive fit (the straight line comes from the Fit Panel).
pu_rate.pdf (51.4 KB)

Cannot you provide a small macro generating a buggy TCanvas file ?

OK, this gets very interesting. I have repeated the procedure of fitting and naming the axes, and successfully saved the plot both as a .root file and as a .C file.

Opening the .C file draws the plot exactly as it was when it got saved. However, opening the .root file and trying to draw the “TCanvas c1” leads to the aforementioned segmentation violation.

I have attached the .C file because even though it is not buggy, you can also plot it, and try to save it as a .root file to confirm the bug!

Best regards,
Valérian
unnamed.C (4.84 KB)

Thanks