Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - dlopen fails and dlerr returns "No dynamic section ...": (9 Items)
   
dlopen fails and dlerr returns "No dynamic section ..."  
Hi,

I'm using dlopen within a process linked against static and shared libraries.
The dlopen call returns NULL is that case ... but the same shared lib works if dlopen is used within a process with 
dynamic linking and without static linking.  The shared lib has a dynamic section as the attachment shows.

What's could be the problem ?   OS version 6.4.1 ...

--Armin

Attachment: Text dyn_sect.txt 9.89 KB
Re: dlopen fails and dlerr returns "No dynamic section ..."  
same result with version 6.5 !
Attachment: Text .directory 2 KB
Re: dlopen fails and dlerr returns "No dynamic section ..."  
You are linking libc statically, and in that case dynamic linking won't 
work.



On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>
> same result with version 6.5 !
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post87732
>
Re: dlopen fails and dlerr returns "No dynamic section ..."  
Aleksandar Ristovski wrote:
> You are linking libc statically, and in that case dynamic linking won't
> work.

   Not the case ... I'm linking against libs.so.3  ... dV is the 
application:

# objdump -x dV | grep NEEDED
   NEEDED               libm.so.2
   NEEDED               libsocket.so.2
   NEEDED               libcpp.so.4
   NEEDED               libph.so.3
   NEEDED               libasound.so.2
   NEEDED               libSDL-1.2.so.0
   NEEDED               libc.so.3
#

--Armin

>
>
>
> On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>> same result with version 6.5 !
>>
>>
>>
>> _______________________________________________
>>
>> OSTech
>> http://community.qnx.com/sf/go/post87732
>>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post87756
>
>
Re: dlopen fails and dlerr returns "No dynamic section ..."  
Could you run your executable on 6.5.0:

# LD_DEBUG=1 ./dV

and see where is dlopen resolving from?

(Look for:
debug: Symbol dlopen bound to definition in ...)




On 08/02/2011 09:04 AM, Armin Steinhoff wrote:
> Aleksandar Ristovski wrote:
>  > You are linking libc statically, and in that case dynamic linking won't
>  > work.
>
> Not the case ... I'm linking against libs.so.3 ... dV is the
> application:
>
> # objdump -x dV | grep NEEDED
> NEEDED libm.so.2
> NEEDED libsocket.so.2
> NEEDED libcpp.so.4
> NEEDED libph.so.3
> NEEDED libasound.so.2
> NEEDED libSDL-1.2.so.0
> NEEDED libc.so.3
> #
>
> --Armin
>
>  >
>  >
>  >
>  > On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>  >> same result with version 6.5 !
>  >>
>  >>
>  >>
>  >> _______________________________________________
>  >>
>  >> OSTech
>  >> http://community.qnx.com/sf/go/post87732
>  >>
>  >
>  >
>  >
>  > _______________________________________________
>  >
>  > OSTech
>  > http://community.qnx.com/sf/go/post87756
>  >
>  >
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post87758
>
Re: dlopen fails and dlerr returns "No dynamic section ..."  
Aleksandar,

there are no debug outputs related to dlopen with the dV application 
("dyn_debug.txt") ... but dlopen has been called ("dV-dlopen-call.c")

The trace file "working_libdll_test.txt" shows a working small test 
program (same shared object, "libdll_test.c")


--Armin



Aleksandar Ristovski wrote:
> Could you run your executable on 6.5.0:
>
> # LD_DEBUG=1 ./dV
>
> and see where is dlopen resolving from?
>
> (Look for:
> debug: Symbol dlopen bound to definition in ...)
>
>
>
>
> On 08/02/2011 09:04 AM, Armin Steinhoff wrote:
>> Aleksandar Ristovski wrote:
>>   >  You are linking libc statically, and in that case dynamic linking won't
>>   >  work.
>>
>> Not the case ... I'm linking against libs.so.3 ... dV is the
>> application:
>>
>> # objdump -x dV | grep NEEDED
>> NEEDED libm.so.2
>> NEEDED libsocket.so.2
>> NEEDED libcpp.so.4
>> NEEDED libph.so.3
>> NEEDED libasound.so.2
>> NEEDED libSDL-1.2.so.0
>> NEEDED libc.so.3
>> #
>>
>> --Armin
>>
>>   >
>>   >
>>   >
>>   >  On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>>   >>  same result with version 6.5 !
>>   >>
>>   >>
>>   >>
>>   >>  _______________________________________________
>>   >>
>>   >>  OSTech
>>   >>  http://community.qnx.com/sf/go/post87732
>>   >>
>>   >
>>   >
>>   >
>>   >  _______________________________________________
>>   >
>>   >  OSTech
>>   >  http://community.qnx.com/sf/go/post87756
>>   >
>>   >
>>
>>
>>
>>
>> _______________________________________________
>>
>> OSTech
>> http://community.qnx.com/sf/go/post87758
>>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post87760
>
>

Attachment: Text dyn_debug.txt 29.6 KB Text working_libdll_test.txt 17.3 KB Text libdll_test.c 373 bytes Text dV-dlopen-call.c 210 bytes
Re: dlopen fails and dlerr returns "No dynamic section ..."  
I had no doubt that you do make a call to dlopen from your dV but the 
question is what is it linked against? I still think you somehow managed 
to link libc statically (at least dlopen definition).

Please do a 'nm' on your dV and see if dlopen is listed as an undefined 
symbol. I would expect that it is either not listed (since it's 
statically linked) or present and defined (which is not what you'd want 
in an executable).




On 08/02/2011 11:29 AM, Armin Steinhoff wrote:
>
> Aleksandar,
>
> there are no debug outputs related to dlopen with the dV application
> ("dyn_debug.txt") ... but dlopen has been called ("dV-dlopen-call.c")
>
> The trace file "working_libdll_test.txt" shows a working small test
> program (same shared object, "libdll_test.c")
>
>
> --Armin
>
>
>
> Aleksandar Ristovski wrote:
>> Could you run your executable on 6.5.0:
>>
>> # LD_DEBUG=1 ./dV
>>
>> and see where is dlopen resolving from?
>>
>> (Look for:
>> debug: Symbol dlopen bound to definition in ...)
>>
>>
>>
>>
>> On 08/02/2011 09:04 AM, Armin Steinhoff wrote:
>>> Aleksandar Ristovski wrote:
>>>    >   You are linking libc statically, and in that case dynamic linking won't
>>>    >   work.
>>>
>>> Not the case ... I'm linking against libs.so.3 ... dV is the
>>> application:
>>>
>>> # objdump -x dV | grep NEEDED
>>> NEEDED libm.so.2
>>> NEEDED libsocket.so.2
>>> NEEDED libcpp.so.4
>>> NEEDED libph.so.3
>>> NEEDED libasound.so.2
>>> NEEDED libSDL-1.2.so.0
>>> NEEDED libc.so.3
>>> #
>>>
>>> --Armin
>>>
>>>    >
>>>    >
>>>    >
>>>    >   On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>>>    >>   same result with version 6.5 !
>>>    >>
>>>    >>
>>>    >>
>>>    >>   _______________________________________________
>>>    >>
>>>    >>   OSTech
>>>    >>   http://community.qnx.com/sf/go/post87732
>>>    >>
>>>    >
>>>    >
>>>    >
>>>    >   _______________________________________________
>>>    >
>>>    >   OSTech
>>>    >   http://community.qnx.com/sf/go/post87756
>>>    >
>>>    >
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> OSTech
>>> http://community.qnx.com/sf/go/post87758
>>>
>>
>>
>>
>> _______________________________________________
>>
>> OSTech
>> http://community.qnx.com/sf/go/post87760
>>
>>
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post87768
Re: dlopen fails and dlerr returns "No dynamic section ..."  
Aleksandar Ristovski wrote:
> I had no doubt that you do make a call to dlopen from your dV but the
> question is what is it linked against? I still think you somehow managed
> to link libc statically (at least dlopen definition).

Yes, that's the point!  The dlxxx calls are part of a static library.
But what the linker does seems a little bit unpedictable.

Using the -Bdynamic option shows that  "dlopen"  and "dlsym" are listed 
as undefined in the output of "objdump".
"dlopen" and "dlsym" are working now but the execution of the code of 
"dll.so" is crashing ...

However .... I will place the code for the dynamic linking stuff  into a 
separate shared library and do linking
against libc.so.3 using the -Bdynamic option. Hope this helps ...

Many thanks for your help

--Armin


>
> Please do a 'nm' on your dV and see if dlopen is listed as an undefined
> symbol. I would expect that it is either not listed (since it's
> statically linked) or present and defined (which is not what you'd want
> in an executable).
>
>
>
>
> On 08/02/2011 11:29 AM, Armin Steinhoff wrote:
>> Aleksandar,
>>
>> there are no debug outputs related to dlopen with the dV application
>> ("dyn_debug.txt") ... but dlopen has been called ("dV-dlopen-call.c")
>>
>> The trace file "working_libdll_test.txt" shows a working small test
>> program (same shared object, "libdll_test.c")
>>
>>
>> --Armin
>>
>>
>>
>> Aleksandar Ristovski wrote:
>>> Could you run your executable on 6.5.0:
>>>
>>> # LD_DEBUG=1 ./dV
>>>
>>> and see where is dlopen resolving from?
>>>
>>> (Look for:
>>> debug: Symbol dlopen bound to definition in ...)
>>>
>>>
>>>
>>>
>>> On 08/02/2011 09:04 AM, Armin Steinhoff wrote:
>>>> Aleksandar Ristovski wrote:
>>>>     >    You are linking libc statically, and in that case dynamic linking won't
>>>>     >    work.
>>>>
>>>> Not the case ... I'm linking against libs.so.3 ... dV is the
>>>> application:
>>>>
>>>> # objdump -x dV | grep NEEDED
>>>> NEEDED libm.so.2
>>>> NEEDED libsocket.so.2
>>>> NEEDED libcpp.so.4
>>>> NEEDED libph.so.3
>>>> NEEDED libasound.so.2
>>>> NEEDED libSDL-1.2.so.0
>>>> NEEDED libc.so.3
>>>> #
>>>>
>>>> --Armin
>>>>
>>>>     >
>>>>     >
>>>>     >
>>>>     >    On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>>>>     >>    same result with version 6.5 !
>>>>     >>
>>>>     >>
>>>>     >>
>>>>     >>    _______________________________________________
>>>>     >>
>>>>     >>    OSTech
>>>>     >>    http://community.qnx.com/sf/go/post87732
>>>>     >>
>>>>     >
>>>>     >
>>>>     >
>>>>     >    _______________________________________________
>>>>     >
>>>>     >    OSTech
>>>>     >    http://community.qnx.com/sf/go/post87756
>>>>     >
>>>>     >
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>> OSTech
>>>> http://community.qnx.com/sf/go/post87758
>>>>
>>>
>>>
>>>...
Re: dlopen fails and dlerr returns "No dynamic section ..."  
Hi Aleksandar,

it's working now also for 6.4.1!!

The special -Bdynamic section must be closed with -lc ....

Thanks

--Armin


Aleksandar Ristovski wrote:
> I had no doubt that you do make a call to dlopen from your dV but the
> question is what is it linked against? I still think you somehow managed
> to link libc statically (at least dlopen definition).

Yes, that's the point!  The dlxxx calls are part of a static library.
But what the linker does seems a little bit unpedictable.

Using the -Bdynamic option shows that  "dlopen"  and "dlsym" are listed 
as undefined in the output of "objdump".
"dlopen" and "dlsym" are working now but the execution of the code of 
"dll.so" is crashing ...

However .... I will place the code for the dynamic linking stuff  into a 
separate shared library and do linking
against libc.so.3 using the -Bdynamic option. Hope this helps ...

Many thanks for your help

--Armin


>
> Please do a 'nm' on your dV and see if dlopen is listed as an undefined
> symbol. I would expect that it is either not listed (since it's
> statically linked) or present and defined (which is not what you'd want
> in an executable).
>
>
>
>
> On 08/02/2011 11:29 AM, Armin Steinhoff wrote:
>> Aleksandar,
>>
>> there are no debug outputs related to dlopen with the dV application
>> ("dyn_debug.txt") ... but dlopen has been called ("dV-dlopen-call.c")
>>
>> The trace file "working_libdll_test.txt" shows a working small test
>> program (same shared object, "libdll_test.c")
>>
>>
>> --Armin
>>
>>
>>
>> Aleksandar Ristovski wrote:
>>> Could you run your executable on 6.5.0:
>>>
>>> # LD_DEBUG=1 ./dV
>>>
>>> and see where is dlopen resolving from?
>>>
>>> (Look for:
>>> debug: Symbol dlopen bound to definition in ...)
>>>
>>>
>>>
>>>
>>> On 08/02/2011 09:04 AM, Armin Steinhoff wrote:
>>>> Aleksandar Ristovski wrote:
>>>>     >    You are linking libc statically, and in that case dynamic linking won't
>>>>     >    work.
>>>>
>>>> Not the case ... I'm linking against libs.so.3 ... dV is the
>>>> application:
>>>>
>>>> # objdump -x dV | grep NEEDED
>>>> NEEDED libm.so.2
>>>> NEEDED libsocket.so.2
>>>> NEEDED libcpp.so.4
>>>> NEEDED libph.so.3
>>>> NEEDED libasound.so.2
>>>> NEEDED libSDL-1.2.so.0
>>>> NEEDED libc.so.3
>>>> #
>>>>
>>>> --Armin
>>>>
>>>>     >
>>>>     >
>>>>     >
>>>>     >    On 08/01/2011 08:29 AM, Armin Steinhoff wrote:
>>>>     >>    same result with version 6.5 !
>>>>     >>
>>>>     >>
>>>>     >>
>>>>     >>    _______________________________________________
>>>>     >>
>>>>     >>    OSTech
>>>>     >>    http://community.qnx.com/sf/go/post87732
>>>>     >>
>>>>     >
>>>>     >
>>>>     >
>>>>     >    _______________________________________________
>>>>     >
>>>>     >    OSTech
>>>>     >    http://community.qnx.com/sf/go/post87756
>>>>     >
>>>>     >
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>> OSTech
>>>>...