bug in ld.so when called via dlopen()

Natanael Copa natanael.copa at gmail.com
Fri Aug 27 14:11:57 UTC 2010


On Fri, Aug 27, 2010 at 3:06 PM, Joakim Tjernlund
<joakim.tjernlund at transmode.se> wrote:
> Natanael Copa <natanael.copa at gmail.com> wrote on 2010/08/27 14:39:50:
>>
>> On Fri, Aug 27, 2010 at 9:53 AM, Joakim Tjernlund
>> <joakim.tjernlund at transmode.se> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I have an issue with lua and a lua binding to c-client[1], limap[2].
>> >> libc-client calls some callback functions supposed to be implemented
>> >> in the main application.
>> >>
>> >> So various mm_* functions are implemented in limap.c as callbacks, for
>> >> example mm_dlog().
>> >>
>> >> But when lua does dlopen() to load the module i get error:
>> >> lua: symbol 'mm_dlog': can't resolve symbol in lib '/usr/lib/libc-client.so.1'
>> >>
>> >> I have simplified testcase here:
>> >> wget -O - http://dev.alpinelinux.org/~ncopa/uclibc-dlopen-testcase.tar.gz
>> >> | tar -zxf
>> >>
>> >> Both bar and baz works with glibc and bar fails on uclibc. Might be i
>> >> do something wrong?
>> >
>> > Didn't look into your testcase but uClibc differs from glibc w.r.t dependencies.
>> > You need to have corrected DT_NEEDED entries in your libs that reflect
>> > the true deps. At least it was like so when I impl. it but I have
>> > no idea if NPTL changes this.
>>
>> might be i'm doing it wrong since phps imap plugin seems to work, and
>> it is linked to c-client.
>>
>> > I think this is required in the specs. but glibc is more forgiving.
>>
>> how should the linker flags be then, in my examples?
>
> libfoo.so depends on foo_callback which is in plugin.so but
> libfoo.so does not depend on plugin.so so you need to add
> plugin.so in libfoo.so's DT_NEEDED

This means that c-client by design wont work with other .so files on
uclibc and the world needs a properly written imap client C library.
sigh...

I suppose i can use static c-client library for my lua module.

I wonder how php work around this since it seems to work there?

Thanks!

-- 
Natanael Copa


More information about the uClibc mailing list