<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Steve Harvey wrote:
<blockquote cite="mid20041205073554.GE68924-bEteefDXIgtmcu3hnIyYJQ@public.gmane.org" type="cite">
  <pre wrap="">On Sat, Dec 04, 2004 at 10:12:46PM -0500, Sergey Kuznetsov wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">The issue was not the library itself ( the library at the right place, 
at /lib directory )
but with the .so file itself.
that file is a optional part of the Asterisk PBX program, and it's G.729 
codec library,
and specifically for GLIB 2.3 X86_64 platform under Gentoo.
The error Asterisk gives me is:

[codec_g729a.so]Dec  4 19:34:04 WARNING[16384]: loader.c:248 
ast_load_resource: /usr/lib/asterisk/modules/codec_g729a.so: undefined 
symbol: gzread
Dec  4 19:34:04 WARNING[16384]: loader.c:429 load_modules: Loading 
module codec_g729a.so failed!

The ldd saying about codec_g729a.so is:
# ldd codec_g729a.so
       libc.so.6 => /lib/libc.so.6 (0x0000002a9567d000)
       /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 
(0x000000552aaaa000)

The nm -D codec_g729a.so saying is:
                U gzclose
                U gzdopen
                U gzread

The nm -D /lib/libz.so saying is:
00000000000035f0 T gzclose
00000000000026a0 T gzdopen
0000000000002ab0 T gzread

The objdump -x codec_g729a.so saying is:
Dynamic Section:
 NEEDED      libc.so.6
 INIT        0x35c0

As you can see here is the NEEDED libz.so is absent. And this is I am 
trying to fix. Thats why I need such tool who can mangle the any 
library's header I want.

    </pre>
  </blockquote>
  <pre wrap=""><!---->  I assume that setting the LD_PRELOAD environment variable is not an 
option in your situation.

  I don't know of any single tool that will do that.  Perhaps you might
be able to carve the library up with objcopy and re-build it using ld
and a specially crafted linker script in order to get both NEEDED 
entries.

  If you have write perms on /usr/local/lib, I might try building a 
customized libc to which the libz modules have been added, making it 
reachable via /usr/local/lib/libZ.so.6 (making sure that libZ is unique
in your system).  Ensure that its internal SONAME is "libZ.so.6" (vi
makes a good binary editor), run ldconfig, then use a patched 
codec_g729a.so with the "libc.so.6" string in the file suitably altered.

  </pre>
</blockquote>
LD_PRELOAD - does it!!!!<br>
<br>
Thanks a looooooooooot Steve!<br>
<br>
<br>
I completely forgot about LD_PRELOAD. IT did the trick.<br>
<br>
<br>
<br>
All the Best!<br>
Sergey.<br>
</body>
</html>