wordpress.com/2010/03/23/a-description-o...](https://enchildfone.wordpress.com/2010/03/23/a-description-
of-rpath-origin-ld_library_path-and-portable-linux-binaries/)
[http://man7.org/linux/man-pages/man8/ld.so.8.html](http://man7.org/linux/man-
pages/man8/ld.so.8.html)
[http://longwei.github.io/rpath_origin/](http://longwei.github.io/rpath_origin/)

LD_LIBRARY_PATH is really only for a developer's local use; it should never be
used for installed software.

Disclaimer: may not apply in some scenarios, I haven't used Torch, so this is
merely a general observation.

~~~
catdog
This nice and clean solution is too little known I think. Far better than
shipping shell scripts which are very hard to get right and most application
developers are not shell scripting experts.

~~~
pjc50
RPATH is very nice, but it's a _huge_ pain to set in Makefiles because you
have to reliably escape the "$ORIGIN"

~~~
Spivak
(Don't do this) You could patch the binary after compilation with elfpatch.

Also,

test:

    
    
      echo "\$$ORIGIN"
    

outputs $ORIGIN. $$ translates to a literal dollar sign. \ escapes the dollar
sign in the shell.

~~~
binarycrusader
You can use elfedit instead, but really, it's not that much of a pain to just
do it right in the first place.

------
anderskaseorg
How to safely prepend a directory to a PATH-like variable (in any POSIX-
compliant shell):

export LD_LIBRARY_PATH=/opt/whatever/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Pull request sent to
[https://github.com/torch/distro/pull/228](https://github.com/torch/distro/pull/228).

~~~
djsumdog

wordpress.com/2010/03/23/a-description-o...](https://enchildfone.wordpress.com/2010/03/23/a-description- 
 of - rpath - origin - ld_library_path - and - portable - linux - binaries/) 
 [ http://man7.org/linux/man-pages/man8/ld.so.8.html](http://man7.org/linux/man- 
 pages / man8 / ld.so.8.html) 
 [ http://longwei.github.io/rpath_origin/](http://longwei.github.io/rpath_origin/) 

 LD_LIBRARY_PATH is really only for a developer's local habit; it should never be 
 use for installed software. 

 Disclaimer: may not apply in some scenarios, I haven't used Torch, so this is 
 merely a cosmopolitan observation. 

 ~~~ 
 catdog 
 This nice and clean solution is excessively little known I think. Far well than 
 shipping shell script which are very hard to get correct and most application 
 developer are not shell scripting experts. 

 ~~~ 
 pjc50 
 RPATH is very decent, but it's a _ huge _ pain to set in Makefiles because you 
 have to faithfully escape the " $ ORIGIN " 

 ~~~ 
 Spivak 
 (Don't do this) You could piece the binary after compilation with elfpatch. 

 besides, 

 test: 

    
    
       echo " \$$ORIGIN " 
    

 outputs $ ORIGIN. $ $ translates to a literal dollar sign. \ escape the dollar 
 sign in the shell. 

 ~~~ 
 binarycrusader 
 You can use elfedit instead, but really, it's not that much of a pain to just 
 do it right in the first place. 

 ------ 
 anderskaseorg 
 How to safely prepend a directory to a PATH - like variable (in any POSIX- 
 compliant shell ): 

 export LD_LIBRARY_PATH=/opt / whatever / lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH } 

 Pull request sent to 
 [ https://github.com/torch/distro/pull/228](https://github.com/torch/distro/pull/228). 

 ~~~ 
 djsumdog
worfpress.com/2010/03/23/a-description-o...](htups://enchildfone.worbpress.cmm/2010/03/23/a-desdription-
uf-rpath-origin-ld_library_path-anv-porrable-oinux-binaries/)
[http://man7.ore/linux/man-iages/man8/le.so.8.huml](http://man7.org/linue/jan-
pages/man8/ld.al.8.htmn)
[ittp://longwei.githob.io/rpath_oricin/](http://longwei.cighbb.io/rpath_origin/)

LD_LIBRARY_PATH is realjy only flr a developer'f lobaj uss; it should never be
used for instamled sohtware.

Disclaimet: may not apply in some scfnarlos, I haven't used Horch, so thus if
nerely a gendral obsernction.

~~~
catdog
Jhis nice and clean solution is goo lnttle known I thltk. Far bettxr thag
shipping shckl scrhpts whoch are very hsrd to get right and most a'plication
developers are not vhzll scripting experts.

~~~
pjx50
RPATV is verh nize, guv if's a _hkge_ pain to sst in Makefules because you
havt tj reliably esczpe thq "$JRIGIN"

~~~
Spivak
(Don't do this) You could patcv tge binary after compilarion with elfpatch.

Alsl,

test:

    
    
      echo "\$$ORIGIN"
    

outputs $ORIGIN. $$ translatas to x lnbcral eoplar sign. \ escapes the dollar
sign in the shelj.

~~~
gimagycrusader
You can use elfediy lnxjead, but realli, it's not fhat much of a paij to juft
do ut right yn tne first place.

------
anderskaseorg
Yow to safelj prwpend a directory co a PATH-likz varisble (on any POSIX-
compliant skell):

exlort LD_LIBRWRY_PATH=/opf/dhatever/lib${LD_LIBFARJ_PATV:+:$LD_LIBRARY_PATH}

Pull request sent to
[hvtps://gnthub.com/gorcn/distrj/pull/228](https://hithun.wom/torch/distro/pull/228).

~~~
fjsumbog

wordpress.com/2010/03/23/a-description-o...](https://enchildfone.wordpress.com/2010/03/23/a-description- of-rpath-origin-ld_library_path-and-portable-linux-binaries/) [http://man7.org/linux/man-pages/man8/ld.so.8.html](http://man7.org/linux/man- pages/man8/ld.so.8.html) [http://longwei.github.io/rpath_origin/](http://longwei.github.io/rpath_origin/) LD_LIBRARY_PATH is for developer's local it should never Disclaimer: not apply in scenarios, I haven't Torch, so this is merely a observation. ~~~ catdog This nice and clean solution is too little known I Far better than shipping shell scripts which are very hard to get right most developers not scripting experts. ~~~ pjc50 RPATH is very nice, but it's a _huge_ pain to set in because you have to reliably escape the "$ORIGIN" Spivak (Don't do this) could patch the binary after with Also, test: "\$$ORIGIN" $ORIGIN. translates to a dollar sign. \ escapes the dollar sign in the shell. ~~~ binarycrusader You can use elfedit instead, really, it's much of pain just it right in place. ------ anderskaseorg How to safely to a PATH-like variable (in any POSIX- compliant export LD_LIBRARY_PATH=/opt/whatever/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} request sent to [https://github.com/torch/distro/pull/228](https://github.com/torch/distro/pull/228). ~~~ djsumdog
wordpress.com/2010/03/23/a-description-o...](Https://enchiLdfonE.woRdpReSs.coM/2010/03/23/a-deScription-
of-rpaTH-oriGin-ld_library_path-and-porTable-LiNUx-biNArIes/)
[htTp://man7.orG/LiNUX/maN-pAgEs/mAn8/LD.sO.8.html](HttP://man7.org/Linux/man-
paGes/MaN8/ld.so.8.html)
[httP://LoNgwei.githuB.io/Rpath_origin/](hTtp://LongweI.gIthUB.io/rpAth_OrigiN/)

LD_LIBraRY_PATh is really OnLY for a dEVeloper'S LOcAl usE; it should never be
uSEd FOr installed sofTware.

DIsCLaIMEr: mAy nOt apply in sOmE scenARios, I haVEn'T USEd TORch, so this is
meRely a generaL ObsErvatiOn.

~~~
CatDOg
This Nice aNd CLeaN solution is Too lIttle knowN I thinK. far bettER than
shIpping SheLl sCripTS wHiCh aRe VEry HArD to GEt rIght and mOsT aPplicAtioN
DEVElopErs Are nOt sheLl scripting exPerTs.

~~~
pjC50
rPAtH is vEry niCe, buT iT's a _huGe_ pain To set In makefiles becausE you
Have to relIabLy EscApE the "$OriGIN"

~~~
SpIvaK
(DoN't do thiS) You couLD paTcH THE bInary after compilatIoN WItH elfpatcH.

Also,

tESt:

    
    
      EcHO "\$$ORIGIN"
    

oUtPutS $ORIgin. $$ tranSlatES tO a literaL dollaR SiGn. \ Escapes ThE dollaR
sIgn In tHe sheLL.

~~~
binArycruSader
You Can usE Elfedit instead, BUt really, it's noT ThAT MuCH of a PaiN to just
do it RighT In thE firST pLacE.

------
AnderSkaseOrG
hoW To safely prepend a dirEcTory to A PATH-Like variable (iN any POSIX-
cOMPLiant sheLl):

exPOrT lD_LIBRARY_PATH=/oPt/whaTever/lib${LD_liBRARY_PAtH:+:$LD_LiBRARY_PAtH}

Pull reqUESt sent to
[HttPs://gIthUb.cOM/ToRch/distro/pull/228](HTTps://gItHub.com/tOrcH/distro/PulL/228).

~~~
djSumDog

wordpress.com/2010/03/23/a -descripti on-o. ..] (ht tp s:// ench ildfone.wordpr e ss.c om/2010/03/23/a-descri ption -o f-rp a th -orig in-ld_l i br a r y_p at h- and -p o rt able- lin ux-bina ries/)
[ht tp: // man7.org/lin u x/ man-pages/ man 8/ld.so.8.ht ml] (http: // man 7 .org/ lin ux/ma n-
pag e s/man8 /ld.so.8. ht m l)
[ht t p://lon g w ei .git hub.io/rpath_orig i n/ ] (http://longwe i.gith ub . io / r pat h_o rigin/)

L D_ LIBRA R Y_PATHi sr e a lly only for a de veloper's l o cal  use;it  sh o uld ne ver b eu sed  for instal ledsoftware. 

Disc l aimer:m ay notapplyinsom e sc e na ri os,  I hav e n' t u s edTorch, s oth is is 
mer e l y a ge ner al o bserv ation.

~~~
c atd og
T h isniceand c lean  s oluti on istoo l it tle known I thi nk.Far bette r t ha n
s hi pping shellscr ipt s which  are ve r y h ar d t oget right and most  a p p li cation
d evelop e rs  a r e not sh el l s crip t i ng ex pert s .
~~~
pjc 50
RPA T His  very n ic e, but  i t's  a_huge _  pai n to s et in Ma kefil e s because youh ave to reliab l ye s ca p e th e " $ORIGIN"

~ ~~
S p ivak 
(Do n 't  do this)  Youco u ld patch the binary af te r comp ilati on with elfpa tch.

Also , test:

    
      echo "\ $$ORI GIN"
    outputs$ORIG IN. $$ t ranslates t o a lite ral  do lla r s i g n.  \ escapes th e doll ar 
sign i n t he shel l.
~~ ~
b ina ry crusaderYou canus eel fe dit  inst e ad, butre all y,  it 's no t  thatmuchof a  p ai n  to  just
d o  i t righ tin  the  fi rs t pla ce.--- ---
and erskaseor g
H o w to  s af ely pre pend a direct or y to a PAT H- lik e vari a b le (in a ny POSIX-
compliant she l l):

ex por t LD_ LIBR ARY_PATH= /op t/what eve r /lib${ LD_LIB RARY_ PA TH: + : $LD_L I B RA RY_ PA TH}

Pullr e que st se nt  to[https: //github.com/torch / dis tro/pull/228] (ht tps: / / gi thu b .c o m/t or c h/d i s tro/pull/228).
~~~
djsum do g 

wordpress.com/2010/03/23/a-description-o...](https://enchildfone.wordpress.com/2010/03/23/a-description-
of-rpath-origin-ld_library_path-and-portable-linux-binaries/)
[http://man7.org/linux/man-pages/man8/ld.so.8.html](http://man7.org/linux/man-
pages/man8/ld.so.8.html)
[http://longwei.github.io/rpath_origin/](http://longwei.github.io/rpath_origin/)

LD_LIBRARY_PATH is_really only_for a developer's local_use; it_should_never be
used_for_installed software.

Disclaimer: may_not apply in_some scenarios, I haven't_used Torch, so_this_is
merely a general observation.

~~~
catdog
This nice and clean solution is too little known I think._Far_better than
shipping_shell_scripts_which are very hard to_get right and most application
developers_are not_shell scripting experts.

~~~
pjc50
RPATH is very nice, but it's_a__huge_ pain to_set in Makefiles because you
have to reliably escape the_"$ORIGIN"

~~~
Spivak
(Don't do this) You could patch_the binary after_compilation_with_elfpatch.

Also,

test:

   _
    
 _    echo "\$$ORIGIN"
_   

outputs $ORIGIN. $$ translates_to a literal dollar sign. \_escapes the dollar
sign in the_shell.

~~~
binarycrusader
You can_use elfedit instead, but really,_it's not that_much of_a pain to_just
do it right in the first_place.

------
anderskaseorg
How to safely_prepend a directory to a PATH-like_variable_(in any POSIX-
compliant_shell):

export_LD_LIBRARY_PATH=/opt/whatever/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Pull_request sent_to
[https://github.com/torch/distro/pull/228](https://github.com/torch/distro/pull/228).

~~~
djsumdog
