SELinux problem

Dear all,

I am developing a ROOT-based application, but I’m encountering some problems with SELinux on a SLC5.2.

The error is:
root[0] gSystem->Load(“mylib.so”);
dlopen error: mylib.so: cannot restore segment prot after reloc: Permission denied
Load Error: Failed to load Dynamic link library mylib.so

I could only fix it putting SELinux in permissive mode, instead of the default enforcing mode,.doing
/usr/sbin/setenforce 0

Do you have any idea?

Thanks for all in advice
Luca Barze’

Move to version 5.22

Rene

This is the version I’ve got.
My splash screen says:


Version 5.22/00 17 December 2008

ROOT 5.22/00 (trunk@26997, Jan 25 2009, 19:13:00 on linux)

CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008

Thank you

The problem in this case is with your library mylib.so.
Do you have any problems running root and the tutorials ?

Rene

No, I could use everything without any problem.
I cut and paste the tutorial “gtime” into gtime.cc and it works.

Now I add it the corrects #include in gtime.cc and I’ve created a Makefile similar to the one I need:

CXXFLAGS += -pthread -m32 -I/opt/root/include
LDLIBS += -L/opt/root/lib -lMinuit -lMinuit2 -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lGui -pthread -lm -ldl -rdynamic

INCS = gtime.h
OBJS = gtime.o
all: gtime.a gtime.so

gtime.a: $(OBJS)
ar r $@ $?
ranlib $@

gtime.so: $(OBJS)
$(CXX) -shared -o $@ $+ $(LDLIBS)

I can compile it, but if into root I do

root [0] gSystem->Load(“gtime.so”);

it returns me

dlopen error: /home/me/./gtime.so: cannot restore segment prot after reloc: Permission denied
Load Error: Failed to load Dynamic link library /home/me/./gtime.so

But if I do

sudo /usr/sbin/setenforce 0

it works

I couldn’t understand if I’m doing something wrong…
Thanks for your help

Luca

You should probably compile your code with -fPIC.
This might solve this problem

Lorenzo

Yes, with -fPIC this library works, but mine doesn’t, also with this option…
So I beleve it is a problem of my library, I’ll work on it…

Thank you all for everything

Luca