[OpenSIPS-Users] Mediaproxy 2.1.0 on Red Hat/CentOS

John Quick John.Quick at smartvox.co.uk
Thu Nov 27 16:35:27 CET 2008


I really appreciate your help on this. I used your lsof procedure on the pid
of Python after importing gnutls.library and it showed the following:
# lsof -p 12803
    4096 25296897 /root
    4096        2 /
    8304  6700861 /usr/bin/python
  134400  2425120 /lib64/ld-2.5.so
 1699880  2425121 /lib64/libc-2.5.so
   23360  2425122 /lib64/libdl-2.5.so
  141456  2425126 /lib64/libpthread-2.5.so
  615136  2425128 /lib64/libm-2.5.so
 1234008  6692943 /usr/lib64/libpython2.4.so.1.0
  314520  6700843 /usr/lib64/libgcrypt.so.11.2.2
   85608  6692065 /usr/lib64/libz.so.1.2.3
   15584  2425108 /lib64/libtermcap.so.2.0.8
  114352  2425129 /lib64/libnsl-2.5.so
   18152  2425145 /lib64/libutil-2.5.so
  540576  6702936 /usr/lib64/libgnutls.so.13.0.6
  247224  6692881 /usr/lib64/libreadline.so.5.1
56414144  6690688 /usr/lib/locale/locale-archive
   21808  6853309 /usr/lib64/python2.4/lib-dynload/readline.so
   25464  6691193 /usr/lib64/gconv/gconv-modules.cache
   19960  7113538
  134495  6703491 /usr/lib64/libgnutls-extra.so.26.4.6
   15208  6696908 /usr/lib64/libgpg-error.so.0.3.0
 2669434  6702949 /usr/local/lib/libgnutls.so.26.4.6
  320003  6857078 /usr/lib64/python2.4/site-packages/_ctypes.so
   23736  6853317 /usr/lib64/python2.4/lib-dynload/structmodule.so

So it is using so.13.0.6 from /usr/lib64 and so.26.4.6 from /usr/local/lib.
I thought this looked a bit odd, so I tried to manually update various
libgnutls files in my /usr/lib64 directory......and now I've broken it!
Python gives an error when I run the "import functions" command in PHP:

>>> from gnutls.library import functions
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "gnutls/library/__init__.py", line 4, in ?
    from gnutls.library import _gnutls_init
ImportError: cannot import name _gnutls_init

Unfortunately, my knowledge of Linux libraries/packages and how they are
stored, updated and loaded is poor - I only ever used Yum before this. I may
have to give up. It's too hard. But I hate to throw away the time already
spent trying.   :-(

If only there was a newer Yum package for gnutls. Yum only offers v1.4.


-----Original Message-----
From: Dan Pascu [mailto:dan at ag-projects.com] 
Sent: 27 November 2008 12:02
To: John.Quick at smartvox.co.uk
Cc: users at lists.opensips.org
Subject: Re: [OpenSIPS-Users] Mediaproxy 2.1.0 on Red Hat/CentOS

On Thursday 27 November 2008, John Quick wrote:
> Dan
> Your explanation makes a lot of sense - getting the correct version of
> the gnutls libraries has been a big problem and I downloaded 2.4.2 and
> installed from source after I had installed the Python libraries.
> However, I now have problems re-installing packages/libraries so the
> old ones are properly replaced. For example, "./setup clean" does not
> remove the old .so files in the build directory for my Python packages
> - I had to manually delete them. I also had to manually delete the .pyc
> files in the mediaproxy directory and mediaproxy/interfaces.

You do not need to delete the .pyc files. setup clean only cleans files 
from builds that were not done in-place. if you did ./build_inplace then 
you need to delete the .so yourself to rebuild it.

> Have just tried rebuilding/installing:
> python-gnutls-1.1.6, then
> Twisted-8.1.0, then
> build_inplace mediaproxy
> and I still get the same error when I run media-dispatcher.

The order to install them is:

libtasn1 (libgnutls dependency)
libgcrypt11 (libgnutls dependency)
libgnutls26 (version 2.4.2)
python-gnutls (build it only after the above had been installed)
other deps

unfortunately, gnutls has some dependencies of its own (libtasn1 and 
libgcrypt), and the version you use (2.4.2) needs a certain version of 
these companion libraries (for gnutls-2.4.x I have libgcrypt-1.4.1 and 
libtasn1-1.4). It may be possible that you still get the error because 
libtasn1 and/or libgcrypt are still old versions.

To check that libraries you use:

run a python interpreter and execute the statement below:

>>> from gnutls.library import functions

then find the pid of that python interpreter (ps ax | grep python) and run 
lsof on it:

lsof -p pid_of_python_interpreter

then run

ldd gnutls/library/_gnutls_init.so

Compare the versions and paths for libgnutls, libgcrypt and libtasn1 from 
the outputs of lsof and ldd. They must be the same.

> Two things that are probably relevant:
> 1. The usual ./configure; make; make install process that I used for
> the source package of gnutls failed to copy gnutls-extra.so file to the
> Linux lib path - I eventually copied it manually, but don't feel happy
> about having to do that.

I don't think that's a problem.

> 2. When I rebuild Twisted-8.1.0, it gives the following error during
> the "install" process, but the install script still completes:

I do not know about that. You should ask the twisted developers about it.
I guess a simple solution would be to remove the offending files, since 
they're only tests. Aren't they ignored anyways, since the error is just 
in byte compiling them?

> [root at opensips02 Twisted-8.1.0]# ./setup.py install
> running install
> running build
> running build_py
> running build_ext
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC
> -I/usr/include/python2.4 -c conftest.c -o conftest.o
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC
> -I/usr/include/python2.4 -c conftest.c -o conftest.o
> running build_scripts
> running install_lib
> copying build/lib.linux-x86_64-2.4/twisted/python/_epoll.so ->
> /usr/lib64/python2.4/site-packages/twisted/python
> copying build/lib.linux-x86_64-2.4/twisted/test/raiser.so ->
> /usr/lib64/python2.4/site-packages/twisted/test
> copying build/lib.linux-x86_64-2.4/twisted/protocols/_c_urlarg.so ->
> /usr/lib64/python2.4/site-packages/twisted/protocols
> copying build/lib.linux-x86_64-2.4/twisted/runner/portmap.so ->
> /usr/lib64/python2.4/site-packages/twisted/runner
> byte-compiling
> /usr/lib64/python2.4/site-packages/twisted/test/generator_failure_tests
>.py to generator_failure_tests.pyc
>   File
> "/usr/lib64/python2.4/site-packages/twisted/test/generator_failure_test
>s.py" , line 66
>     yield
>          ^
> SyntaxError: invalid syntax
> I haven't rebuilt/installed python-application or cjson packages since
> upgrading gnutls - are they relevant? If so, what is the correct order

no. pyhton-application and python-cjson are standalone, so you can install 
them whenever you like.

> for building the various python packages?

See above.


More information about the Users mailing list