View Single Post
Old 08-20-2012, 10:27 PM   #36
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
okay so to this end let's use an app. fftw-wisdom is one I was wanting to play with : )

For obvious reasons.

so step 1) use readelf to find dependant stuffs.

(I've tidied the output up)
Code:
[root@kindle bin]# readelf -d fftw-wisdom
     22566:	calling init: /lib/libc.so.6
     22566:	calling init: /lib/libgcc_s.so.1
     22566:	calling init: /mnt/us/usr/lib/libz.so.1
     22566:	initialize program: readelf
     22566:	transferring control: readelf

Dynamic section at offset 0xa00c contains 27 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libfftw3.so.3]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000f (RPATH)                      Library rpath: [/home/you/BLDS/buildroot/build/fftw-3.3/.libs]
     22566:	calling fini: readelf [0]
     22566:	calling fini: /mnt/us/usr/lib/libz.so.1 [0]
     22566:	calling fini: /lib/libgcc_s.so.1 [0]
     22566:	calling fini: /lib/libc.so.6 [0]
     22566:
That's with the LD_DEBUG mods giving us some input too.
Ugly RPATH there. : \



So anyways, I figure.

b) copy the stuff to a test folder and nerf my handsets env variables.

then c) launch it via a VERY simple one or two liner script. perhaps a generic one accepting the app as an argument, or if that is too much typing just one per app.

the requirement would be that the $PWD is the executing directory and perhaps this too could be coerced within the script. Certainly a [ -e] or something won't hurt.

okay well I'm hooking this up now.

libs in /libs folder
app in root.
script in root.

Code:
#!/bin/sh

######################################
#suck, squeeze, bang, blow?
######################################

#One way
#env LD_LIBRARY_PATH=$PWD:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin\
#./fftw-wisdom

#Another way
/lib/ld-linux.so.3 --library-path $PWD/lib:/usr/lib:/lib \
--inhibit-rpath libfftw3.so.3 ./fftw-wisdom
Cheers.

Last edited by twobob; 08-20-2012 at 11:00 PM. Reason: Ugly RPATH there. : \ added two ways
twobob is offline   Reply With Quote