Wednesday, October 24, 2007

Too much security

On a security enhanced linux system (selinux enabled OS), when you try to execute an application which links with user created libraries, you will (in all probabilities) end up with an error like below
./myapp : error while loading shared libaries :
/usr/local/lib/libmylib.so :cannot restore segment prot
after reloc permission denied.
. There are two ways to escape this pain.

1. Kill the source of pain once and for all. Disable selinux. Open /etc/selinux/config and either comment out all lines or modify the following line as below
SELINUX=disabled. Save the file and voila, you are a killer.

2. Request selinux.

Dear Selinux,

Since I have to work with user created libraries, I request you to kindly allow me to access the same and run corresponding applications.

Thanking you,
A Poor suffering soul.


Well, not exactly like this, but something like below (for libraries in /usr/local/lib path)
find /usr/local/lib -name '*.so*' -exec chcon -t 
texrel_shlib_t {} \;

Monday, October 22, 2007

Wrong Architecture issue in Mac

I maintain a common source code base for both PPC and x86 architecture in Mac and just recompile (with different Makefiles) in both architectures. Once, I had forgotten to clean up a library archive which I had compiled in x86. So, when I tried compiling the library in PPC, I ended up with the following error.

ld: common symbols not allowed with MH_DYLIB output format with 
the -multi_module option
mymainfile.o definition of common _gsDeviceFreeMutex (size 44)
/usr/bin/libtool: internal link edit command failed


Just cleaning up the x86-compiled library archive removed the above error. And this drank few hours off my work-day. But, I ended up wiser ;-)