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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 ) |
| |||
| 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 ) |
| |||
| 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... |
| ||||
| > >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 |