I have Qt Creator installed on Ubuntu 10.04 LTS. When I launch Qt Creator from the desktop I can build the application I am working on but cannot run or debug it. After struggling quite a bit I found that LD_LIBRARY_PATH is not set for applications that are run from the desktop. If I start Qt Creator from bash (where LD_LIBRARY_PATH is set in .bashrc) everything runs and debugs perfectly.

How do I set LD_LIBRARY_PATH so that it is set for all running applications?


This seems like a bug in the application itself. It should have a wrapper script that correctly sets any needed LD_LIBRARY_PATH variables. Be careful when writing such a script, though, since you do not want to have any empty portion of the LD_LIBRARY_PATH string between the colons it uses as path separators. For example, this could result in a bad path, if the variable was empty initially (resulting in a leading empty string before the colon):


So, when adding a path, you'll want to test for the empty string first. For example, using shell code:


Create a new file /etc/ld.so.conf containing:

# Begin /etc/ld.so.conf
# whatever else #

Update the dynamic loader cache by running:


In addition to .bashrc, also set the environment variable in .profile. This file will get processed and loaded by your session, so it should affect everything running as your user. Also: This file says it is not read by Bash if .bashrc exists, but it seems to apply still (perhaps since Bash inherits the X session from where it was started). It doesn't hurt to have the variable in both files, though.

  • I tried creating .profile as well with no luck.
    – dwj
    Oct 28 '10 at 16:44
  • I read somewhere that there is a "safety" feature of Ubuntu(Debian?) that can't let you set LD_LIBRARY_PATH at startup since it is overwritten after loading .profile. There are still workarounds.
    – alfC
    Nov 7 '11 at 6:32

set it in /etc/bash.bashrc near the top to make a system wide change on bootup.

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.