View Single Post
Old 08-29-2015, 05:09 AM   #15
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by Micky Wicky View Post
Note that this will not survive an update.

NiLuJe's suggestion of tweaking LD_LIBRARY_PATH is probably the best way short of recompiling.
I vote for second best, but if your going to do it ...

Put your modification inside of: */extensions/kterm/bin/kterm.sh
Where '*/' is either: "/mnt/us/" or "Kindle:/" depending on from where your viewing USBstorage.

= = = =

First best, include the library location in the executable's header instead of the wrapper script.
Note that there are two executables:
kterm and matchbox-keyboard (whose keycaps are *.png images).

Combining the above with including protection from updates while not running out of room in /lib:

There is a provision in the ELF format to make the dynamic loader's search order act the same as that used by Windows.
I.E: Libraries are searched for first in the same directory as the executable (or other requester).

The dynamic loader recognizes a special wildcard in the DT_RUNPATH (DT_RPATH is obsolete), which is:
$ORIGIN
exactly as printed above.
The tool to do this with is: patchelf

Going from a combination of memory and "man patchelf" (and presumes you have a backup of the kterm install) - - -
Code:
cd /mnt/us/extensions/kterm/bin

patchelf --print-rpath kterm
patchelf --print-rpath matchbox-keyboard

# patchelf edits in-place and does not have a prepend option, so
# on your scratch pad, prepend whatever was printed above by:
# $ORIGIN:</whatever/rpath/was:/already/here.so>
# Note that it IS a path, using the ':' separator.

patchelf --set-rpath $ORIGIN<:whatever> kterm
patchelf --set-rpath $ORIGIN<:whatever> matchbox-keyboard

# Copy any required libraries that are missing from the Amazon image
# into the same directory that the executables are in (*/extensions/kterm/bin).

# Now shrink the rpath to the minimum while checking if all things
# tagged as DT_NEEDED can be found:

patchelf --shrink-rpath kterm
patchelf --shrink-rpath matchbox-keyboard
The above **should** work to 'fix' kterm after Amazon 'fixed' the graphic libraries.

= = = = =

References:
Code:
bin $ objdump -x kterm | grep 'NEEDED'
  NEEDED               libgtk-x11-2.0.so.0
  NEEDED               libgdk-x11-2.0.so.0
  NEEDED               libatk-1.0.so.0
  NEEDED               libgio-2.0.so.0
  NEEDED               libpangoft2-1.0.so.0
  NEEDED               libgdk_pixbuf-2.0.so.0
  NEEDED               libpangocairo-1.0.so.0
  NEEDED               libcairo.so.2
  NEEDED               libpango-1.0.so.0
  NEEDED               libfreetype.so.6
  NEEDED               libfontconfig.so.1
  NEEDED               libgobject-2.0.so.0
  NEEDED               libgmodule-2.0.so.0
  NEEDED               libgthread-2.0.so.0
  NEEDED               librt.so.1
  NEEDED               libglib-2.0.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  NEEDED               libX11.so.6
  NEEDED               libm.so.6
Code:
bin $ objdump -x matchbox-keyboard | grep 'NEEDED'
  NEEDED               libX11.so.6
  NEEDED               libXtst.so.6
  NEEDED               libXft.so.2
  NEEDED               libexpat.so.1
  NEEDED               libpng12.so.0
  NEEDED               libc.so.6
  NEEDED               libXrender.so.1
= = = = =

Corrections and/or confirmations of the above - - - -
Just post them here, in this thread.

Last edited by knc1; 08-29-2015 at 05:25 AM.
knc1 is offline   Reply With Quote