Friday, May 10, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 4413  / 2 Years ago, tue, april 26, 2022, 6:40:19

I have qtcreator installed using the qt online installer. It ships which its own version of qt library. The qt library are also installed in the system directories, but those are older.
I have problems with qtcreator (see qt-forums). Suspecting this might be because Qt is using the old system libraries, I ran qt using



strace -e open qtcreator.sh


and indeed, it uses the libraries in /usr/lib/x86_64-linux-gnu/qtcreator/



To load the correct libaries, the qrcreator.sh script sets LD_LIBRARY_PATH to



/home/<me>/Qt/Tools/QtCreator/lib:/home/<me>/Qt/Tools/QtCreator/lib/qtcreator


this is correct, but still, the libraries from /usr/lib/x86_64-linux-gnu/qtcreator are used.



How can I tell qtcreator to use the local libraries despite the existence of the system wide libraries?


More From » application-development

 Answers
6

To Nathan's option, I would add patchelf which allows to change the RPATH of an executable. I personally prefer patching RPATH over defining LD_LIBRARY_PATH and the like, since Ubuntu has issue defining these in profile and also as if not defining this in profile, this save the need of a wrapper script.



To define an executable RPATH which is relative to the application's directory (if you wish to, that's not mandatory to do so), you have to use $ORIGIN taking care to escape the $ which must appears literally (so use $ORIGIN if you invoke patchelf from a shell). Ex. if the application belongs a bin directory and the libraries belongs to a peer lib directory, you will use $ORIGIN/../lib for the RPATH.



You may as well use an absolute RPATH if you prefer.



See Patchelf (nixos.org).


[#20149] Thursday, April 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rtbrbab

Total Points: 461
Total Questions: 126
Total Answers: 117

Location: Saudi Arabia
Member since Fri, Jul 1, 2022
2 Years ago
;