Problem loading shared library

Hi,

I am having problems loading shared libraries to root on mandrake 10.1. It is a weird problem because I can compile and load it to root runing on debian based machine without any problems (with gcc 3.3.1). But on my new mandrake system I just installed on my laptop I am getting this error message:
root [0] .L libTAnalysis.so

dlopen error: /work/analysis/root_analysis/lib/libTAnalysis.so: failed to map segment from shared object: Operation not permitted
Load Error: Failed to load Dynamic link library /work/analysis/root_analysis/lib/libTAnalysis.so
*** Interpreter error recovered ***

And I set my ROOTSYS, PATH and LD_LIBRARY_PATH as on the other system where it works. The differences are: on mandrake 10.1 I have compiler gcc version 3.4.1 mdk.
But I can compile root source code without any problems and run it. I can compile my shared library code with the very same compiler without any problems too. But the loading fails…I am running root version 4.00.08

Does anybody know what the error message means? What else do I have to make sure works?

thank you
michal

Michal,

This is strange!
Could you check that the execute bit is set for your shared lib?

Unfortunately, we do not have access to a Mandrake system.

Rene

Rene,

I am sorry for posting it in two threads. I was trying to figure out how to delete one and didn’t succede…

Yes I checked the execute bit it is set. I was working with symbolic links so I even copied the files over to the working directory and tried it - but it didn’t work!

I was looking into the issue and it is very strange what is going on - I mean I don’t understand it. I am able to solve my problem with loading shared libraries by using automatic loading!! I simply add appropriate items into my rootmap file and make symbolic links of my *.so files to $ROOTSYS/lib directory and everything works without any problems…

But as soon as I try to call “.L libTAnalysis.so” it fails as before. Everything indicates that ROOT is able to see the library file - see the error message in my original post - because of the absolute path. In principle I can work on my analysis but the problem is just puzzling that I have no idea what is causing it.

michal

Very puzzling.
Instead of .L mylib.so
could you try
gSystem->Load(“mylib”)

Rene

I tried it and it doesn’t complain. So I have some problem with .L command.
I think I will be using dynamic loading with help of .rootmap file from now on

Thank you
michal

I don’t really understand what is going on. I thought I had it solved but I don’t! The problem is persistent.

I am using gcc 3.3.4:
[mocko@localhost class_developement]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.4/specs
Configured with: …/configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --program-suffix=-3.3.4 --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.4 (Mandrakelinux 10.1 3.3.4-2mdk)

And I included one of my libraries in his post (TInteraction.tar.gz). Can somebody check if the way I compile it is fine? (makefile is included). I am not having problems compiling it by loading in root:
[mocko@localhost root_analysis]$ root


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 4.01/03 9 November 2004 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.156, Oct 20 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] gSystem->Load(“libTInteraction.so”)
dlopen error: /home/mocko/mylibs/libTInteraction.so: failed to map segment from shared object: Operation not permitted
Load Error: Failed to load Dynamic link library /home/mocko/mylibs/libTInteraction.so
(int)(-1)
*** Interpreter error recovered ***

I don’t know how the loading works and what the error message supposed to mean. Please help!

thank you
michall
TInteraction.tar.gz (6.87 KB)

Hi,

You example works perfectly on linux gcc 3.4.2.
What happens if you do:

Is /home/mocko/mylibs/libTInteraction.so the correct location for you shared library?

Cheers,
Philippe.