Problem with TApplication on Mac OS 10.4.3

I’m using root version 4.04/02g, compiled from source on OS 10.4.3. I wrote a simple piece of code that randomly generated two Gaussians of same mean and sigma. I can draw these to a canvas and print the canvas as an .eps perfectly fine, but if I want to show them on screen by using TApplication, my program hangs at the line theApp.Run()
The code is…

Anyway, I don’t think my code is the issue, because when I compile and and run the hworld.cxx example in test/, the same thing happens. Other code that doesn’t use TApplication (such as bench.cxx, also in test/) works fine.

To add to my worries, when I run root from the terminal I get a message saying [quote]root: can’t figure out DISPLAY, set it manually[/quote] which forces me to run root with the -b option.

Not asking for a complete solution… just wondering if anyone has even a hint of what could be wrong here, or is it a common issue?

[quote=“jjk”]my program hangs at the line theApp.Run()
[/quote]
It does not hang, it enters the ROOT “Event Loop” and remains there untill you instruct ROOT to leave that loop (for example by selecting “Quit” menu from “File” menu of TCanvas ( see: $ROOTSYS/test/hworld2.C) . This is the normal ROOT behavior.

[quote=“jjk”]To add to my worries, when I run root from the terminal I get a message saying

root: can't figure out DISPLAY, set it manually which forces me to run root with the -b option.
[/quote]

Yes this is likely the reason of your trouble. You have to define the DISPLAY env variable to let ROOT know where its graphics should be drawn. However, the presence of DISPLAY is essential for ANY ROOT session (i.e one neeeds that for all ROOT examples and tutorials).
But … without DISPLAY ROOT is forced to set the “batch” mode without any extra “-b” option.

Can you print this variable out before you start any ROOT example and before you invoke your own application?

First off, thank you for your response! =)

I didn’t know that DISPLAY was an eviroment variable. Now that I do know, I still don’t know what it’s for or what it means!
I found another Mac ROOT user who had DISPLAY set to :0.0 in their bash_profile, but they couldn’t remember why or when they did it… I set mine to the same.
Any road up, it works perfectly now.

Is it somethintg to do with world/screen coordinates?

Thanks again.

James.

Okay, I read up on DISPLAY and figured out what it’s for.
Thanks.

Could I suggest maybe the installer documentation or Userguide guide mentioning this DISPLAY variable? I couldn’t find anything about it.

[quote=“jjk”]Okay, I read up on DISPLAY and figured out what it’s for.
Thanks.

Could I suggest maybe the installer documentation or Userguide guide mentioning this DISPLAY variable? I couldn’t find anything about it.[/quote]

DISPLAY is a mandatory env. variable using by X11 graphical system (see: en.wikipedia.org/wiki/X11) . As soon as you install ROOT with X11 graphical intreface you has to provide that variable also. X11 usualy is always present on UNIX platforms.
However MAC has so-called “native” GUI graphical system and MAC application can work with no X11 at all, hence without DISPLAY to be defined.

One can build ROOT with the “native” MAC GUI and use ROOT with the native MAC interface too.

To do that one needs two things:

  1. Install Qt package with the “native” MAC interface
  2. Install ROOT with the Qt-layer plugin.

See talk:
“QScan: a QtROOT based software for events reconstruction in Lar detectors” by Anselmo Meregaglia
agenda.cern.ch/askArchive.php?ba … sparencies
page 9
from

agenda.cern.ch/fullAgenda.php?ida=a055638[/b]