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


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?

  • Try this: export LD_LIBRARY_PATH=${HOME}/Qt/Tools/QtCreator/lib/:${HOME}/Qt/Tools/QtCreator/lib/qtcreator/:${LD_LIBRARY_PATH} and give me a comment with @A.B. – A.B. May 5 '15 at 16:16
  • edit your question and post the line with the export of "/home/<me>/Qt/Tools/QtCreator/lib:/home/<me>/Qt/Tools/QtCreator/lib/qtcreator" – A.B. May 5 '15 at 16:19
  • @A.B. That does not make a difference. And I do not see why it should, it results in the same LD_LIBRARY_PATH, does it not? The qtcreator.sh script (shipping with qtcreator) is a little bit lengthy I think. I know that the posted LD_LIBRARY_PATH is correct because I added a "echo $LD_LIBRARY_PATH" to the script. If you still want I can post it. – Nathan May 5 '15 at 17:13

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).

| improve this answer | |

One can preload libraries using the "LD_PRELOAD" environment variable. Simply specify the full path of the so files like this:

export LD_PRELOAD = "/path/to/so1.so /path/to/so2.so"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.