Unix Technical Forum

Resolving symbols of shared library using run-time-linker

This is a discussion on Resolving symbols of shared library using run-time-linker within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hello, I was wondering if anybody could give me a hint concerning dynamic linking on AIX. Our problem: We ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 09:08 AM
Thomas Lenarz
 
Posts: n/a
Default Resolving symbols of shared library using run-time-linker

Hello,

I was wondering if anybody could give me a hint concerning dynamic
linking on AIX.

Our problem:

We have two third-party libraries: libupiccmx.so and libcmx.a.
libupiccmx.so. Both are shared libraries (libcmx.a contains shr.o)

libupiccmx.so uses functions in libcmx.a. (e.g. t_disrq).

Furthermore we have our own shared library libksc.so, which is made
from our own sources. This library uses functions from libupiccmx.so.

libksc.so is linked using the -G option to make a runtime-enabled
shared library.

Finally there is an application, say Main, which calls functions in
libksc.so.

So the calling-hirarchy is as follows:
Main-->libksc.so-->libupiccmx.so-->libcmx.a

Main is linked with all the libraries using the -L<path> -l<lib-name>
using the -rtl option to enable runtime-linking.

On startup of Main we get the following error-messages:

exec(): 0509-036 Cannot load program ./main because of the
following errors:
rtld: 0712-001 Symbol t_disrq was referenced
from module /opt/lib/upic/sys/libupiccmx.so(), but a runtime
definition
of the symbol was not found.
<repeated for other symbols>

I analysed the dump -H and dump -Tv and I just don't understand the
situation:

The linker says (at link-time):

(ld): lib /usr/lib/libcmx.a
(ld): lib /opt/lib/upic/sys/libupiccmx.so
(ld): lib /home/gtx/SODK/cpp/lib/aix/libso_worker.a

LIBRARY: Shared object libcmx.a[shr.o]: 86 symbols imported.

ER: There are no unresolved symbols.

I thought that means, it finds libcmx and imports symbols from it.

On the other hand the dump -H of main shows the following:

0

/home/gtx/RogueWave/SourcePro/Ed8/lib:/home/gtx/SODK/cpp/lib/aix:/home/dev

/Release/appserver/lib:/usr/lib:/opt/lib/upic/sys:/usr/vac/lib:/usr/lib/th
reads:/usr/vacpp/lib:/usr/lib:/lib
1 /home/dev/Release/appserver/lib libksc.so
2 libupiccmx.so
3 libnsl.a shr.o
4 libtls7915d.a tls15d.o
5 libpthreads.a shr_comm.o
6 libpthreads.a shr_xpg5.o
7 libxti_r.a shr.o
8 libC.a shr.o
9 libC.a shr2.o
10 libC.a shr3.o
11 libC.a ansi_32.o
12 libc.a shr.o
13 librtl.a shr.o

As you see libksc.so and libupiccmx.so are listed. But libcmx.a
(shr.o) ist missing. Why?

That is a quiet long post, I am afraid.

Any idea will be appreciated.

Thanks
Thomas
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 09:08 AM
Hajo Ehlers
 
Posts: n/a
Default Re: Resolving symbols of shared library using run-time-linker


Thomas Lenarz wrote:
> Hello,
>
> I was wondering if anybody could give me a hint concerning dynamic
> linking on AIX.
>
> Our problem:
>
> We have two third-party libraries: libupiccmx.so and libcmx.a.
> libupiccmx.so. Both are shared libraries (libcmx.a contains shr.o)
>
> libupiccmx.so uses functions in libcmx.a. (e.g. t_disrq).
>


1)
From
http://publib.boulder.ibm.com/infoce...ixcmds3/ld.htm

....
Shared objects that are archive members are not loaded automatically
unless automatic loading is enabled by an import file in the archive.
To enable automatic loading, see Import and Export File Format (-bI:
and -bE: Flags).
.....

So you might missing an import file

2)
Try the ' -G -bernotok ' option to see error message about missing
symbols

hth
Hajo

( Not a programmer at all so my advise can be totaly wrong )

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 09:08 AM
Hajo Ehlers
 
Posts: n/a
Default Re: Resolving symbols of shared library using run-time-linker


Thomas Lenarz wrote:
> Hello,
>
> I was wondering if anybody could give me a hint concerning dynamic
> linking on AIX.
>
> Our problem:
>
> We have two third-party libraries: libupiccmx.so and libcmx.a.
> libupiccmx.so. Both are shared libraries (libcmx.a contains shr.o)
>
> libupiccmx.so uses functions in libcmx.a. (e.g. t_disrq).
>


1)
From
http://publib.boulder.ibm.com/infoce...ixcmds3/ld.htm

....
Shared objects that are archive members are not loaded automatically
unless automatic loading is enabled by an import file in the archive.
To enable automatic loading, see Import and Export File Format (-bI:
and -bE: Flags).
.....

So you might missing an import file

2)
Try the ' -G -bernotok ' option to see error message about missing
symbols

hth
Hajo

( Not a programmer at all so my advise can be totaly wrong )

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-05-2008, 09:09 AM
Gary R. Hook
 
Posts: n/a
Default Re: Resolving symbols of shared library using run-time-linker

Hajo Ehlers wrote:
> Shared objects that are archive members are not loaded automatically
> unless automatic loading is enabled by an import file in the archive.
> To enable automatic loading, see Import and Export File Format (-bI:
> and -bE: Flags).


This is correct. The autoload feature may need to be used to force
the needed module to be a dependent of main.

Quick fix: add an export list when building your main app and include
the required symbol. This will cause libcmx.a(shr.o) to become a
direct dependent, and thus be available at runtime.

I need to go research this issue and see what needs to be fixed...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-05-2008, 09:10 AM
Thomas Lenarz
 
Posts: n/a
Default Re: Resolving symbols of shared library using run-time-linker

>
>I was wondering if anybody could give me a hint concerning dynamic
>linking on AIX.
>

Thanks a lot for your help.

Through help from support of libupiccmx and cmx and using an
upic-programming-example we came to the following possibility which
actually works:

We discovered that the example was linked statically with libupiccmx.a
which exists in the same directory like libupiccmx.so.

Following the example we listed libupiccmx.a within the -- object-file
-- list when linking our dynamic library libksc.so.

The application main ist linked dynamically and using the
runtime-linker option -brtl like before.

The result is:

main needs:
/usr/lib/libnsl.a(shr.o)
....
/usr/lib/libxti_r.a(shr.o)
....
----> /usr/lib/libcmx.a(shr.o)
....

I imagine this way the static library libupiccmx.a becomes a part of
our dynamic library which then itself is linked dynamically to our
application module.

I do not really understand why this causes the dynamic-link-library
libcmx.a (used by libupiccmx.a) to be linked properly.

We still will have to try the variant using an export file as you
suggested.

Thanks a lot again
Thomas


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com