I am trying to run drmaa (a python module that controls jobs in SGE) under a CentOS 6.x. According to the drmaa-python (https://github.com/pygridtools/drmaa-python) one of the requirement is libdrmaa.so
, which I acquired from gridengine-libdrmaa-dev
package.
I stored a copy of libdrmaa.so
under mydir/lib/
.
I also put the DRMAA_LIBRARY_PATH
environmental variable in .bashrc
:
DRMAA_LIBRARY_PATH=mydir/lib/libdrmaa.so
And the error message showed when I ran main.py
:
Traceback (most recent call last):
File "mydir/main.py", line 3, in <module>
from . import tools
ImportError: cannot import name 'tools'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "mydir/main.py", line 5, in <module>
import tools
File "mydir/tools.py", line 20, in <module>
import drmaa
File "mydir/anaconda3/lib/python3.6/site-packages/drmaa/\__init\__.py", line 63, in <module>
from .session import JobInfo, JobTemplate, Session
File "mydir/anaconda3/lib/python3.6/site-packages/drmaa/session.py", line 39, in <module>
from drmaa.helpers import (adapt_rusage, Attribute, attribute_names_iterator,
File "mydir/anaconda3/lib/python3.6/site-packages/drmaa/helpers.py", line 36, in <module>
from drmaa.wrappers import (drmaa_attr_names_t, drmaa_attr_values_t,
File "mydir/anaconda3/lib/python3.6/site-
packages/drmaa/wrappers.py", line 56, in <module>
_lib = CDLL(libpath, mode=RTLD_GLOBAL)
File "mydir/anaconda3/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib64/libc.so.6: version 'GLIBC_2.14' not found (required by mydir/lib/libdrmaa.so)
I suspected that the libdrmaa.so
is using the default libc.so.6
with GLIBC lower than 2.14. Let's assume that I do not have sudo privilege and no superuser could upgrade the glibc for me. I installed glibc-2.19
under my home directory and ran main.py
again. The error message remained the same.
After some research, I now can list the dependencies the libdrmaa.so
is looking for:
$ ldd /usr/lib/libdrmaa.so
linux-vdso.so.1 => (0x00007ffdd1199000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9d4ff97000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d4fd93000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d4f9c9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9d505a4000)
A program patchelf
was developed to change the soft link without re-compiling the file (https://nixos.org/patchelf.html):
$patchelf --set-rpath mydir/glibc/lib/libc.so.6 libdrmaa.so
$patchelf --set-interpreter mydir/glibc/lib/ld-2.19.so libdrmaa.so
cannot find section .interp
This is where I got stuck. The rpath was successfully switched to my new libc.so.6
, but there was no interpreter section for the libdrmaa.so
. This is also why the patchelf --set-interpreter
did not do anything to libdrmaa.so
.
The dependencies of libdrmaa.so
after patchelf
:
$ ldd ~/lib/libdrmaa.so
ldd: warning: you do not have execution permission for `mydir/lib/libdrmaa.so'
linux-vdso.so.1 => (0x00007ffde5799000)
libpthread.so.0 => mydir/glibc/lib/libpthread.so.0 (0x00007febbbba1000)
libdl.so.2 => mydir/glibc/lib/libdl.so.2 (0x00007febbb99c000)
libc.so.6 => mydir/glibc/lib/libc.so.6 (0x00007febbb5ef000)
/lib64/ld-linux-x86-64.so.2 (0x00000037dec00000)
Without the interpreter section (cannot find section .interp
), I was not able to change the last line to new ld-linux-x86-64.so.2
that is updated to 2.19. Here's my questions:
Am I able to change the
/lib64/ld-linux-x86-64.so.2
tomydir/glibc/lib/ld-linux-x86-64.so.2
for thelibdrmaa.so
without re-compilelibdrmaa.so
?Could anyone find the source code for libdrmaa.so so that I could re-compile with the prefix I want it to be?
Or if this is much easier than I thought. Please do not hesitate to response with some solution here. Thanks ahead.
===============solution==============
After @EmployedRussian response, it got confirmed that libdrmaa.so
does not have a interpreter section. Since my case is to use libdrmaa.so
under python, the executable program I am supposed to patch is python
!
So after patching the rpath for the libdrmaa.so
, I typed:
patchelf --set-interpreter mydir/glibc/lib/ld-2.19.so python
Then ran the main.py
again. Now the python uses the new glibc I installed in my local directories and my python and libraries uses the local glibc dependencies.
I think this question seems to be a redundant one but it is not. libdrmaa.so
is not an executable, and that is why I got stuck. That also said there is a fundamental knowledge gap for me as a beginner (and presumably for other beginners looking at this forum) that needs a more step-by-step solution. Hopefully this thread will help someone in the future.