Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LD_LIBRARY_PATH precedence

I've just stumbled on some weird behavior: before I launch my application I've set the LD_LIBRARY_PATH to some local lib directory which contains all needed libs. After launch I have part(the most part) libs are loaded from the LD_LIBRARY_PATH but a few are loaded from the standard /usr/lib(e.g /usr/lib/libQtNetwork.so.4, /usr/lib/libSM.so.6). All those libs are contained in the directory which is listed in the LD_LIBRARY_PATH. Could anyone explain why do I have such behavior? I'm not very familiar with a Linux world but this article says that my approach should work

P.S. If I rename /usr/libs to something other I'll have my application running with all libs used from my libs location

Thank in advance!

like image 282
ixSci Avatar asked Oct 12 '22 11:10

ixSci


1 Answers

I've found the answer and the answer is RPATH. All Qt libraries are built with RPATH=$QT_INSTALL_DIR so the RPATH should be removed if you want to create "bundle" in Linux. RPATH can be removed by invoking chrpath command. Thanks all for help!

like image 190
ixSci Avatar answered Oct 15 '22 09:10

ixSci