AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  dlopen and LIBPATH

    Posted Wed June 25, 2008 06:14 PM

    Originally posted by: ArtK


    I'm having an issue with dlopen() loading libraries that I would like some advice on. It's a tad complicated, so please bear with me.

    There is a whole chain of programs and libraries that are loaded and/or executed. I have no control over the upper part of this "stack," except for being able to set the LIBPATH environment variable and having it stick. We eventually get down to my first shared library, LibX. LibX issues a dlopen() to load LibY. The load of LibY is failing.

    LibY is linked with a runtime module from another product, ProdRTA.a (a shared library is inside the archive, in typical AIX fashion.) ProdRTA.a exists in two forms, one is 32-bit and the other is 64-bit. The 32-bit library is in /usr/lib (i.e. /usr/lib/ProdRT.a). The 64-bit library is in /usr/ProdA/lib64/ProdRT.a. LibX and LibY (and all of their ancestors) are 64-bit libraries or programs.

    Despite the fact that /usr/ProdA/lib64 is baked into the runtime path for LibX and LibY, and I have LIBPATH=/usr/ProdA/lib64, the runtime loader is attempting to load /usr/lib/ProdRT.a and the load is failing because we can't mix modes.

    I see in the AIX documentation that the load() subroutine will favor the path at exec time, if the L_LIBPATH_EXEC flag is set. dlopen() has no such flags and the dlopen() documentation doesn't mention the possiblity.

    Loading /usr/ProdA/lib64/ProdRTA.a before loading LibY doesn't help, the runtime loader still searches /usr/lib first.

    I'm interested in any ideas about: 1) Why the loader is ignoring LIBPATH and the baked-in paths; and 2) How I can make this work!

    Thanks!
    #AIX-Forum


  • 2.  Re: dlopen and LIBPATH

    Posted Wed June 25, 2008 07:10 PM

    Originally posted by: SystemAdmin


    I may be off-base here, but my understanding is that AIX can handle both 32-bit and 64-bit libraries in the same archive. That is if you are compiling the libraries and creating ProdRTA.a, you should put the 32-bit and 64-bit objects created during compilation into the same ProdRTA.a archive and put it under /usr/lib or somewhere indicated by LIBPATH. AIX should be capable of picking out the appropriate library from the archive.

    Of course, if you don't have the source code (or libraries) available that are used to create ProdRTA.a then this doesn't really help you much.

    Unfortunately, I don't know why your attempts at solving this problem by manipulating LIBPATH have not worked.

    I hope this helps...
    Brian
    #AIX-Forum


  • 3.  Re: dlopen and LIBPATH

    Posted Wed June 25, 2008 08:00 PM

    Originally posted by: ArtK


    Thanks Brian. Unfortunately, it doesn't help. I have no control over how ProdRT.a is built. I can control how LibX and LibY are built and a little bit of the environment, but that's about it.
    #AIX-Forum