TRootGuiFactory not found?

Dear Rooters

Yesterday I downloaded the new root version from cvs and compiled it on
both my new Intel MacBook Pro and on my old Titanium G4 PowerBook.
Then I compiled my library from identical source code also on both Macs,
and compilation was ok on both Macs.

To load my library I have a macro with following function:

void Init()
{
   gSystem->Load("/Users/rabbitus/ROOT/rootcode/src/xps.so");
}

While I was able to load my library on the new MacBook Pro, trying to load
the library on my old PowerBook caused root to crash with the stack trace
shown below.

Does someone know what the error means and why it did not appear with
the old root version 5.15/01?

Thank you in advance
Best regards
Christian

root [0] .L macroRwrapper.C
root [1] Init()
Error in TPluginHandler::SetupCallEnv: class TRootGuiFactory not found in plugin Gui

*** Break *** bus error
/Users/rabbitus/CRAN/Workspaces/2289: No such file or directory.
Attaching to process 2289.
Reading symbols for shared libraries . done
Reading symbols for shared libraries … done
0x90031aa4 in wait4 ()

========== STACKS OF ALL THREADS ==========

Thread 1 (process 2289 thread 0xd03):
#0 0x90031aa4 in wait4 ()
#1 0x900521a8 in system ()
#2 0x010c3c24 in TUnixSystem::StackTrace ()
#3 0x010c6ec0 in TUnixSystem::DispatchSignals ()
#4
#5 0x0100ca58 in TApplication::InitializeGraphics ()
#6 0x01062850 in TSystem::Load ()
#7 0x01048c0c in TROOT::LoadClass ()
#8 0x01098670 in TCint::AutoLoadCallback ()
#9 0x0109d478 in TCint_AutoLoadCallback ()
#10 0x01a2cbb4 in G__class_autoloading ()
#11 0x01a2d310 in G__defined_tagname ()
#12 0x01a2d7fc in G__search_tagname ()
#13 0x019d681c in G__get_linked_tagnum ()
#14 0x03570658 in G__cpp_setup_tagtableManualTree2 ()
#15 0x035707c8 in G__cpp_setupManualTree2 ()
#16 0x019c9c40 in G__call_setup_funcs ()
#17 0x8fe15984 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#18 0x8fe0bca4 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextE ()
#19 0x8fe0bc34 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextE ()
#20 0x8fe0dfd8 in __dyld__ZN11ImageLoader4linkERKNS_11LinkContextENS_15BindingLazinessENS_18InitializerRunningEj ()
#21 0x8fe04270 in __dyld__ZN4dyld4linkEP11ImageLoaderNS0_15BindingLazinessENS0_18InitializerRunningE ()
#22 0x8fe09d0c in __dyld_dlopen ()
#23 0x9003029c in dlopen ()
#24 0x01a251ec in G__dlopen ()
#25 0x01a27448 in G__shl_load ()
#26 0x019cff34 in G__loadfile ()
#27 0x0109ab80 in TCint::Load ()
#28 0x01062754 in TSystem::Load ()
#29 0x0124498c in G__G__Base2_225_0_110 ()
#30 0x0191f490 in Cint::G__ExceptionWrapper ()
#31 0x019d551c in G__call_cppfunc ()
#32 0x019ba778 in G__interpret_func ()
#33 0x019ac45c in G__getfunction ()
#34 0x01a569fc in G__getstructmem ()
#35 0x01a4f298 in G__getvariable ()
#36 0x01987988 in G__getitem ()
#37 0x01991630 in G__getexpr ()
#38 0x019f885c in G__exec_function ()
#39 0x019fcf24 in G__exec_statement ()
#40 0x019bca54 in G__interpret_func ()
#41 0x019acb88 in G__getfunction ()
#42 0x01987d88 in G__getitem ()
#43 0x01991630 in G__getexpr ()
#44 0x019f885c in G__exec_function ()
#45 0x019fcf24 in G__exec_statement ()
#46 0x019741d8 in G__exec_tempfile_core ()
#47 0x0197437c in G__exec_tempfile_fp ()
#48 0x01a09840 in G__process_cmd ()
#49 0x0109adc0 in TCint::ProcessLine ()
#50 0x0100d2f8 in TApplication::ProcessLine ()
#51 0x000335b0 in TRint::HandleTermInput ()
#52 0x010c71e8 in TUnixSystem::CheckDescriptors ()
#53 0x010c79fc in TUnixSystem::DispatchOneEvent ()
#54 0x0105f028 in TSystem::InnerLoop ()
#55 0x0105ef94 in TSystem::Run ()
#56 0x0100bf90 in TApplication::Run ()
#57 0x00033df0 in TRint::Run ()
#58 0x00002960 in main ()
Root > Function Init() busy flag cleared

This is strange? Do the ROOT tutorials run on your G4 machine? Can you do:

new TBrowser

Cheers, Fons.

Dear Fons

Whenever I download a new root version I run the tutorials first, including
motorcycle.C and guitest.C. “.x guitest.C+” also works.
I can start the root browser with “TBrowser b” and “new TBrowser”.

For your info I am attaching my Makefile, which is also identical for all three
platforms, since meanwhile I have tested it also on a HP laptop with FC4.

Thank you for your help
Best regards
Christian
Makefile.txt (2.89 KB)

Hi,

form the Makefile I cannot say why it goes wrong. Does the old G4 runs also Tiger 10.4.9? If you put your xps.so in, say $ROOTSYS/lib and then:

gSystem->Load(“xps”)

does that work?

– Fons

Dear Fons

Meanwhile I have upgraded my PowerBook from OS X 10.4.4. to 10.4.9. I have also updated XCode
from 2.1 to 2.4.1. In addition I have downloaded once again a new root version from cvs.

Sorrowly, the error remains the same. Putting xps.so in $ROOTSYS/lib also causes the same error.

I have also tested my library on the MacBook Pro and a laptop with FC4:
On all three systems I get the same error:
“Error in TPluginHandler::SetupCallEnv: class TRootGuiFactory not found in plugin Gui”

In contrast, when using the old root version 5.15/01 everything is ok.

Interestingly, when I “build” my R package, which compiles the library source code automatically,
and load my package into R, then my library works as expected on my Intel-Mac but not on my
PowerBook, using either the old or the new root version. However, when I try to load this library
into root, then I get this error!

Since my “Makefile” includes “Makefile.arch” from root/test, I decided to compile the root/test
examples. While I can load these libraries when using the old root version, with the new root
version I get the error:
"Load Error: Failed to load Dynamic link library /Volumes/CoreData/ROOT/root/test/./Hello.so"
See my new topic: “Error loading root/test libraries!”

Could there be a problem with “Makefile.arch”?
It is very important for me to use “Makefile.arch” to allow architecture independent compilation.
Usually, R packages containing C source code use the built-in R configuration for architecture
independent compilation. This is not possible for me since my source code depends on root.

Thank you in advance
Best regards
Christian

Hi Christian,

does your xps.so lib depend on specific ROOT libraries? What happens if you explicitly load libGui before loading xps.so? Once all dependencies are know create a xps.rootmap file to automatically load these dependencies.

Cheers, Fons.

Dear Fons

Thank you very much, loading libGui first finally solved my problem on all three computers.

Interestingly, when my package and library is called from within R, everything works fine, so I assume:
Is it correct, that loading libGui first is only necessary for CINT, but not when my library is called from another program?

You propose that I create a xps.rootmap file using rlibmap. When looking at:
root.cern.ch/phpBB2/viewtopic.php?t=4778
I have the feeling that it is easier for a user to simply load libGui.
E.g. my library contains 140 classes, so I would need to call “./do_map ClassXX mylib > mylib.rootmap” 140 times.

Best regards
Christian

Hi Christion,

try adding this code to one of the .cxx files in your library:

#include <TApplication.h>

class RootGuiInit {
public:
   RootGuiInit() { TApplication::NeedGraphicsLibs(); }
};
static RootGuiInit gRootGuiInit;

in this case ROOT should load libGui and you won’t have to do it yourself anymore.

Cheers, Fons.

Dear Fons

Thank you for this very good idea.
Sorrowly, the error remains the same. I tried to put RootGuiInit in the .h file, the .cxx file, with/without ClassDef, nothing worked.
However, the most important issue is, that with loading libGui now everything is ok.

Best regards
Christian

Hi Christian,

I would need to see your complete lib to understand why it has this autoloading of libGui error. Anyway, for the time being you can continue.

Cheers, Fons.

Dear Fons

Thank you, this would be great. I hope to be able to publish it soon.

Best regards
Christian