I am trying to implement some code using ROOT
on linux debian with gcc & libc6.
I installed the ROOT binaries for Redhat5.0 ( glibc & gcc )
(I have been told glibc and libc6 were equivalent, may be this
is the source of all my problems..)
root works just fine, the /test exemples compile
and run, the /tutorials exemples execute without problem,
Yet, If I compile several shared libraries and load them
into cint, cross references from one to the other are not
resolved.
Here follows a little exemple to illustrate this:
I have a little C routine hello.C that I compile into a shared
lib libt1.so: (Don't pay attention to all the include paths,
this is because I am using some sort of generic makefile,
those include paths have no effect.)
sip bash t1 :more hello.c
void hello() {
printf("hello word \n");
}
sip bash t1 :
gcc -O2 -fwritable-strings -O -Wall -fPIC -DLinux
-I/home/anciant/CLAS/inc_derived -I.
-I/mnt/cdrom/release-1-19/packages/include
-I/mnt/cdrom/release-1-19/packages/inc_derived -I/usr/local/root/include
-c \
hello.c -o /home/anciant/CLAS/obj/Linux/t1_hello_sh.o;
hello.c: In function `hello':
hello.c:2: warning: implicit declaration of function `printf'
g++ -shared \
/home/anciant/CLAS/obj/Linux/t1_hello_sh.o \
-o /home/anciant/CLAS/slib/Linux/libt1.so
I make a small class hellc that calls the hello routine
in its constructor:
sip bash t2 :more hellc.h
extern "C" {
void hello();
}
class hellc {
public:
hellc() {hello(); }
};
sip bash t2 :
sip bash t2 :more hellc.cc
#include "hellc.h"
sip bash t2 :
sip bash t2 :more t2_LinkDef.h
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class hellc;
#endif
sip bash t2 :g++ -fhandle-exceptions -O -Wall -fPIC -DLinux
-I/home/anciant/CLAS/inc_derived -I. -I./
-I/mnt/cdrom/release-1-19/packages/include
-I/mnt/cdrom/release-1-19/packages/inc_derived -I/usr/local/root/include
-c \
hellc.cc -o /home/anciant/CLAS/obj/Linux/t2_hellc_sh.o
Generating library dictionnary
rootcint -f t2Cint.cc -c \
hellc.h t2_LinkDef.h || \
rm t2Cint.cc t2Cint.h;
Note: operator new() masked 1c
Note: operator delete() masked 1c
Class hellc: Streamer() not declared
Class hellc: ShowMembers() not declared
mv t2Cint.cc /home/anciant/CLAS/src_derived/t2Cint.cc
mv t2Cint.h /home/anciant/CLAS/inc_derived/t2Cint.h
g++ -fhandle-exceptions -O -Wall -fPIC -DLinux
-I/home/anciant/CLAS/inc_derived -I. -I./
-I/mnt/cdrom/release-1-19/packages/include
-I/mnt/cdrom/release-1-19/packages/inc_derived -I/usr/local/root/include
-c \
/home/anciant/CLAS/src_derived/t2Cint.cc -o
/home/anciant/CLAS/obj/Linux/t2Cint.o
g++ -shared \
/home/anciant/CLAS/obj/Linux/t2_hellc_sh.o
/home/anciant/CLAS/obj/Linux/t2Cint.o\
-o /home/anciant/CLAS/slib/Linux/libROOTt2.so
sip bash t2 :
Now if I load the two libraries in Cint, and try to create
one hellc object, it crashes:
sip bash t2 :root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 2.00/13 30 October 1998 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
CINT/ROOT C/C++ Interpreter version 5.13.78, Oct 22 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L /home/anciant/CLAS/slib/Linux/libROOTt2.so
root [1] .L /home/anciant/CLAS/slib/Linux/libt1.so
root [2] .class hellc
===========================================================================
class hellc
size=0x1
(tagnum=354,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=0)
List of base
class--------------------------------------------------------
List of member
variable---------------------------------------------------
Defined in hellc
List of member
function---------------------------------------------------
Defined in hellc
filename line:size busy function type and name
(compiled) 0:0 0 public: hellc hellc(void);
(compiled) 0:0 0 public: hellc hellc(hellc&);
(compiled) 0:0 0 public: void ~hellc(void);
root [3]
root [3] hellc h;
/usr/local/root/bin/root.exe: error in loading shared libraries
/home/anciant/CLAS/slib/Linux/libROOTt2.so: undefined symbol: hello
sip bash t2 :
Yet, if I put all the objects into one single library, it works:
sip bash t2 :g++ -shared \
> /home/anciant/CLAS/obj/Linux/t2_hellc_sh.o /home/anciant/CLAS/obj/Linux/t2Cint.o\
> /home/anciant/CLAS/obj/Linux/t1_hello_sh.o \
> -o /home/anciant/CLAS/slib/Linux/libtest.so
sip bash t2 :
sip bash t2 :root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 2.00/13 30 October 1998 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
CINT/ROOT C/C++ Interpreter version 5.13.78, Oct 22 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L /home/anciant/CLAS/slib/Linux/libtest.so
root [1] .class hellc
===========================================================================
class hellc
size=0x1
(tagnum=354,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=0)
List of base
class--------------------------------------------------------
List of member
variable---------------------------------------------------
Defined in hellc
List of member
function---------------------------------------------------
Defined in hellc
filename line:size busy function type and name
(compiled) 0:0 0 public: hellc hellc(void);
(compiled) 0:0 0 public: hellc hellc(hellc&);
(compiled) 0:0 0 public: void ~hellc(void);
root [2]
root [2] hellc h
hello word
root [3]
If I try the same business on Sun, with 2 libraries,
it works:
cc -O -KPIC -DSunOS -D_SUNOS_SOURCE
-I/home/crash4/anciant/CLAS/inc_derived -I.
-I/home/crash4/thauger/CLAS/builds/TEST/packages/include
-I/home/crash4/thauger/CLAS/builds/TEST/packages/inc_derived
-I/opt/gnu/include -I/usr/local/include -I/usr/dt/include
-I/usr/openwin/share/include -I/home/crash4/thauger/root/include -c \
hello.c -o
/home/crash4/anciant/CLAS/obj/SunOS/t1_hello_sh.o;
CC -O -G \
/home/crash4/anciant/CLAS/obj/SunOS/t1_hello_sh.o \
-o /home/crash4/anciant/CLAS/slib/SunOS/libt1.so
phns32: /home/anciant/tests/t1 <198>
CC -O -KPIC -DSunOS -D_SUNOS_SOURCE
-I/home/crash4/anciant/CLAS/inc_derived -I. -I./
-I/home/crash4/thauger/CLAS/builds/TEST/packages/include
-I/home/crash4/thauger/CLAS/builds/TEST/packages/inc_derived
-I/opt/gnu/include -I/usr/local/include -I/usr/dt/include
-I/usr/openwin/share/include -I/home/crash4/thauger/root/include -c \
hellc.cc -o
/home/crash4/anciant/CLAS/obj/SunOS/t2_hellc_sh.o
Generating library dictionnary
rootcint -f t2Cint.cc -c \
hellc.h t2_LinkDef.h || \
rm t2Cint.cc t2Cint.h;
Note: operator new() masked 1c
Note: operator delete() masked 1c
Class hellc: Streamer() not declared
Class hellc: ShowMembers() not declared
mv t2Cint.cc /home/crash4/anciant/CLAS/src_derived/t2Cint.cc
mv t2Cint.h /home/crash4/anciant/CLAS/inc_derived/t2Cint.h
CC -O -KPIC -DSunOS -D_SUNOS_SOURCE
-I/home/crash4/anciant/CLAS/inc_derived -I. -I./
-I/home/crash4/thauger/CLAS/builds/TEST/packages/include
-I/home/crash4/thauger/CLAS/builds/TEST/packages/inc_derived
-I/opt/gnu/include -I/usr/local/include -I/usr/dt/include
-I/usr/openwin/share/include -I/home/crash4/thauger/root/include -c \
/home/crash4/anciant/CLAS/src_derived/t2Cint.cc -o
/home/crash4/anciant/CLAS/obj/SunOS/t2Cint.o
CC -O -G \
/home/crash4/anciant/CLAS/obj/SunOS/t2_hellc_sh.o
/home/crash4/anciant/CLAS/obj/SunOS/t2Cint.o\
-o /home/crash4/anciant/CLAS/slib/SunOS/libROOTt2.so
phns32: /home/anciant/tests/t2 <200> root
Warning in <TGClient::GetColorByName>: couldn't retrieve color
LightYellow
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 2.00/13 30 October 1998 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
CINT/ROOT C/C++ Interpreter version 5.13.78, Oct 22 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L /home/crash4/anciant/CLAS/slib/SunOS/libROOTt2.so
root [1] .L /home/crash4/anciant/CLAS/slib/SunOS/libt1.so
root [2] .class hellc
===========================================================================
class hellc
size=0x1
(tagnum=354,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=0)
List of base
class--------------------------------------------------------
List of member
variable---------------------------------------------------
Defined in hellc
List of member
function---------------------------------------------------
Defined in hellc
filename line:size busy function type and name
(compiled) 0:0 0 public: hellc hellc(void);
(compiled) 0:0 0 public: hellc hellc(hellc&);
(compiled) 0:0 0 public: void ~hellc(void);
root [3]
root [3] hellc h
hello word
root [4]
I would really apreciate some advices, hints or suggestions
before I go into the business of recompiling all ROOT sources
for my compiler and my version of libc.
I know I tried that some time ago, and it made things rather worse
(root would not even execute.)
thanks,
eric
-- ----- Eric Anciant ------------ DAPNIA/SPhN - Bat 703 - Orme des merisiers CE-SACLAY - 91191 GIF-SUR-YVETTE Cedex - FRANCE Office: (33 - 1) 69 08 22 47 fax: (33-1) 69 08 75 84