Different library visibility in 5.32.00 vs. 5.30.01

Hi,
I am not very deep in compilations etc., so for me - this is a strange problem between versions 5.30.01 and 5.32.00. I use a code with dlopen, dlclose etc… in 5.30.01 and it works fine. I just wanted to move to the 5.32 version, but root has problems to find libraries during compilation and run.

This is how I install:

echo $ROOTSYS 
gives my $HOME/root
echo $LD_LIBRARY_PATH 
:$HOME/root/lib/root
./configure  linux --prefix=$HOME/root --etcdir=$HOME/root/etc --enable-opengl   --enable-mysql --enable-minuit2 --enable-xml --enable-python --enable-roofit --enable-fftw3 --enable-gsl-shared --enable-mathmore
time make && time make install

When I compile my code in 5.30.01, I do this for the plugin (library)

g++ -fPIC -c plug_analyze.cpp `root-config --libs --cflags --glibs` -lXMLIO
gcc -shared -o plug_analyze.so plug_analyze.o

I compile in the root CINT with .L mut_queue.C++g, which works fine in 5.30.01 and I can run the program from CINT
… but it gives in 5.32.01 these undefined references…

.....
/home/ojr/Install/58_kibbler/mut_queue_C_ACLiC_dict.o: In function `mut_queue_masterthread(void*)':
/home/ojr/Install/58_kibbler/./mut_queue.C:148: undefined reference to `dlopen'
....
/home/ojr/Install/58_kibbler/./mut_queue.C:506: undefined reference to `dlclose'
collect2: ld returned 1 exit status
Error in <ACLiC>: Compilation failed!

1/ I have found, that I can compile (.L mut_queue.C++g) if I do

gSystem->Load("/usr/lib/libdl.so");

before. BUT, when I run the compiled code from CINT, it crashes at the moment it runs an external function from *.so It says something like - unknown symbol … xxxTH1Fxxx of xxxTSocketxxx…

I have changed the compilation of .so this way

	g++ -shared `root-config --libs --cflags --glibs`  -lXMLIO -o plug_queue.so plug_queue.o
	g++ -fPIC -c plug_queue.cpp `root-config --libs --cflags --glibs` -lXMLIO

It still crashes, but at least it doesnt complain the unknown symbols TH1F or TSocket. However, I think that it makes seg.violation when it reaches the point with TH1F. Here I have no idea.

I use the same computers, same environment, I just remove one version and place another. Now I just check if 5.30.06 has the same problem (and I think that yes)
Thanks for hints. I feel quite puzzled with this.
best regards
jaromir

root-config --libs --cflags --glibs
-L/home/ojr/root/lib/root -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -pthread -m32 -I/home/ojr/root/include/root -L/home/ojr/root/lib/root -lGui

 root-config --libs --cflags --glibs
-L/home/ojr/root/lib/root -lGpad -lHist -lGraf -lGraf3d -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lRIO -lNet -lThread -lCore -lCint -pthread -lm -ldl -rdynamic -pthread -m32 -I/home/ojr/root/include/root -L/home/ojr/root/lib/root -lGui

How about: `root-config --cxx --cflags` -fPIC -shared -o plug_queue.so plug_queue.cpp `root-config --glibs` -lXMLIO

Much prettier, but doesnot change the fact that dlfunctions are not seen unless explicitly loaded. Now I am stuck at line ~ counting=(TH1F*)gDirectory->Get(“counting”);
… version 5.30.06 behaves as 5.30.01…

Try: TH1F *counting; gDirectory->GetObject("counting", counting); if (!counting) std::cout << "... counting ... NOT FOUND ..." << std::endl;

[quote=“Pepe Le Pew”]Try: TH1F *counting; gDirectory->GetObject("counting", counting); if (!counting) std::cout << "... counting ... NOT FOUND ..." << std::endl;[/quote]
The same result, thanks anyway. I mean - this particular error also might come from some other place, but the different behavior between the versions scares me. If I understood what’s up, I could better guess about the errors.

Hi,

What is the exact error message?

The link default has changed in v5.32 as mentioned in the release notes (root.cern.ch/root/html532/notes/ … notes.html) and indeed you should be linking your libraries more like: g++ -fPIC -c plug_queue.cpp `root-config --cflags --glibs` -lXMLIO g++ -shared `root-config --libs --glibs` -lXMLIO -o plug_queue.so plug_queue.o

If plug_queue uses TH1, you should also add -lHist to the link line.

Cheers,
Philipe.

*** Break *** segmentation violation
Generating stack trace…
*** Break *** segmentation violation
0xb737c8b6 in from /home/ojr/root/lib/root/libCore.so
0xb78b7400 in
…etc
Unfortunately, I know only one way how to deal with this : printf/compile/run

I should have read release notes first. My fault. I added all -lWhatever for all my #includes. (btw, what is that reason for root-config --libs --glibs then ? ).

I have traced the problem to gDirectory, that has 0x0 in the thread I call it. Something to do with "The global values gPad, gVirtualX, gInterpreter, gDirectory and gFile are now all accessed via a static function of their respective class. " from release notes…? Thanks for the hints.
jaromir

[quote]I have traced the problem to gDirectory, that has 0x0 in the thread I call it. [/quote]Humm … yes this is a known defect in v5.32/00 which has been fixed in v5.32/01.

Cheers,
Philippe.

Ok, thanks, it works now. Actually, things like the -lHist etc. in compilation/linking plugins were not crucial, but gSystem->Load("/usr/lib/libdl.so"); was. Version 5.32.01 needs some more aptitude installs than the .00.