Shared libraries

Hi,

I have created a program called tpcdata where I am using also Root functions, and so for that I have included the Root header files as

#include “TH1.h” for example…

For compiling it I have created the following Makefile:

tpcdata: tpcdata.cxx
g++ -I/afs/cern.ch/sw/root/v3.05.07/rh73_gcc32/root/include -L/afs/cern.ch/sw/root/v3.05.07/rh73_gcc32/root/lib -lCore -lCint
-lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -ldl -rdynamic -o tpcdata tpcdata.cxx

Then I compile it and get the desired executable tpcdata.

But then when I try to run it I get the folowing error message:

tpcdata: relocation error: tpcdata: undefined symbol: _ZN8TStorage11ObjectAllocEj

It seems that maybe there are some problems with the libraries?!

If I trype ldd -r tpcdata:

libCore.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libCore.so (0x00111000)
libCint.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libCint.so (0x00ba7000)
libHist.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libHist.so (0x00682000)
libGraf.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libGraf.so (0x008c6000)
libGraf3d.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libGraf3d.so (0x00ac4000)
libGpad.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libGpad.so (0x00f12000)
libTree.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libTree.so (0x00d8a000)
libRint.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libRint.so (0x00e85000)
libPostscript.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libPostscript.so (0x00ead000)
libMatrix.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libMatrix.so (0x00fed000)
libPhysics.so => /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib/libPhysics.so (0x01992000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00a8b000)
libdl.so.2 => /lib/libdl.so.2 (0x00a9b000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x066a1000)
libm.so.6 => /lib/tls/libm.so.6 (0x00ed8000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00a9e000)
libc.so.6 => /lib/tls/libc.so.6 (0x08b70000)
libstdc+±libc6.2-2.so.3 => /usr/lib/libstdc+±libc6.2-2.so.3 (0x0427e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00aae000)
undefined symbol: _ZN8TStorage11ObjectAllocEj (./tpcdata)
undefined symbol: _ZN7TObjectdlEPv (./tpcdata)
undefined symbol: _ZN4TH1FC1EPKcS1_idd (./tpcdata)
undefined symbol: _ZN5TFileC1EPKcS1_S1_i (./tpcdata)

This is what I get!! Why it is trying to find the libraries in /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/lib

when I explicity pointed in the Makefile to -L/afs/cern.ch/sw/root/v3.05.07/rh73_gcc32/root/lib ???
Is this the problem??
Thank you very much for your help…

Berta

You must have an error in your PATH and LD_LIBRARY_PATH variables

Rene

Indeed that was the problem.
I have updated the PATH and LD_LIBRARY_PATH variables, and now everything seems to work fine…

Thank you very much

Berta