Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Embedding Runtime Search Path into Library on AIX


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Embedding Runtime Search Path into Library on AIX

My product has 2 libraries say "x & y".
x depends on y.

During the installation of my products package, user will be prompted for his own location to copy my product libraries.
Installation will copy libraries "x & y" and create my product specific ENV variable say "MYPATH" pointing to User picked install location.


Here User doesn't want to set LIBPATH nor he want to create any softlinks in "/usr/lib or /lib".


Now I should make my library "x" find its dependent "y" in the environment where there is no LIBPATH set nor softlinks created in "/usr/lib or /lib".

On other UNIX platforms, there is a concept of $ORIGIN and i am successful using this on other Unix platforms.

Since there is no concept of $ORIGIN on AIX, trying out alternatives on AIX




My Scenario:
************

My package install creates ENV variable “MYPATH” pointing to the User picked installed location.
Let say, User selected /home/lib and install will set "MYPATH=/home/lib"

Now I thought of accessing this variable in the runtime search path (Either specifying using -L or –blibpath) while building my libraries (x & y).

For a particular library, runtime search path(dump -X32 -H) should be like
INDEX PATH
0 $MYPATH


I’ve tried specifying $MYPATH in the makefile using “-L or –blibpath” but as MYPATH is not available during build time, NULL value got replaced.

INDEX PATH
0


I want $MYPATH to be considered as is so that at runtime it gets replaced with its value.

Tried Escaping $ and also used quotes but no use.
ex: $$\(MYPATH\)


Can this be possible? If possible, then how?


-Srikrishna Erra.

Last edited by erra_krishna; 10-15-2014 at 04:35 PM..
# 2  
Usually, the compiler has a -R option (your compiler may vary) to specify the run time $LD_LIBRARY_PATH replacement. This is not really for general use, as $LD_LIBRARY_PATH or whatever local ld() likes is preferred, see man pages, but it is needed for set-uid and set-gid applications, where the LD_LIBRARY_PATH is ignored for pretty obvious security reasons.
# 4  
Anyway -R or LD_RUN_PATH set a library search path at compile time that becomes hard-coded in the binary. It cannot evaluate a MYPATH at runtime.
I think you need to create a start wrapper at installation time that sets LD_LIBRARY_PATH - typically a shell wrapper that prepends the custom location to LD_LIBRARY_PATH. At the end the wrapper calls the binary, passing the command line arguments.
Code:
#!/bin/sh
installdir=/usr/local # to be patched
LD_LIBRARY_PATH=$installdir/lib
export LD_LIBRARY_PATH
exec $installdir/bin/binary "$@"

# 5  
How about -Z: IBM Compilers

As I said, for prosaic situations use: $LD_LIBRARY_PATH

On old HPUX, it seems they fuse in the path of every dynamic, so you have to use chattr to strip them out for a user-local install.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. AIX

AIX full path to socket library

Can somebody help me too identify full path to socket library on AIX? Cannot find anything Thanks for contribution (2 Replies)
Discussion started by: digioleg54
2 Replies

2. UNIX for Advanced & Expert Users

AIX runtime programming issue

I hope my title is accurate enough. I have a product that we port to various UNIX platforms. It is known to run on AIX but using the IBM compiler from years ago. Recently we got a different used AIX P5 platform running AIX 5.3 and we setup the GCC compiler (4.4.5 I think). C and C++ source code.... (5 Replies)
Discussion started by: Pug
5 Replies

3. Programming

C++ library path

Hello, How to set up the path for downloaded C/C++ libraries (or, header files) so that they can be included like system headers (stdio.h or iostream)? The libraries/headers are from a package containing different folders each has different sets of headers and put in... (1 Reply)
Discussion started by: yifangt
1 Replies

4. AIX

How to Check the what runtime package is applied on AIX OS

Hi Experts, How to Check the what runtime package is applied on AIX OS? I would like to verify if “xlcpp.rte.10.1.0.aix.base” package is applied or not ? thanks in advance. -Mallela (1 Reply)
Discussion started by: meetmallela
1 Replies

5. Programming

Shared library versioning problem at runtime

My executable was linked under RedHat using the LessTif GUI shared library. When I try to run it under UBUNTU, I get an error message that the LessTif library cannot be found. The LessTif library is there, but it is a newer VERSION. My executable is looking for the older version it was linked with.... (1 Reply)
Discussion started by: imagtek
1 Replies

6. AIX

runtime libs accessed by application in AIX

Hi , I need some inputs on runtime or shared libs for an application(s) in AIX . i have a requirement saying i need to rehost all the production applications into new AIX OS . Here Source and target oS is AIX but with different versions so for this i need to identify what are the... (1 Reply)
Discussion started by: naren_chella
1 Replies

7. Solaris

Re:How to get the path during runtime?

Thank u vgesh99 It works well.. (1 Reply)
Discussion started by: Nandagopal
1 Replies

8. Solaris

How to get the path during runtime?

Hi guys, I have commands like /solaris/opt/VRTS/bin/vxdisk /opt/VRTS/bin/vxdisk From these two commands, i need to get the directory path value before /VRTS/bin/vxdisk at runtime. e.g /solaris/opt/VRTS/bin/vxdisk as /solaris/opt /opt/VRTS/bin/vxdisk as /opt I have tried with cut... (1 Reply)
Discussion started by: Nandagopal
1 Replies

9. Linux

Plz Help me to find GNU C++ Runtime Library

Hi, I am working with red hat Linux and i want to install one program but I am getting the error This product requires the GNU C++ Runtime Library (libstdc++-libc6.2-2.so.3) or later. Your system must be upgraded before installation can proceed. So please tell me how can i remove this... (2 Replies)
Discussion started by: smartgupta
2 Replies

10. UNIX for Dummies Questions & Answers

library path

How do you get an application to use an alternate library? Dave:confused: (2 Replies)
Discussion started by: nucca
2 Replies

Featured Tech Videos