[ROOT] Adding a class with a shared library

From: Damien PRIEUR (prieur@lapp.in2p3.fr)
Date: Thu Feb 26 2004 - 17:32:54 MET


Hi,

I'm trying to load a shared library under cint and I have some problems:

I am using root 3.10/01 with gcc3.2.
I use the basic class SClass defined in the user guide (p.255) (file
SClass.h and SClass.cxx in attachment)

I do:
>rootcint -f SClassDict.C -c SClass.h LinkDef.h
>g++ -O -Wall -fPIC -D_REENTRANT -I/afs/cern.ch/sw/root/v3.10.01/rh73_gcc32/root/include -c SClass.C
>g++ -O -Wall -fPIC -D_REENTRANT -I/afs/cern.ch/sw/root/v3.10.01/rh73_gcc32/root/include -c SClassDict.C
>g++ -shared -O SClass.o SClassDict.o -o  SClass.so

that produce the file SClass.so without warnings nor errors. Then in cint,
I execute the command to load the library:
>gSystem->Load("../TestBeam/Src/SClass.so")

and I get the following message:

>dlopen error:
>/afs/cern.ch/user/p/prieur/public/emtb/./../TestBeam/Src/SClass.so:
>undefined symbol: DoError__C7TObjectiPCcT2Pv
>Load Error: Failed to load Dynamic link library
>/afs/cern.ch/user/p/prieur/public/emtb/./../TestBeam/Src/SClass.so
>(int)(-1)
>*** Interpreter error recovered ***

Does anyone has a clue concerning this error ? Or am I missing something ?


Another point, I have tried to compile the $ROOTSYS/test directory in
order to see if I can load into cint the libEvent.so, but when I do:
>gmake -f Makefile

I have the following output:

[lxplus007] ~/public/TestBeam/Src/test % gmake -f Makefile
g++ -O MainEvent.o libEvent.so
-L/afs/cern.ch/sw/root/v3.10.01/rh73_gcc32/root/lib -lCore -lCint -lHist
-lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics
-lpthread -lm -ldl -rdynamic  \
           -o Event
MainEvent.o: In function `main':
MainEvent.o(.text+0x25f): undefined reference to
`TStopwatch::TStopwatch(void)'
MainEvent.o(.text+0x26b): undefined reference to `TStopwatch::Start(bool)'
MainEvent.o(.text+0x2d7): undefined reference to
`TStorage::ObjectAlloc(unsigned int)'
MainEvent.o(.text+0x2f5): undefined reference to `TNetFile::TNetFile(char
const *, char const *, char const *, int, int)'
MainEvent.o(.text+0x321): undefined reference to
`TStorage::ObjectAlloc(unsigned int)'
MainEvent.o(.text+0x33f): undefined reference to `TFile::TFile(char const
*, char const *, char const *, int)'
MainEvent.o(.text+0x402): undefined reference to
`TStopwatch::RealTime(void)'
MainEvent.o(.text+0x43c): undefined reference to
`TStopwatch::Continue(void)'
MainEvent.o(.text+0x556): undefined reference to
`TStorage::ObjectAlloc(unsigned int)'
MainEvent.o(.text+0x57a): undefined reference to `TNetFile::TNetFile(char
const *, char const *, char const *, int, int)'
MainEvent.o(.text+0x5a9): undefined reference to
`TStorage::ObjectAlloc(unsigned int)'
MainEvent.o(.text+0x5cd): undefined reference to `TFile::TFile(char const
*, char const *, char const *, int)'

[...]

libEvent.so: undefined reference to `TObject::SetUniqueID(unsigned int)'
libEvent.so: undefined reference to `TObject::Clone(char const *) const'
libEvent.so: undefined reference to `TObject::Hash(void) const'
libEvent.so: undefined reference to `TObject type_info function'
libEvent.so: undefined reference to `TObject::Paint(char const *)'
libEvent.so: undefined reference to `TObject::ClassName(void) const'
libEvent.so: undefined reference to `TObject::Copy(TObject &) const'
libEvent.so: undefined reference to `TObject::FindObject(char const *)
const'
libEvent.so: undefined reference to `TObject::GetTitle(void) const'
libEvent.so: undefined reference to
`ROOT::TGenericClassInfo::SetDelete(void (*)(void *))'
libEvent.so: undefined reference to `TRefArray::TRefArray(void)'
libEvent.so: undefined reference to `TObject::Error(char const *, char
const *,...) const'
libEvent.so: undefined reference to `TObject::Write(char const *, int,
int)'
libEvent.so: undefined reference to
`ROOT::TGenericClassInfo::SetNewArray(void *(*)(long))'
libEvent.so: undefined reference to
`ROOT::TGenericClassInfo::GetClass(void)'
collect2: ld returned 1 exit status
gmake: *** [Event] Error 1

I can't manage to understand why it don't compile under my account.

Regards,
Damien Prieur.






This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET